[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pp-to-string, defun and "()"
From: |
Thien-Thi Nguyen |
Subject: |
Re: pp-to-string, defun and "()" |
Date: |
Sun, 04 Nov 2007 11:03:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
() yzhh <address@hidden>
() Sun, 04 Nov 2007 17:22:09 +0800
The "()" is translated to "nil" which does not look good, and
the doc string is put in the same line place. Any suggesting?
extend pp-buffer to special-case defun (and defun-like) forms.
see sketch below.
thi
___________________________________________________________
--- pp.el 3 Aug 2007 03:13:44 -0000 1.35
+++ pp.el 4 Nov 2007 10:03:34 -0000
@@ -86,6 +86,19 @@
(insert ?\n))
(t (goto-char (point-max)))))
(goto-char (point-min))
+ ;; Special-case (def... () "DOCSTRING").
+ (condition-case err-var
+ (when (looking-at "(def[^ ]+ [^\"]+\"")
+ (goto-char (1- (match-end 0)))
+ (insert "\n")
+ (forward-sexp 1)
+ (unless (eolp)
+ (insert "\n"))
+ (forward-sexp -2)
+ (when (looking-at "nil")
+ (replace-match "()")))
+ (error nil))
+ (goto-char (point-min))
(indent-sexp))
;;;###autoload