From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#10123: 24.0.91; [PATCH] make Imenu ignore invisible definitions Date: Wed, 23 Nov 2011 16:36:42 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_004E_01CCA9FE.157135F0" X-Trace: dough.gmane.org 1322095062 22664 80.91.229.12 (24 Nov 2011 00:37:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Nov 2011 00:37:42 +0000 (UTC) To: 10123@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 24 01:37:39 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RTNJq-0001s0-MF for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Nov 2011 01:37:38 +0100 Original-Received: from localhost ([::1]:41122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJp-0004Pi-Vo for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Nov 2011 19:37:37 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJm-0004Pd-Om for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:37:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTNJl-0007vW-VZ for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:37:34 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJl-0007vF-Sh for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:37:33 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RTNLB-000407-L8 for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Nov 2011 00:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10123 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.132209510215311 (code B ref -1); Thu, 24 Nov 2011 00:39:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Nov 2011 00:38:22 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RTNKY-0003yt-LH for submit@debbugs.gnu.org; Wed, 23 Nov 2011 19:38:22 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RTNKX-0003yn-KD for submit@debbugs.gnu.org; Wed, 23 Nov 2011 19:38:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTNJ6-0007u3-3y for submit@debbugs.gnu.org; Wed, 23 Nov 2011 19:36:53 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:51876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJ6-0007tx-0H for submit@debbugs.gnu.org; Wed, 23 Nov 2011 19:36:52 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJ4-0004LE-UG for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:36:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTNJ3-0007tW-N2 for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:36:50 -0500 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:61370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTNJ3-0007tR-El for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2011 19:36:49 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pAO0alxX018723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Nov 2011 00:36:48 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pAO0akW9007932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 24 Nov 2011 00:36:47 GMT Original-Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pAO0aenK032236 for ; Wed, 23 Nov 2011 18:36:41 -0600 Original-Received: from dradamslap1 (/10.159.44.3) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Nov 2011 16:36:40 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcyqQSMHZB/LkfdqQpu2HGZo1Kt5dQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090208.4ECD91A0.003E,ss=1,re=0.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 23 Nov 2011 19:39:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:54243 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_004E_01CCA9FE.157135F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The attached patch makes Imenu ignore definitions that are in invisible text. This is especially useful when combined with code that hides comments, in which case definitions that are commented out are not included in the Imenu. (Obviously, that behavior should be optional, as it is sometimes helpful to use Imenu to get to commented-out definitions too.) Someone else might have a more elegant or more performant way to do this, but this way seems to work OK. In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600) of 2011-11-21 on MARVIN Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.6) --no-opt --cflags -ID:/devel/emacs/libs/libXpm-3.5.8/include -ID:/devel/emacs/libs/libXpm-3.5.8/src -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include -ID:/devel/emacs/libs/giflib-4.1.4-1/include -ID:/devel/emacs/libs/jpeg-6b-4/include -ID:/devel/emacs/libs/tiff-3.8.2-1/include -ID:/devel/emacs/libs/gnutls-2.10.1/include --ldflags -LD:/devel/emacs/libs/gnutls-2.10.1/lib' ------=_NextPart_000_004E_01CCA9FE.157135F0 Content-Type: application/octet-stream; name="imenu-2011-11-23.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="imenu-2011-11-23.patch" diff -c -w "imenu.el" "imenupatched.el"=0A= *** imenu.el Wed Nov 23 13:43:14 2011=0A= --- imenu-patched.el Wed Nov 23 13:47:16 2011=0A= ***************=0A= *** 800,806 ****=0A= (goto-char (point-max))=0A= (while (and (if (functionp regexp)=0A= (funcall regexp)=0A= ! (re-search-backward regexp nil t))=0A= ;; Exit the loop if we get an empty match,=0A= ;; because it means a bad regexp was specified.=0A= (not (=3D (match-beginning 0) (match-end 0))))=0A= --- 800,813 ----=0A= (goto-char (point-max))=0A= (while (and (if (functionp regexp)=0A= (funcall regexp)=0A= ! (and (re-search-backward regexp nil t)=0A= ! ;; Do not count invisible = definitions.=0A= ! (let ((invis (get-text-property = (point) 'invisible)))=0A= ! (or (not invis)=0A= ! (progn=0A= ! (while (and invis (not = (bobp)))=0A= ! (setq invis (not = (re-search-backward regexp nil t))))=0A= ! (not invis))))))=0A= ;; Exit the loop if we get an empty match,=0A= ;; because it means a bad regexp was = specified.=0A= (not (=3D (match-beginning 0) (match-end = 0))))=0A= =0A= Diff finished at Wed Nov 23 13:48:05=0A= ------=_NextPart_000_004E_01CCA9FE.157135F0--