From 1184967531df8e65f8fae72f68df2dd6a996b506 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 15 Jun 2018 14:58:31 +0200 Subject: [PATCH] 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. --- core/core.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/core.el b/core/core.el index 894efadaf..b67f37553 100644 --- a/core/core.el +++ b/core/core.el @@ -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)