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."
|
to a pop up buffer."
|
||||||
(require 'pp)
|
(require 'pp)
|
||||||
(let ((result (eval (read (buffer-substring-no-properties beg end))))
|
(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)
|
(inhibit-read-only t)
|
||||||
lines)
|
lines)
|
||||||
(with-current-buffer buf
|
(unwind-protect
|
||||||
(read-only-mode +1)
|
(progn
|
||||||
(setq-local scroll-margin 0)
|
(with-current-buffer buf
|
||||||
(emacs-lisp-mode)
|
(read-only-mode +1)
|
||||||
(prin1 result buf)
|
(erase-buffer)
|
||||||
(pp-buffer)
|
(setq-local scroll-margin 0)
|
||||||
(setq lines (count-lines (point-min) (point-max)))
|
(emacs-lisp-mode)
|
||||||
(goto-char (point-min))
|
(prin1 result buf)
|
||||||
(when (<= lines 1)
|
(pp-buffer)
|
||||||
(message "%s" (buffer-substring (point-min) (point-max)))
|
(setq lines (count-lines (point-min) (point-max)))
|
||||||
(kill-buffer buf)))
|
(goto-char (point-min))
|
||||||
(when (> lines 1)
|
(if (> lines 1)
|
||||||
(doom-popup-buffer buf))))
|
(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