diff options
author | Alex Branham <alex.branham@gmail.com> | 2018-12-11 08:29:50 -0600 |
---|---|---|
committer | Alex Branham <alex.branham@gmail.com> | 2019-02-22 15:27:06 -0600 |
commit | 0613e7a38efc3b0534e0ca5c5fa401e2a3bda906 (patch) | |
tree | 73f4d2842ce8853df9b2e935311c3fe300f5a737 /lisp/progmodes/which-func.el | |
parent | af047384594c73ed87947d5ecbbfc1032435b769 (diff) | |
download | emacs-0613e7a38efc3b0534e0ca5c5fa401e2a3bda906.tar.gz |
which-function: Do not display outdated imenu information
* lisp/progmodes/which-func.el (which-function): Check
`add-log-current-defun' before imenu. Update `imenu--index-alist' if
needed. Bug#33695
Diffstat (limited to 'lisp/progmodes/which-func.el')
-rw-r--r-- | lisp/progmodes/which-func.el | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 40a74d1df62..564e0ff62c4 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -272,16 +272,21 @@ It calls them sequentially, and if any returns non-nil, (defun which-function () "Return current function name based on point. -Uses `which-func-functions', `imenu--index-alist' -or `add-log-current-defun'. +Uses `which-func-functions', `add-log-current-defun'. +or `imenu--index-alist' If no function name is found, return nil." (let ((name ;; Try the `which-func-functions' functions first. (run-hook-with-args-until-success 'which-func-functions))) - + ;; Try using add-log support. + (when (null name) + (setq name (add-log-current-defun))) ;; If Imenu is loaded, try to make an index alist with it. (when (and (null name) - (boundp 'imenu--index-alist) (null imenu--index-alist) + (boundp 'imenu--index-alist) + (or (null imenu--index-alist) + ;; Update if outdated + (/= (buffer-chars-modified-tick) imenu-menubar-modified-tick)) (null which-function-imenu-failed)) (ignore-errors (imenu--make-index-alist t)) (unless imenu--index-alist @@ -323,10 +328,6 @@ If no function name is found, return nil." (funcall which-func-imenu-joiner-function (reverse (cons (car pair) namestack)))))))))))) - - ;; Try using add-log support. - (when (null name) - (setq name (add-log-current-defun))) ;; Filter the name if requested. (when name (if which-func-cleanup-function |