Advise symbol-file to return doom-file property

...if it exists. Otherwise fall back on original functionality. This
allows certain symbols to overwrite where Emacs thinks they were
defined.

Warning: only use this for autodefs! It may have unintended side-effects
for other symbols.
This commit is contained in:
Henrik Lissner 2018-06-15 14:58:31 +02:00
parent da5e2d54ca
commit 1184967531
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -213,6 +213,13 @@ with functions that require it (like modeline segments)."
buffer))
(advice-add #'make-indirect-buffer :around #'doom*set-indirect-buffer-filename)
(defun doom*symbol-file (orig-fn symbol &optional type)
"If a `doom-file' symbol property exists on SYMBOL, use that instead of the
original value of `symbol-file'."
(or (get symbol 'doom-file)
(funcall orig-fn symbol type)))
(advice-add #'symbol-file :around #'doom*symbol-file)
;; Truly silence startup message
(fset #'display-startup-echo-area-message #'ignore)