From 5c211004d66d7fb267eafcaecdb472cee1141609 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 28 Dec 2021 21:18:32 +0800 Subject: 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. --- elisp.el | 18 +++++++++++++++--- 1 file 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 -- cgit v1.2.3-18-g5258