changeset 5162:41262f87eb39

Handle (function ...) specially, cl-prettyprint. 2010-03-21 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (cl-prettyprint): Handle (function ...) specially here, as we do (quote ...).
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 21 Mar 2010 13:20:35 +0000
parents 125f4119e64d
children 57f4dcb14ad5
files lisp/ChangeLog lisp/cl-extra.el
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Mar 20 20:22:00 2010 -0500
+++ b/lisp/ChangeLog	Sun Mar 21 13:20:35 2010 +0000
@@ -1,3 +1,8 @@
+2010-03-21  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* cl-extra.el (cl-prettyprint):
+	Handle (function ...) specially here, as we do (quote ...).
+
 2010-03-20  Ben Wing  <ben@xemacs.org>
 
 	* diagnose.el (show-memory-usage):
--- a/lisp/cl-extra.el	Sat Mar 20 20:22:00 2010 -0500
+++ b/lisp/cl-extra.el	Sun Mar 21 13:20:35 2010 +0000
@@ -688,15 +688,19 @@
 
 (defun cl-prettyprint (form)
   "Insert a pretty-printed rendition of a Lisp FORM in current buffer."
-  (let ((pt (point)) last)
+  (let ((pt (point)) last just)
     (insert "\n" (prin1-to-string form) "\n")
     (setq last (point))
     (goto-char (1+ pt))
-    (while (search-forward "(quote " last t)
-      (delete-backward-char 7)
-      (insert "'")
+    (while (re-search-forward "(\\(?:\\(?:function\\|quote\\) \\)" last t)
+      (delete-region (match-beginning 0) (match-end 0))
+      (if (= (length "(function ") (- (match-end 0) (match-beginning 0)))
+	  (insert "#'")
+	(insert "'"))
+      (setq just (point))
       (forward-sexp)
-      (delete-char 1))
+      (delete-char 1)
+      (goto-char just))
     (goto-char (1+ pt))
     (cl-do-prettyprint)))