From 84f59f75853704520323fb37edee4fe03d2f3021 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 12 Mar 2022 18:53:36 +0100 Subject: Make find-function-regexp also find cl-defun/defmethod * lisp/emacs-lisp/find-func.el (find-function-regexp): Also find cl-defun and cl-defmethod (bug#54343). --- lisp/emacs-lisp/find-func.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 571087c963d..777334a7a70 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -61,6 +61,7 @@ "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\ foo\\|\\(?:[^icfgv]\\|g[^r]\\)\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\ +cl-\\(?:defun\\|defmethod\\)\\|\ menu-bar-make-toggle\\|menu-bar-make-toggle-command\\)" find-function-space-re "\\('\\|(quote \\)?%s\\(\\s-\\|$\\|[()]\\)") -- cgit v1.2.3 From 466a7e44d729683277dab41dba7395b36802a8cf Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 13 Mar 2022 15:07:59 +0100 Subject: Add cl-defgeneric to find-func, too * lisp/emacs-lisp/find-func.el (find-function-regexp): Add cl-defgeneric, too (bug#54343). --- lisp/emacs-lisp/find-func.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 777334a7a70..208d68d1ab9 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -61,7 +61,7 @@ "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\ foo\\|\\(?:[^icfgv]\\|g[^r]\\)\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\ -cl-\\(?:defun\\|defmethod\\)\\|\ +cl-\\(?:defun\\|defmethod\\|generic\\)\\|\ menu-bar-make-toggle\\|menu-bar-make-toggle-command\\)" find-function-space-re "\\('\\|(quote \\)?%s\\(\\s-\\|$\\|[()]\\)") -- cgit v1.2.3 From 510f1f2e72a467cdaae25c4354e5ce3579ca1ca9 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 13 Mar 2022 21:15:35 +0100 Subject: Really fix find-func for defgeneric * lisp/emacs-lisp/find-func.el (find-function-regexp): Really add defgeneric. --- lisp/emacs-lisp/find-func.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 208d68d1ab9..96eaf1ab642 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -61,7 +61,7 @@ "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\ foo\\|\\(?:[^icfgv]\\|g[^r]\\)\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\ -cl-\\(?:defun\\|defmethod\\|generic\\)\\|\ +cl-\\(?:defun\\|defmethod\\|defgeneric\\)\\|\ menu-bar-make-toggle\\|menu-bar-make-toggle-command\\)" find-function-space-re "\\('\\|(quote \\)?%s\\(\\s-\\|$\\|[()]\\)") -- cgit v1.2.3 From a98413726f5a10676f9faf4c4013ac6eaa53b42b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 7 Jun 2022 10:30:47 -0400 Subject: find-func.el: Fix bug#41104 * lisp/emacs-lisp/find-func.el (find-function-advised-original): Look at the actual function definition rather than `advice--symbol-function` which sometimes returns only the advice. * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--find-library-verbose): Add test. --- lisp/emacs-lisp/find-func.el | 6 +++--- test/lisp/emacs-lisp/find-func-tests.el | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 96eaf1ab642..2dec51dd044 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -270,7 +270,7 @@ If FUNC is not a symbol, return it. Else, if it's not advised, return the symbol's function definition." (or (and (symbolp func) (featurep 'nadvice) - (let ((ofunc (advice--symbol-function func))) + (let ((ofunc (symbol-function func))) (if (advice--p ofunc) (advice--cd*r ofunc) ofunc))) @@ -516,8 +516,8 @@ Return t if any PRED returns t." (defun find-function-library (function &optional lisp-only verbose) "Return the pair (ORIG-FUNCTION . LIBRARY) for FUNCTION. -ORIG-FUNCTION is the original name, after removing all advice and -resolving aliases. LIBRARY is an absolute file name, a relative +ORIG-FUNCTION is the original name, after resolving aliases. +LIBRARY is an absolute file name, a relative file name inside the C sources directory, or a name of an autoloaded feature. diff --git a/test/lisp/emacs-lisp/find-func-tests.el b/test/lisp/emacs-lisp/find-func-tests.el index d29d9ff6563..420c61acb55 100644 --- a/test/lisp/emacs-lisp/find-func-tests.el +++ b/test/lisp/emacs-lisp/find-func-tests.el @@ -95,6 +95,13 @@ expected function symbol and function library, respectively." (advice-remove #'mark-sexp 'my-message)) (ert-deftest find-func-tests--find-library-verbose () + (unwind-protect + (progn + (advice-add 'dired :before #'ignore) + ;; bug#41104 + (should (equal (find-function-library #'dired) '(dired . "dired")))) + (advice-remove 'dired #'ignore)) + (find-function-library #'join-line nil t) (with-current-buffer "*Messages*" (save-excursion -- cgit v1.2.3 From 4a3a73dd32bbb424cc3cbab31adc8a84d0b5916f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 11 Jun 2022 23:50:35 -0400 Subject: * lisp/emacs-lisp/find-func.el (find-function-advised-original): Simplify --- lisp/emacs-lisp/find-func.el | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 2dec51dd044..ac84b50b5fc 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -269,11 +269,7 @@ defined in C.") If FUNC is not a symbol, return it. Else, if it's not advised, return the symbol's function definition." (or (and (symbolp func) - (featurep 'nadvice) - (let ((ofunc (symbol-function func))) - (if (advice--p ofunc) - (advice--cd*r ofunc) - ofunc))) + (advice--cd*r (symbol-function func))) func)) (defun find-function-C-source (fun-or-var file type) -- cgit v1.2.3 From 2f0ed2280e0075c68ab9b110068bf5395fe256e3 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 30 Jun 2022 12:49:40 +0200 Subject: Add find-function-setup-keys bindings for find-library commands * lisp/emacs-lisp/find-func.el (find-function-setup-keys): Add `L' bindings for the find-library family of commands (bug#51240). --- etc/NEWS | 5 +++++ lisp/emacs-lisp/find-func.el | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/find-func.el') diff --git a/etc/NEWS b/etc/NEWS index 1ec9603640d..0dc76746554 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -314,6 +314,11 @@ startup. Previously, these functions ignored * Changes in Emacs 29.1 +** New bindings in 'find-function-setup-keys' for 'find-library'. +When 'find-function-setup-keys' is enabled, 'C-x L' is now bound to +'find-library', 'C-x 4 L' is now bound to 'find-library-other-window' +and 'C-x 5 L' is now bound to 'find-library-other-frame'. + +++ ** New key binding after 'M-x' or 'M-X': 'M-X'. Emacs allows different completion predicates to be used with 'M-x' diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index ac84b50b5fc..486d5d08614 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -800,7 +800,10 @@ See `find-function-on-key'." (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) (define-key ctl-x-map "V" 'find-variable) (define-key ctl-x-4-map "V" 'find-variable-other-window) - (define-key ctl-x-5-map "V" 'find-variable-other-frame)) + (define-key ctl-x-5-map "V" 'find-variable-other-frame) + (define-key ctl-x-map "L" 'find-library) + (define-key ctl-x-4-map "L" 'find-library-other-window) + (define-key ctl-x-5-map "L" 'find-library-other-frame)) (provide 'find-func) -- cgit v1.2.3