]> code.delx.au - gnu-emacs/commitdiff
Detect aliases to built-in functions
authorTino Calancha <tino.calancha@gmail.com>
Sat, 9 Jul 2016 13:56:25 +0000 (22:56 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Sat, 9 Jul 2016 13:56:25 +0000 (22:56 +0900)
* lisp/help-fns.el (describe-function-1): Check for aliases
defined with (defalias alias (symbol-function built-in)) (Bug#23887).

* test/lisp/help-fns-tests.el (help-fns-test-bug23887): Untag as
failing this test.

lisp/help-fns.el
test/lisp/help-fns-tests.el

index 9464c0b0d9700ed83659853d883479029fea8f4c..e4e23330e37b0b044c53cc8dea08032722a34184 100644 (file)
@@ -572,13 +572,17 @@ FILE is the file where FUNCTION was probably defined."
         (aliased (or (symbolp def)
                      ;; Advised & aliased function.
                      (and advised (symbolp real-function)
-                          (not (eq 'autoload (car-safe def))))))
+                          (not (eq 'autoload (car-safe def))))
+                      (and (subrp def)
+                           (not (string= (subr-name def)
+                                         (symbol-name function))))))
         (real-def (cond
-                   (aliased (let ((f real-function))
-                              (while (and (fboundp f)
-                                          (symbolp (symbol-function f)))
-                                (setq f (symbol-function f)))
-                              f))
+                    ((and aliased (not (subrp def)))
+                     (let ((f real-function))
+                       (while (and (fboundp f)
+                                   (symbolp (symbol-function f)))
+                         (setq f (symbol-function f)))
+                       f))
                    ((subrp def) (intern (subr-name def)))
                    (t def)))
         (sig-key (if (subrp def)
index 4239a2afefc84fc23b2b7f6f93fb85a9303a6b25..ba0d8ed8e385fb155a9e611fb935c491e1c49e32 100644 (file)
@@ -77,7 +77,6 @@ Return first line of the output of (describe-function-1 FUNC)."
 
 (ert-deftest help-fns-test-bug23887 ()
   "Test for http://debbugs.gnu.org/23887 ."
-  :expected-result :failed
   (let ((regexp "an alias for .re-search-forward. in .subr\.el")
         (result (help-fns-tests--describe-function 'search-forward-regexp)))
     (should (string-match regexp result))))