From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Branham Newsgroups: gmane.emacs.bugs Subject: bug#33695: [PATCH] Fix which-function reporting outdated information Date: Thu, 10 Jan 2019 13:55:48 -0600 Message-ID: <87sgy070e3.fsf@gmail.com> References: <87pntxed50.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1547150044 24617 195.159.176.226 (10 Jan 2019 19:54:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 10 Jan 2019 19:54:04 +0000 (UTC) User-Agent: mu4e 1.1.0; emacs 27.0.50 To: 33695@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 10 20:54:00 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghgOt-0006FI-UO for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jan 2019 20:54:00 +0100 Original-Received: from localhost ([127.0.0.1]:41680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghgR0-00062x-Ux for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jan 2019 14:56:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghgQt-00062s-HD for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 14:56:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghgQs-0005Bv-5T for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 14:56:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54982) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghgQr-0005B0-V7 for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 14:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ghgQr-0007Wg-Sk for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 14:56:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87tvjlmcoe.fsf@gmail.com> Resent-From: Alex Branham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Jan 2019 19:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33695 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33695-submit@debbugs.gnu.org id=B33695.154715016028923 (code B ref 33695); Thu, 10 Jan 2019 19:56:01 +0000 Original-Received: (at 33695) by debbugs.gnu.org; 10 Jan 2019 19:56:00 +0000 Original-Received: from localhost ([127.0.0.1]:54263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghgQq-0007WQ-9e for submit@debbugs.gnu.org; Thu, 10 Jan 2019 14:56:00 -0500 Original-Received: from mail-oi1-f195.google.com ([209.85.167.195]:35851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghgQn-0007WB-9U for 33695@debbugs.gnu.org; Thu, 10 Jan 2019 14:55:59 -0500 Original-Received: by mail-oi1-f195.google.com with SMTP id x23so10305929oix.3 for <33695@debbugs.gnu.org>; Thu, 10 Jan 2019 11:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:message-id:mime-version; bh=xXVgnOtGMvRQjw4j6KKuoJQ46hEb6s1QMw4h6jitGj8=; b=RaYeospJWczEpqqEQHJj+k+E+3YUEEjrlDushzKwrgdC1k5HugYzj4HUiaDLpWi4Dr jBeIWL9NoIgC52x5ENxSDmH8GLLnIXqFBxcIMnzaNJaC/YvBQA/27iTti+Y/mJyVkAGH VfsAJAvMFY3r9xL6+gKUJc3ez9FPxB2FP3qJELGUmo++kizRmsn8HqOv/1Yt+x3klOLn qdoAMbuTuQdL5R2mzQDsMucihfXZHYWJrnIUml0yn7GvGlSvuRVTsB88QRFUzu6TdnpU 8eBwmlQQSGF34KPffE2s394eTS9XOgeZU7aUtr2UBZkHcNOj0JOdpGZniywgEAVKHDcu dDRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :message-id:mime-version; bh=xXVgnOtGMvRQjw4j6KKuoJQ46hEb6s1QMw4h6jitGj8=; b=OHkgIvlcrRYxIv/5MllYuUjShY85fBn667Pjzz6QolHtYEQeoTI3Jmzd4UUTbr7rda FCbU51gdQKxBpsAwe6/nRGYKvlFchcvz4tAi+V570WmvWNO0rFKXjbSdJl2hxkfc+Xfo /+aTuhfl7bAoXQpiqRZ1vw+TcoSoPACIE2E65kBqd/8EFx0sY0TD98M8mrA5vBFSMX6C fdXVUFD/ays/Snn0PxMHZSOweff8ptnKbYPBpjZbTLlw/hxcLKTOFlNCHB5lowX8Am87 7N++0eW0rMEGaYAtt1G8oPPR93kTc5k68pTaFbxdnu5mEdSAR7lMjpc4cYumSGjZ0sd1 VHUw== X-Gm-Message-State: AJcUukeeg0gZcMJVz0A18ZiLrwNL+HI/MqjPodMYoPLjdCFyFtapJ4n2 0A2pFlvQRUOVI/Yk1NEGiGUg6kGy X-Google-Smtp-Source: ALg8bN5FHVB4sUjlj5cChGckay3hdFPoeuZhLpkT8Ai0JVHetUNhVT/7rbuOoip5mW4WrSAdko/xjQ== X-Received: by 2002:aca:2803:: with SMTP id 3mr6748752oix.85.1547150151032; Thu, 10 Jan 2019 11:55:51 -0800 (PST) Original-Received: from earth (cpe-70-114-192-208.austin.res.rr.com. [70.114.192.208]) by smtp.gmail.com with ESMTPSA id c78sm55199317oig.30.2019.01.10.11.55.49 for <33695@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 11:55:49 -0800 (PST) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154319 Archived-At: --=-=-= Content-Type: text/plain 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 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 > 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 > 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-which-function-Do-not-display-outdated-imenu-informa.patch >From a06b1318f23b3f67ed0e1041f50ccea67d46ea48 Mon Sep 17 00:00:00 2001 From: Alex Branham 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 --=-=-=--