branch: externals/leaf
commit f1746b8ba19c162e1a0b0a952bf4c5d0f5aef30a
Author: Naoya Yamashita <[email protected]>
Commit: Naoya Yamashita <[email protected]>
use leaf-this-file instead of just ref load-file-name
---
leaf.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/leaf.el b/leaf.el
index 65bde04..3c1c5f8 100644
--- a/leaf.el
+++ b/leaf.el
@@ -619,6 +619,12 @@ see `alist-get'."
(when load-file-name
(format " at `%s'" load-file-name))))
+(defun leaf-this-file ()
+ "Return path to this file."
+ (or load-file-name
+ (and (boundp 'byte-compile-current-file) byte-compile-current-file)
+ buffer-file-name))
+
;;;; General functions for leaf
@@ -817,7 +823,7 @@ For example:
(keymap* (eval keymap))
(mmap (or keymap* 'global-map))
(vecp (vectorp key*))
- (path load-file-name)
+ (path (leaf-this-file))
(_mvec (if (vectorp key*) key* (read-kbd-macro key*)))
(mstr (if (stringp key*) key* (key-description key*))))
`(let* ((old (lookup-key ,mmap ,(if vecp key `(kbd ,key))))