branch: externals/leaf
commit cb35aacdb8789c43c92e71c00407e5f1774ae2b8
Merge: 8d68ff9 d6c12f1
Author: Naoya Yamashita <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #478 from conao3/feature#477
feature#477
---
leaf.el | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/leaf.el b/leaf.el
index c5cedbb..1c3b2eb 100644
--- a/leaf.el
+++ b/leaf.el
@@ -5,7 +5,7 @@
;; Author: Naoya Yamashita <[email protected]>
;; Maintainer: Naoya Yamashita <[email protected]>
;; Keywords: lisp settings
-;; Version: 4.3.6
+;; Version: 4.3.7
;; URL: https://github.com/conao3/leaf.el
;; Package-Requires: ((emacs "24.1"))
@@ -440,6 +440,19 @@ Ref: `lisp-imenu-generic-expression'."
lisp-imenu-generic-expression))))))
:group 'leaf)
+(defcustom leaf-find-function-support t
+ "If non-nil, enable `find-func' integrations.
+Ref: `find-function-regexp-alist'."
+ :type 'boolean
+ :set (lambda (sym value)
+ (set sym value)
+ (eval-after-load 'find-func
+ (if value
+ `(add-to-list 'find-function-regexp-alist '(leaf .
leaf-find-regexp))
+ `(setq find-function-regexp-alist
+ (delete '(leaf . leaf-find-regexp)
find-function-regexp-alist)))))
+ :group 'leaf)
+
;;;; General polyfill
@@ -740,11 +753,6 @@ see `alist-get'."
;;;; find-function
-(eval-after-load 'find-func
- (lambda ()
- (defvar find-function-regexp-alist)
- (add-to-list 'find-function-regexp-alist '(leaf . leaf-find-regexp))))
-
(defun leaf-find (name)
"Find the leaf block of NAME."
(interactive
@@ -755,7 +763,7 @@ see `alist-get'."
(require 'find-func)
(let* ((name (intern name))
(paths (mapcan (lambda (elm) (when (eq name (car elm)) (list (cdr
elm)))) leaf--paths))
- (path (if (= (length paths) 1) paths (list (completing-read "Select
one: " paths))))
+ (path (if (= (length paths) 1) (car paths) (completing-read "Select
one: " paths)))
(location (find-function-search-for-symbol name 'leaf path)))
(when location
(prog1 (pop-to-buffer (car location))