Fix file! not returning filename in some cases
There are scenarios where load-file-name is set, but load-in-progress is not. It is safe to assume the value of load-file-name is always what we want. Also: file! now throws an error if it can't find the directory. Otherwise we have to deal with roundabout errors from other places that expect file! to never fail.
This commit is contained in:
parent
21a27b52d8
commit
3c36a345d8
1 changed files with 3 additions and 2 deletions
|
@ -188,10 +188,11 @@ at the values with which this function was called."
|
|||
(defun file! ()
|
||||
"Return the emacs lisp file this macro is called from."
|
||||
(cond ((bound-and-true-p byte-compile-current-file))
|
||||
(load-in-progress load-file-name)
|
||||
(load-file-name)
|
||||
((stringp (car-safe current-load-list))
|
||||
(car current-load-list))
|
||||
(buffer-file-name)))
|
||||
(buffer-file-name)
|
||||
((error "Cannot get this file-path"))))
|
||||
|
||||
(defun dir! ()
|
||||
"Returns the directory of the emacs lisp file this macro is called from."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue