aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2016-07-09 22:56:25 +0900
committerTino Calancha2016-07-09 22:56:25 +0900
commitc3223dd505ba0ecde57371eae7e9a59637a852e4 (patch)
treec5d66cc5e4187d29b26a49a58c3aa8de70e21b07
parentbfc29a5bcef1df4380a4f043f05035b88cd5c482 (diff)
downloademacs-c3223dd505ba0ecde57371eae7e9a59637a852e4.tar.gz
emacs-c3223dd505ba0ecde57371eae7e9a59637a852e4.zip
Detect aliases to built-in functions
* 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.
-rw-r--r--lisp/help-fns.el16
-rw-r--r--test/lisp/help-fns-tests.el1
2 files changed, 10 insertions, 7 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 9464c0b0d97..e4e23330e37 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -572,13 +572,17 @@ FILE is the file where FUNCTION was probably defined."
572 (aliased (or (symbolp def) 572 (aliased (or (symbolp def)
573 ;; Advised & aliased function. 573 ;; Advised & aliased function.
574 (and advised (symbolp real-function) 574 (and advised (symbolp real-function)
575 (not (eq 'autoload (car-safe def)))))) 575 (not (eq 'autoload (car-safe def))))
576 (and (subrp def)
577 (not (string= (subr-name def)
578 (symbol-name function))))))
576 (real-def (cond 579 (real-def (cond
577 (aliased (let ((f real-function)) 580 ((and aliased (not (subrp def)))
578 (while (and (fboundp f) 581 (let ((f real-function))
579 (symbolp (symbol-function f))) 582 (while (and (fboundp f)
580 (setq f (symbol-function f))) 583 (symbolp (symbol-function f)))
581 f)) 584 (setq f (symbol-function f)))
585 f))
582 ((subrp def) (intern (subr-name def))) 586 ((subrp def) (intern (subr-name def)))
583 (t def))) 587 (t def)))
584 (sig-key (if (subrp def) 588 (sig-key (if (subrp def)
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 4239a2afefc..ba0d8ed8e38 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -77,7 +77,6 @@ Return first line of the output of (describe-function-1 FUNC)."
77 77
78(ert-deftest help-fns-test-bug23887 () 78(ert-deftest help-fns-test-bug23887 ()
79 "Test for http://debbugs.gnu.org/23887 ." 79 "Test for http://debbugs.gnu.org/23887 ."
80 :expected-result :failed
81 (let ((regexp "an alias for .re-search-forward. in .subr\.el") 80 (let ((regexp "an alias for .re-search-forward. in .subr\.el")
82 (result (help-fns-tests--describe-function 'search-forward-regexp))) 81 (result (help-fns-tests--describe-function 'search-forward-regexp)))
83 (should (string-match regexp result)))) 82 (should (string-match regexp result))))