summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pp.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-01-04 15:50:56 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-01-04 15:51:04 +0100
commit0d315102fed8cecccbac15232304000df5b66406 (patch)
tree53c45963ec5599f5626923b1b7fe5489b403fa97 /lisp/emacs-lisp/pp.el
parent38b4bbb7e1abaa9f925048840b53290e2011a851 (diff)
downloademacs-0d315102fed8cecccbac15232304000df5b66406.tar.gz
Improve pp-emacs-lisp-code for #'
* lisp/emacs-lisp/pp.el (pp--insert-lisp): Format (function ...) as #'.
Diffstat (limited to 'lisp/emacs-lisp/pp.el')
-rw-r--r--lisp/emacs-lisp/pp.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index a4dbd637553..d199716b2c5 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -24,6 +24,7 @@
;;; Code:
+(require 'cl-lib)
(defvar font-lock-verbose)
(defgroup pp nil
@@ -233,13 +234,14 @@ Use the `pp-max-width' variable to control the desired line length."
(cons (cond
((consp (cdr sexp))
(if (and (length= sexp 2)
- (eq (car sexp) 'quote))
+ (memq (car sexp) '(quote function)))
(cond
((symbolp (cadr sexp))
(let ((print-quoted t))
(prin1 sexp (current-buffer))))
((consp (cadr sexp))
- (insert "'")
+ (insert (if (eq (car sexp) 'quote)
+ "'" "#'"))
(pp--format-list (cadr sexp)
(set-marker (make-marker) (1- (point))))))
(pp--format-list sexp)))