From: Alex Branham <alex.branham@gmail.com>
To: 33695@debbugs.gnu.org
Subject: bug#33695: [PATCH] Fix which-function reporting outdated information
Date: Tue, 19 Feb 2019 15:29:51 -0600 [thread overview]
Message-ID: <87y36b1n74.fsf@gmail.com> (raw)
In-Reply-To: <87sgy070e3.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7533 bytes --]
Hi all -
Assuming no objections, I'll apply the patch below to master later this week.
Alex
On Thu 10 Jan 2019 at 13:55, Alex Branham <alex.branham@gmail.com> wrote:
> Hi -
>
> I guess this fell through the cracks with the holidays. Would someone
> mind following up with either comments or applying this patch?
>
> Thanks,
> Alex
>
> On Wed 19 Dec 2018 at 09:42, Alex Branham <alex.branham@gmail.com> wrote:
>
>> Hello -
>>
>> The following patch fixes `which-function' returning outdated imenu
>> information by:
>>
>> 1. Preferring `add-log-current-defun' over `imenu--index-alist' and
>>
>> 2. Updating `imenu--index-alist' more aggressively if we fall back to
>> it.
>>
>> Thanks,
>> Alex
>>
>> From a06b1318f23b3f67ed0e1041f50ccea67d46ea48 Mon Sep 17 00:00:00 2001
>> From: Alex Branham <alex.branham@gmail.com>
>> Date: Tue, 11 Dec 2018 08:29:50 -0600
>> Subject: [PATCH] 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
>> ---
>> lisp/progmodes/which-func.el | 17 +++++++++--------
>> 1 file changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
>> index 7604be0c25..7cc75e0edb 100644
>> --- a/lisp/progmodes/which-func.el
>> +++ b/lisp/progmodes/which-func.el
>> @@ -272,16 +272,21 @@ which-func-functions
>>
>> (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 @@ which-function
>> (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
>> --
>> 2.19.2
>>
>>
>>
>> From a06b1318f23b3f67ed0e1041f50ccea67d46ea48 Mon Sep 17 00:00:00 2001
>> From: Alex Branham <alex.branham@gmail.com>
>> Date: Tue, 11 Dec 2018 08:29:50 -0600
>> Subject: [PATCH] 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
>> ---
>> lisp/progmodes/which-func.el | 17 +++++++++--------
>> 1 file changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
>> index 7604be0c25..7cc75e0edb 100644
>> --- a/lisp/progmodes/which-func.el
>> +++ b/lisp/progmodes/which-func.el
>> @@ -272,16 +272,21 @@ which-func-functions
>>
>> (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 @@ which-function
>> (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
>
> From a06b1318f23b3f67ed0e1041f50ccea67d46ea48 Mon Sep 17 00:00:00 2001
> From: Alex Branham <alex.branham@gmail.com>
> Date: Tue, 11 Dec 2018 08:29:50 -0600
> Subject: [PATCH] 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
> ---
> lisp/progmodes/which-func.el | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
> index 7604be0c25..7cc75e0edb 100644
> --- a/lisp/progmodes/which-func.el
> +++ b/lisp/progmodes/which-func.el
> @@ -272,16 +272,21 @@ which-func-functions
>
> (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 @@ which-function
> (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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
next prev parent reply other threads:[~2019-02-19 21:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 18:58 bug#33695: 27.0.50; which-function reports wrong imenu information Alex Branham
2018-12-11 8:35 ` martin rudalics
2018-12-11 14:32 ` Alex Branham
2018-12-12 8:31 ` martin rudalics
2018-12-12 22:53 ` Alex Branham
2018-12-13 9:01 ` martin rudalics
2018-12-19 15:42 ` bug#33695: [PATCH] Fix which-function reporting outdated information Alex Branham
2019-01-10 19:55 ` Alex Branham
2019-02-19 21:29 ` Alex Branham [this message]
2019-02-22 21:28 ` Alex Branham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y36b1n74.fsf@gmail.com \
--to=alex.branham@gmail.com \
--cc=33695@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.