branch: externals/leaf commit fc8924dffb02001fdbb23639e937b7829ebcec67 Author: Naoya Yamashita <con...@gmail.com> Commit: Naoya Yamashita <con...@gmail.com>
add just eval-buffer, byte-compile situation --- leaf-tests.el | 5 +++-- leaf.el | 18 +++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/leaf-tests.el b/leaf-tests.el index 710fb47..a0fbcf5 100644 --- a/leaf-tests.el +++ b/leaf-tests.el @@ -2203,8 +2203,9 @@ Example: (leaf-init))) ((leaf-handler-leaf-path leaf) - (when load-in-progress - (add-to-list 'leaf--paths (cons 'leaf load-file-name)))))) + (let ((file (or load-file-name buffer-file-name byte-compile-current-file))) + (when file + (add-to-list 'leaf--paths (cons 'leaf file))))))) (cort-deftest-with-macroexpand leaf/leaf-defun '(((leaf annotate diff --git a/leaf.el b/leaf.el index 4f2b57e..76fe756 100644 --- a/leaf.el +++ b/leaf.el @@ -746,11 +746,12 @@ see `alist-get'." (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)))) - (location (apply #'find-function-search-for-symbol name 'leaf path))) - (prog1 (pop-to-buffer (car location)) - (when (cdr location) - (goto-char (cdr location))) - (run-hooks 'find-function-after-hook)))) + (location (find-function-search-for-symbol name 'leaf path))) + (when location + (prog1 (pop-to-buffer (car location)) + (when (cdr location) + (goto-char (cdr location))) + (run-hooks 'find-function-after-hook))))) ;;;; Key management @@ -944,8 +945,11 @@ FN also accept list of FN." (defmacro leaf-handler-leaf-path (name) "Meta handler for :leaf-path for NAME." - `(when load-in-progress - (add-to-list 'leaf--paths (cons ',name load-file-name)))) + `(let ((file (or load-file-name + buffer-file-name + byte-compile-current-file))) + (when file + (add-to-list 'leaf--paths (cons ',name file))))) (defmacro leaf-handler-package (name pkg _pin) "Handler ensure PKG via PIN in NAME leaf block."