summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pp.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-03-25 16:44:01 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-03-25 16:44:30 +0100
commit3e7257c3ed3e7f5451d4dab0b222f93a2d1b2aa3 (patch)
tree1b47f738902f95243a93d90cb0bc2448ce258559 /lisp/emacs-lisp/pp.el
parent4dfd42014b50aadd82b425747fe65fa97df28caa (diff)
downloademacs-3e7257c3ed3e7f5451d4dab0b222f93a2d1b2aa3.tar.gz
emacs-3e7257c3ed3e7f5451d4dab0b222f93a2d1b2aa3.tar.bz2
emacs-3e7257c3ed3e7f5451d4dab0b222f93a2d1b2aa3.zip
Improve pp-last-sexp ergonomics
* lisp/emacs-lisp/pp.el (pp-last-sexp): Ignore ,@? before a sexp, because eval-ing that will always lead to an error (bug#54537).
Diffstat (limited to 'lisp/emacs-lisp/pp.el')
-rw-r--r--lisp/emacs-lisp/pp.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index e782cdb1dab..ad693fa5a61 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -177,6 +177,10 @@ Also add the value to the front of the list in the variable `values'."
(let ((pt (point)))
(save-excursion
(forward-sexp -1)
+ ;; Make `pp-eval-last-sexp' work the same way `eval-last-sexp'
+ ;; does.
+ (when (looking-at ",@?")
+ (goto-char (match-end 0)))
(read
;; If first line is commented, ignore all leading comments:
(if (save-excursion (beginning-of-line) (looking-at-p "[ \t]*;"))