emacs-diffs
[Top][All Lists]
Advanced

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

master 9a1522197fb: (cl--generic-describe): Fix regression introduced by


From: Stefan Monnier
Subject: master 9a1522197fb: (cl--generic-describe): Fix regression introduced by fix to bug#54628
Date: Sun, 11 Feb 2024 18:13:33 -0500 (EST)

branch: master
commit 9a1522197fb16986c2f641f777d6bef41c348567
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (cl--generic-describe): Fix regression introduced by fix to bug#54628
    
    Since that fix, we made other changes (put arg names in allcaps)
    which also happen to fix bug#54628, so we can remove the original fix
    which was suboptimal when the type includes quotes.
    
    * lisp/emacs-lisp/cl-generic.el (cl--generic-describe):
    Don't rebind `print-quoted` to nil.
    
    * test/lisp/emacs-lisp/cl-generic-tests.el
    (cl-generic-tests--print-quoted): New test.
---
 lisp/emacs-lisp/cl-generic.el            |  5 ++---
 test/lisp/emacs-lisp/cl-generic-tests.el | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index bdccdcc48ce..d1bd45120f1 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -1145,7 +1145,7 @@ MET-NAME is as returned by 
`cl--generic-load-hist-format'."
   (declare-function help-fns-short-filename "help-fns" (filename))
   (let ((generic (if (symbolp function) (cl--generic function))))
     (when generic
-      (require 'help-mode)              ;Needed for `help-function-def' button!
+      (require 'help-mode)       ;Needed for `help-function-def' button!
       (save-excursion
         ;; Ensure that we have two blank lines (but not more).
         (unless (looking-back "\n\n" (- (point) 2))
@@ -1157,8 +1157,7 @@ MET-NAME is as returned by 
`cl--generic-load-hist-format'."
           (pcase-let*
               ((`(,qualifiers ,args ,doc) (cl--generic-method-info method)))
             ;; FIXME: Add hyperlinks for the types as well.
-            (let ((print-quoted nil)
-                  (quals (if (length> qualifiers 0)
+            (let ((quals (if (length> qualifiers 0)
                              (concat (substring qualifiers
                                                 0 (string-match " *\\'"
                                                                 qualifiers))
diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el 
b/test/lisp/emacs-lisp/cl-generic-tests.el
index 086ac399352..990fa580c54 100644
--- a/test/lisp/emacs-lisp/cl-generic-tests.el
+++ b/test/lisp/emacs-lisp/cl-generic-tests.el
@@ -319,5 +319,19 @@ Edebug symbols (Bug#42672)."
       (and (eq 'error (car err))
            (string-match "Stray.*declare" (cadr err)))))))
 
+(cl-defmethod cl-generic-tests--print-quoted-method ((function (eql '4)))
+  (+ function 1))
+
+(ert-deftest cl-generic-tests--print-quoted ()
+  (with-temp-buffer
+    (cl--generic-describe 'cl-generic-tests--print-quoted-method)
+    (goto-char (point-min))
+    ;; Bug#54628: We don't want (function (eql '4)) to turn into #'(eql '4)
+    (should-not (re-search-forward "#'" nil t))
+    (goto-char (point-min))
+    ;; But we don't want (eql '4) to turn into (eql (quote 4)) either.
+    (should (re-search-forward "(eql '4)" nil t))))
+    
+
 (provide 'cl-generic-tests)
 ;;; cl-generic-tests.el ends here



reply via email to

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