doomemacs/core/core-eval.el

84 lines
2.7 KiB
EmacsLisp
Raw Normal View History

2015-12-20 15:26:34 +08:00
;;; core-eval.el
2015-06-15 15:05:52 +08:00
;; + Running inline code + REPLs (using `quickrun' + `repl-toggle')
;; + Almost-universal debugging (with `realgud')
;; + Simple code navigation (using `dump-jump' and `imenu-list')
;; + A universal tags config (WIP)
2016-05-21 07:08:02 +08:00
;; remove ellipsis when printing sexp in message buffer
(setq eval-expression-print-length nil
eval-expression-print-level nil)
2015-06-15 15:05:52 +08:00
(use-package quickrun
:commands (quickrun
quickrun-region
quickrun-with-arg
quickrun-shell
quickrun-compile-only
quickrun-replace-region
2015-06-24 21:39:13 +08:00
helm-quickrun)
2016-05-21 07:08:02 +08:00
:init (add-hook 'quickrun/mode-hook 'linum-mode)
2016-05-25 09:57:25 +08:00
:config
(setq quickrun-focus-p nil)
(def-popup! "*quickrun*" :align below :size 10))
2015-06-15 15:05:52 +08:00
2015-11-25 19:00:49 +08:00
(use-package repl-toggle
:commands (rtog/toggle-repl rtog/add-repl)
2016-05-25 09:57:25 +08:00
:preface (defvar rtog/mode-repl-alist nil)
2015-12-09 14:54:30 +08:00
:init
2016-05-25 09:57:25 +08:00
(defvar doom-repl-buffer nil "The current REPL buffer.")
2016-05-24 05:07:35 +08:00
(add-hook! repl-toggle-mode (evil-initialize-state 'emacs))
:config
2016-05-25 09:57:25 +08:00
(def-popup!
(:custom (lambda (b &rest _)
(when (and (featurep 'repl-toggle)
(string-prefix-p "*" (buffer-name (get-buffer b))))
(with-current-buffer b repl-toggle-mode))))
:popup t :align below :size 16 :select t)
(map! :map repl-toggle-mode-map
2016-02-24 02:09:15 +08:00
:ei "C-n" 'comint-next-input
:ei "C-p" 'comint-previous-input
:ei "<down>" 'comint-next-input
:ei "<up>" 'comint-previous-input))
2015-11-25 19:00:49 +08:00
;;
(after! debug
;; For elisp debugging
(map! :map debugger-mode-map
:n "RET" 'debug-help-follow
:n "n" 'debugger-step-through
:n "c" 'debugger-continue))
(use-package realgud
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
:config
(map! :map realgud:shortkey-mode-map
:n "j" 'evil-next-line
:n "k" 'evil-previous-line
:n "h" 'evil-backward-char
:n "l" 'evil-forward-char
;; FIXME Greedy command buffer always grabs focus
:m "n" 'realgud:cmd-next
:m "b" 'realgud:cmd-break
:m "B" 'realgud:cmd-clear
:n "c" 'realgud:cmd-continue)
2016-05-25 09:57:25 +08:00
;; Popup rules
(def-popup! "\\`\\*\\(g\\|zsh\\|bash\\)db.*?\\*\\'" :size 20 :regexp t)
(def-popup! "\\`\\*trepanjs.*?\\*\\'" :size 20 :regexp t)
;; Temporary Ex commands for the debugger
2016-05-21 10:37:30 +08:00
(def-tmp-excmd! doom:def-debug-on doom:def-debug-off
("n[ext]" . realgud:cmd-next)
("s[tep]" . realgud:cmd-step)
2016-05-21 10:37:30 +08:00
("b[reak]" . doom:debug-toggle-breakpoint)
("c[ontinue]" . realgud:cmd-continue))
2016-05-24 05:07:35 +08:00
;; TODO does this work with shackle?
2016-05-21 10:37:30 +08:00
(advice-add 'realgud-cmdbuf-init :after 'doom:def-debug-on)
(advice-add 'realgud:cmd-quit :after 'doom:def-debug-off))
2015-12-20 15:26:34 +08:00
(provide 'core-eval)
;;; core-eval.el ends here