+emacs-lisp-eval: emit backtrace on error
Running +eval/region (gr) and +eval/buffer (gR) will use +emacs-lisp-eval (in emacs-lisp-mode buffers). This change will force it to emit a backtrace in case of an error.
This commit is contained in:
parent
8bdb42fe15
commit
2a84836c11
1 changed files with 16 additions and 12 deletions
|
@ -8,10 +8,15 @@
|
||||||
"Evaluate a region and print it to the echo area (if one line long), otherwise
|
"Evaluate a region and print it to the echo area (if one line long), otherwise
|
||||||
to a pop up buffer."
|
to a pop up buffer."
|
||||||
(require 'pp)
|
(require 'pp)
|
||||||
(let ((result (eval (read (concat "(progn " (buffer-substring-no-properties beg end) "\n)"))))
|
(let ((result
|
||||||
|
(let ((debug-on-error t))
|
||||||
|
(eval (read
|
||||||
|
(concat "(progn "
|
||||||
|
(buffer-substring-no-properties beg end)
|
||||||
|
"\n)"))
|
||||||
|
t)))
|
||||||
(buf (get-buffer-create "*doom eval*"))
|
(buf (get-buffer-create "*doom eval*"))
|
||||||
(inhibit-read-only t)
|
(inhibit-read-only t))
|
||||||
lines)
|
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(read-only-mode +1)
|
(read-only-mode +1)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
|
@ -20,15 +25,14 @@ to a pop up buffer."
|
||||||
(emacs-lisp-mode))
|
(emacs-lisp-mode))
|
||||||
(prin1 result buf)
|
(prin1 result buf)
|
||||||
(pp-buffer)
|
(pp-buffer)
|
||||||
(setq lines (count-lines (point-min) (point-max)))
|
(let ((lines (count-lines (point-min) (point-max))))
|
||||||
(cond ((> lines 1)
|
(if (> lines 1)
|
||||||
(save-selected-window
|
(save-selected-window
|
||||||
(pop-to-buffer buf)
|
(pop-to-buffer buf)
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(goto-char (point-min)))))
|
(goto-char (point-min))))
|
||||||
(t
|
(message "%s" (buffer-substring (point-min) (point-max)))
|
||||||
(message "%s" (buffer-substring (point-min) (point-max)))
|
(kill-buffer buf))))))
|
||||||
(kill-buffer buf))))))
|
|
||||||
|
|
||||||
(defvar +emacs-lisp--face nil)
|
(defvar +emacs-lisp--face nil)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue