summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/find-func.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/find-func.el')
-rw-r--r--lisp/emacs-lisp/find-func.el28
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index e5dceb5e4a3..411602ef166 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -42,8 +42,6 @@
;;; Code:
-(eval-when-compile (require 'cl-lib))
-
;;; User variables:
(defgroup find-function nil
@@ -62,6 +60,7 @@
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\\|defgeneric\\)\\|\
+transient-define-\\(?:prefix\\|suffix\\|infix\\|argument\\)\\|\
menu-bar-make-toggle\\|menu-bar-make-toggle-command\\)"
find-function-space-re
"\\('\\|(quote \\)?%s\\(\\s-\\|$\\|[()]\\)")
@@ -247,13 +246,19 @@ LIBRARY should be a string (the name of the library)."
;; LIBRARY may be "foo.el" or "foo".
(let ((load-re
(concat "\\(" (regexp-quote (file-name-sans-extension library)) "\\)"
- (regexp-opt (get-load-suffixes)) "\\'")))
- (cl-loop
- for (file . _) in load-history thereis
- (and (stringp file) (string-match load-re file)
- (let ((dir (substring file 0 (match-beginning 1)))
- (basename (match-string 1 file)))
- (locate-file basename (list dir) (find-library-suffixes)))))))
+ (regexp-opt (get-load-suffixes)) "\\'"))
+ (alist load-history)
+ elt file found)
+ (while (and alist (null found))
+ (setq elt (car alist)
+ alist (cdr alist)
+ file (car elt)
+ found (and (stringp file) (string-match load-re file)
+ (let ((dir (substring file 0 (match-beginning 1)))
+ (basename (match-string 1 file)))
+ (locate-file basename (list dir)
+ (find-library-suffixes))))))
+ found))
(defvar find-function-C-source-directory
(let ((dir (expand-file-name "src" source-directory)))
@@ -469,7 +474,8 @@ Return t if any PRED returns t."
((not (consp form)) nil)
((funcall pred form) t)
(t
- (cl-destructuring-bind (left-child . right-child) form
+ (let ((left-child (car form))
+ (right-child (cdr form)))
(or
(find-function--any-subform-p left-child pred)
(find-function--any-subform-p right-child pred))))))
@@ -591,7 +597,7 @@ otherwise uses `variable-at-point'."
(list (intern (completing-read
(format-prompt "Find %s" symb prompt-type)
obarray predicate
- t nil nil (and symb (symbol-name symb)))))))
+ 'lambda nil nil (and symb (symbol-name symb)))))))
(defun find-function-do-it (symbol type switch-fn)
"Find Emacs Lisp SYMBOL in a buffer and display it.