feat(emacs/lean-tags): attach advice to tag functions to run ltags
This commit is contained in:
parent
1f0bfb67b0
commit
dfab827d22
1 changed files with 22 additions and 0 deletions
|
@ -12,6 +12,28 @@
|
|||
(let ((ltags-file-name (lean-get-executable "lmake")))
|
||||
(call-process ltags-file-name nil nil nil "TAGS" "--jobs" "--keep-going" "--permissive")))
|
||||
|
||||
(defmacro lean-tags-make-advice-to-call-ltags (f)
|
||||
(let* ((f-name (symbol-name f))
|
||||
(advice-name (concat "lean-tags-advice-"
|
||||
(symbol-name f))))
|
||||
`(defadvice ,f
|
||||
(before ,(intern advice-name) first activate)
|
||||
,(concat "Before call " f-name ", run 'lmake TAGS'")
|
||||
(when (derived-mode-p 'lean-mode)
|
||||
(message ,(concat advice-name " is running"))
|
||||
(lean-generate-tags)))))
|
||||
|
||||
(defvar-local functions-to-call-ltags-before-it
|
||||
'(find-tag-noselect
|
||||
tags-search
|
||||
tags-query-replace
|
||||
list-tags
|
||||
tags-apropos
|
||||
select-tags-table))
|
||||
|
||||
(-each functions-to-call-ltags-before-it
|
||||
(lambda (f) (eval `(lean-tags-make-advice-to-call-ltags ,f))))
|
||||
|
||||
(defun lean-find-tag ()
|
||||
"lean-find-tag"
|
||||
(interactive)
|
||||
|
|
Loading…
Reference in a new issue