mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
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:
@ -188,10 +188,11 @@ at the values with which this function was called."
|
|||||||
(defun file! ()
|
(defun file! ()
|
||||||
"Return the emacs lisp file this macro is called from."
|
"Return the emacs lisp file this macro is called from."
|
||||||
(cond ((bound-and-true-p byte-compile-current-file))
|
(cond ((bound-and-true-p byte-compile-current-file))
|
||||||
(load-in-progress load-file-name)
|
(load-file-name)
|
||||||
((stringp (car-safe current-load-list))
|
((stringp (car-safe current-load-list))
|
||||||
(car current-load-list))
|
(car current-load-list))
|
||||||
(buffer-file-name)))
|
(buffer-file-name)
|
||||||
|
((error "Cannot get this file-path"))))
|
||||||
|
|
||||||
(defun dir! ()
|
(defun dir! ()
|
||||||
"Returns the directory of the emacs lisp file this macro is called from."
|
"Returns the directory of the emacs lisp file this macro is called from."
|
||||||
|
Reference in New Issue
Block a user