summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-12-28 21:18:32 +0800
committerJSDurand <mmemmew@gmail.com>2021-12-28 21:18:32 +0800
commit5c211004d66d7fb267eafcaecdb472cee1141609 (patch)
tree4d4bc0fb1a139b5cd933e9a65f647b457e4937cd
parent4db37dc85a6e4acf7a1b76337fe095d1f7c59d36 (diff)
elisp: Help flymake use the correct load-path
* elisp.el (elisp-macro-expand): Refine the doc string. (elisp-update-load-path, emacs-lisp-mode-hook): Help flymake use the correct load-path.
-rw-r--r--elisp.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/elisp.el b/elisp.el
index bb68713..415ce59 100644
--- a/elisp.el
+++ b/elisp.el
@@ -11,6 +11,7 @@
;; The original value is eldoc-minor-mode-string
+(autoload 'durand-hide-minor-mode "common")
(durand-hide-minor-mode eldoc-mode)
;;; fontification of extra keywords in emacs lisp files
@@ -124,6 +125,9 @@
;;; remember cursor position
+;; to satisfy flymake
+(defvar load-file-directory)
+
(require 'saveplace)
(set 'save-place-file (expand-file-name "saveplace" load-file-directory))
(set 'save-place-forget-unreadable-files t)
@@ -318,9 +322,9 @@ macros.")
;;;###autoload
(defun elisp-macro-expand (start end subst)
- "Expand ELisp macros in the region.
-Normally display output in temp buffer, but
-prefix arg means replace the region with it.
+ "Expand ELisp macros in the region delimited by START and END.
+Normally display output in temp buffer, but when SUBST is
+non-nil, it means to replace the region with the output.
Note that this only expands one Emacs Lisp form. So multiple
forms have to be expanded separately.
@@ -342,6 +346,14 @@ Adapted from `c-macro-expand'."
(define-key emacs-lisp-mode-map (vector 3 5) #'elisp-macro-expand)
+;;; Make sure to use the latest load-path for flymake
+
+(defun elisp-update-load-path ()
+ "Update `elisp-flymake-byte-compile-load-path'."
+ (setq elisp-flymake-byte-compile-load-path (cons "./" load-path)))
+
+(add-hook 'emacs-lisp-mode-hook #'elisp-update-load-path)
+
(provide 'elisp)
;;; elisp.el ends here