[COMMIT] Handle (function ...) specially, cl-prettyprint.

Aidan Kehoe kehoea at parhasard.net
Sun Mar 21 09:21:28 EDT 2010


APPROVE COMMIT

NOTE: This patch has been committed.

# HG changeset patch
# User Aidan Kehoe <kehoea at parhasard.net>
# Date 1269177635 0
# Node ID 41262f87eb39b26d177ffe627a7714d1b6b3dadd
# Parent  125f4119e64d2701b0595f29a90170db226f2b22
Handle (function ...) specially, cl-prettyprint.

2010-03-21  Aidan Kehoe  <kehoea at parhasard.net>

	* cl-extra.el (cl-prettyprint):
	Handle (function ...) specially here, as we do (quote ...).

diff -r 125f4119e64d -r 41262f87eb39 lisp/ChangeLog
--- 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 at parhasard.net>
+
+	* cl-extra.el (cl-prettyprint):
+	Handle (function ...) specially here, as we do (quote ...).
+
 2010-03-20  Ben Wing  <ben at xemacs.org>
 
 	* diagnose.el (show-memory-usage):
diff -r 125f4119e64d -r 41262f87eb39 lisp/cl-extra.el
--- 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)))
 


-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research



More information about the XEmacs-Patches mailing list