emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 938bca8: Avoid generating invalid usage info for pa


From: Stefan Monnier
Subject: [Emacs-diffs] master 938bca8: Avoid generating invalid usage info for pathological function
Date: Thu, 22 Jan 2015 04:16:52 +0000

branch: master
commit 938bca8e4141f5f96497f9be26b0ea0bb90f40cd
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    Avoid generating invalid usage info for pathological function
    
    Fixes: debbugs:19645
    
    * lisp/help.el (help-make-usage): Don't turn a "_" arg into an empty-string.
    * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Don't confuse a string
    body with a docstring.
---
 lisp/ChangeLog                |    7 +++++++
 lisp/emacs-lisp/cl-generic.el |    5 +++--
 lisp/help.el                  |    2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 39ae463..c000d6b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-22  Stefan Monnier  <address@hidden>
+
+       * help.el (help-make-usage): Don't turn a "_" arg into an empty-string
+       arg (bug#19645).
+       * emacs-lisp/cl-generic.el (cl--generic-lambda): Don't confuse a string
+       body with a docstring.
+
 2015-01-22  Dmitry Gutov  <address@hidden>
 
        * progmodes/xref.el (xref-location-marker, xref-location-group):
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 8dee9a3..f214faf 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -228,7 +228,8 @@ This macro can only be used within the lexical scope of a 
cl-generic method."
     "Make the lambda expression for a method with ARGS and BODY."
     (let ((plain-args ())
           (specializers nil)
-          (doc-string (if (stringp (car-safe body)) (pop body)))
+          (doc-string (if (and (stringp (car-safe body)) (cdr body))
+                          (pop body)))
           (mandatory t))
       (dolist (arg args)
         (push (pcase arg
@@ -252,7 +253,7 @@ This macro can only be used within the lexical scope of a 
cl-generic method."
           ;; destructuring args, `declare' and whatnot).
           (pcase (macroexpand fun macroenv)
             (`#'(lambda ,args . ,body)
-             (let* ((doc-string (and doc-string (stringp (car body))
+             (let* ((doc-string (and doc-string (stringp (car body)) (cdr body)
                                      (pop body)))
                     (cnm (make-symbol "cl--cnm"))
                     (nmp (make-symbol "cl--nmp"))
diff --git a/lisp/help.el b/lisp/help.el
index 39ec6be..bf72425 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1445,7 +1445,7 @@ the same names as used in the original source code, when 
possible."
                    (let ((name (symbol-name arg)))
                      (cond
                        ((string-match "\\`&" name) arg)
-                       ((string-match "\\`_" name)
+                       ((string-match "\\`_." name)
                         (intern (upcase (substring name 1))))
                        (t (intern (upcase name)))))))
                arglist)))



reply via email to

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