Refactor feature/debugger (still WIP)
This commit is contained in:
parent
637824e543
commit
63a4a61714
2 changed files with 27 additions and 23 deletions
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +debugger/quit ()
|
(defun +debugger/quit ()
|
||||||
|
"Quit the active debugger, if any."
|
||||||
(interactive)
|
(interactive)
|
||||||
(ignore-errors (call-interactively 'realgud:cmd-quit))
|
(ignore-errors (call-interactively #'realgud:cmd-quit))
|
||||||
(doom/popup-close)
|
(doom/popup-close)
|
||||||
(evil-normal-state))
|
(when (featurep 'evil)
|
||||||
|
(evil-normal-state)))
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,31 @@
|
||||||
;;; feature/debugger/autoload/evil.el -*- lexical-binding: t; -*-
|
;;; feature/debugger/autoload/evil.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;;###autoload (autoload '+debugger:run "feature/debugger/autoload/evil" nil t)
|
;;;###autoload (autoload '+debugger:start "feature/debugger/autoload/evil" nil t)
|
||||||
(evil-define-command +debugger:run (&optional path)
|
(evil-define-command +debugger:start (&optional path)
|
||||||
"Initiate debugger for current major mode"
|
"Initiate debugger for current major mode"
|
||||||
(interactive "<f>")
|
(interactive "<f>")
|
||||||
|
;; TODO Add python debugging
|
||||||
(let ((default-directory (doom-project-root)))
|
(let ((default-directory (doom-project-root)))
|
||||||
(cond ((memq major-mode '(c-mode c++-mode))
|
(pcase major-mode
|
||||||
|
((or 'c-mode 'c++-mode)
|
||||||
(realgud:gdb (if path (concat "gdb " path))))
|
(realgud:gdb (if path (concat "gdb " path))))
|
||||||
((memq major-mode '(ruby-mode enh-ruby-mode))
|
((or 'ruby-mode 'enh-ruby-mode)
|
||||||
|
;; FIXME
|
||||||
(doom:repl nil (format "run '%s'" (file-name-nondirectory (or path buffer-file-name)))))
|
(doom:repl nil (format "run '%s'" (file-name-nondirectory (or path buffer-file-name)))))
|
||||||
((eq major-mode 'sh-mode)
|
('sh-mode
|
||||||
(let ((shell sh-shell))
|
(let ((shell sh-shell))
|
||||||
(when (string= shell "sh")
|
(when (string= shell "sh")
|
||||||
(setq shell "bash"))
|
(setq shell "bash"))
|
||||||
(cond ((string= shell "bash")
|
(pcase shell
|
||||||
|
("bash"
|
||||||
(realgud:bashdb (if path (concat "bashdb " path))))
|
(realgud:bashdb (if path (concat "bashdb " path))))
|
||||||
((string= shell "zsh")
|
("zsh"
|
||||||
(realgud:zshdb (if path (concat "zshdb " path))))
|
(realgud:zshdb (if path (concat "zshdb " path))))
|
||||||
(t (user-error "No shell debugger for %s" shell)))))
|
(_ (user-error "No shell debugger for %s" shell)))))
|
||||||
;; TODO Add python debugging
|
((or 'js-mode 'js2-mode 'js3-mode)
|
||||||
((memq major-mode '(js-mode js2-mode js3-mode))
|
|
||||||
(realgud:trepanjs))
|
(realgud:trepanjs))
|
||||||
((eq major-mode 'haskell-mode)
|
('haskell-mode (haskell-debug))
|
||||||
(haskell-debug))
|
(_ (user-error "No debugger for %s" major-mode)))))
|
||||||
(t (user-error "No debugger for %s" major-mode)))))
|
|
||||||
|
|
||||||
;;;###autoload (autoload '+debugger:toggle-breakpoint "feature/debugger/autoload/evil" nil t)
|
;;;###autoload (autoload '+debugger:toggle-breakpoint "feature/debugger/autoload/evil" nil t)
|
||||||
(evil-define-command +debugger:toggle-breakpoint (&optional bang)
|
(evil-define-command +debugger:toggle-breakpoint (&optional bang)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue