lang/emacs-lisp: refactor +emacs-lisp-eval
This commit is contained in:
parent
4105c26b2a
commit
9ac3b1fea8
1 changed files with 16 additions and 14 deletions
|
@ -17,19 +17,21 @@
|
|||
to a pop up buffer."
|
||||
(require 'pp)
|
||||
(let ((result (eval (read (buffer-substring-no-properties beg end))))
|
||||
(buf (get-buffer-create "*eval*"))
|
||||
(buf (get-buffer-create "*doom eval*"))
|
||||
(inhibit-read-only t)
|
||||
lines)
|
||||
(with-current-buffer buf
|
||||
(read-only-mode +1)
|
||||
(setq-local scroll-margin 0)
|
||||
(emacs-lisp-mode)
|
||||
(prin1 result buf)
|
||||
(pp-buffer)
|
||||
(setq lines (count-lines (point-min) (point-max)))
|
||||
(goto-char (point-min))
|
||||
(when (<= lines 1)
|
||||
(message "%s" (buffer-substring (point-min) (point-max)))
|
||||
(kill-buffer buf)))
|
||||
(when (> lines 1)
|
||||
(doom-popup-buffer buf))))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(with-current-buffer buf
|
||||
(read-only-mode +1)
|
||||
(erase-buffer)
|
||||
(setq-local scroll-margin 0)
|
||||
(emacs-lisp-mode)
|
||||
(prin1 result buf)
|
||||
(pp-buffer)
|
||||
(setq lines (count-lines (point-min) (point-max)))
|
||||
(goto-char (point-min))
|
||||
(if (> lines 1)
|
||||
(doom-popup-buffer buf)
|
||||
(message "%s" (buffer-substring (point-min) (point-max)))
|
||||
(kill-buffer buf)))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue