emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-25 d0d9f55: Allow newlines inside cl function ar


From: Dmitry Gutov
Subject: Re: [Emacs-diffs] emacs-25 d0d9f55: Allow newlines inside cl function arglists
Date: Tue, 10 May 2016 15:49:33 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1

On 05/10/2016 03:36 PM, Andreas Schwab wrote:
help-add-fundoc-usage does not currently use prin1.

Yes, it does, via format.

OK, it does, in the "else" branch. But what will we do in the (stringp arglist) case? format with %s does not use prin1, and we're back to the same problem: %S would add the unwanted quotes and escapes.

Maybe if that case were to be eliminated in the callers... but that's not a change for emacs-25.

To be clear, this is what doesn't work:

diff --git a/lisp/help.el b/lisp/help.el
index 7289375..5e66042 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1394,11 +1394,12 @@ help-add-fundoc-usage
            (if (string-match "\n?\n\\'" docstring)
                (if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "")
              "\n\n")
-           (if (stringp arglist)
- (if (string-match "\\`[^ ]+\\(\\(?:.\\|\n\\)*\\))\\'" arglist)
-                    (concat "(fn" (match-string 1 arglist) ")")
-                  (error "Unrecognized usage format"))
-             (help--make-usage-docstring 'fn arglist)))))
+            (let ((print-escape-newlines t))
+              (if (stringp arglist)
+ (if (string-match "\\`[^ ]+\\(\\(?:.\\|\n\\)*\\))\\'" arglist)
+                      (format "(fn%s)" (match-string 1 arglist))
+                    (error "Unrecognized usage format"))
+                (help--make-usage-docstring 'fn arglist))))))

 (defun help-function-arglist (def &optional preserve-names)
   "Return a formal argument list for the function DEF.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]