]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid generating invalid usage info for pathological function
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Jan 2015 04:16:45 +0000 (23:16 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 22 Jan 2015 04:16:45 +0000 (23:16 -0500)
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
lisp/emacs-lisp/cl-generic.el
lisp/help.el

index 39ae463b0439e37d92bcb429ed72873d09b84f49..c000d6bb9a61cb5d27d100588a275812f0675b30 100644 (file)
@@ -1,3 +1,10 @@
+2015-01-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * 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  <dgutov@yandex.ru>
 
        * progmodes/xref.el (xref-location-marker, xref-location-group):
index 8dee9a38ab073eb4195c54a6fb05ad876ca29237..f214faff23794fe761b41f650850c5226430642c 100644 (file)
@@ -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"))
index 39ec6be1fde1fe6317a42e085ef9bb62333e2335..bf724252d5ac2215b8f0dcf5a3c427d53a8bfd8c 100644 (file)
@@ -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)))