From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: imenu question (or an alternative) Date: Tue, 13 May 2014 14:58:14 -0700 (PDT) Message-ID: <474810ca-8841-4982-a43f-a808c66c06e1@default> References: <155DEC68569B714B86C2C7075F5EDA9892AB4F22@DAKIYA1.pegasus.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1400018334 9892 80.91.229.3 (13 May 2014 21:58:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 May 2014 21:58:54 +0000 (UTC) To: Doug Lewan , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 13 23:58:47 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WkKik-0006Ah-6z for geh-help-gnu-emacs@m.gmane.org; Tue, 13 May 2014 23:58:46 +0200 Original-Received: from localhost ([::1]:48123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkKij-0007ZX-L8 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 May 2014 17:58:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkKiR-0007WT-CI for help-gnu-emacs@gnu.org; Tue, 13 May 2014 17:58:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkKiI-0001pX-MD for help-gnu-emacs@gnu.org; Tue, 13 May 2014 17:58:27 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:26694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkKiI-0001oa-Fc for help-gnu-emacs@gnu.org; Tue, 13 May 2014 17:58:18 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4DLwFPs028378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 May 2014 21:58:17 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4DLwEX9029372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 May 2014 21:58:15 GMT Original-Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4DLwEsj027798; Tue, 13 May 2014 21:58:14 GMT In-Reply-To: <155DEC68569B714B86C2C7075F5EDA9892AB4F22@DAKIYA1.pegasus.local> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97634 Archived-At: > The mode starts by putting the point on the "preferred" entry. This is > nice, but then the imenu index starts only at that entry which makes the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > whole which-function/imenu combination less useful than it might be. >=20 > Here's the mode's current definition with the go-to-issue code at the ver= y > end. FYI without those two lines, the Issues menu gets populated correctl= y. >=20 > (define-derived-mode issues-mode text-mode "issues" > "Major mode for files that might contain issues." > :keymap 'issues-mode-map > (make-local-variable 'beginning-of-defun-function) > (make-local-variable 'end-of-defun-function) > (setq beginning-of-defun-function 'iss-beginning-of-issue) > (setq end-of-defun-function 'iss-end-of-issue) > (setq imenu-create-index-function 'iss-mode-create-index) > (setq imenu-sort-function 'imenu--sort-by-position) > (unless which-function-mode > (require 'which-func) > (which-function-mode)) > (imenu-add-to-menubar "Issues") >=20 > (let ((issue (iss-get-issue-for-directory))) > (imenu issue))) >=20 > Is there a magic incantation that I don't know to make this do the right > thing? (Is there an appropriate alternative to which-function/imenu? FWIW, I don't quite follow you. `(imenu ISSUE)' should just go to the position specified by ISSUE. In particular, it should not change what is in the `Issues' menu. What do you mean by "then the imenu index starts only at that entry"? And by menu `Issues' not getting populated correctly? Calling `imenu' should not have any bearing on what gets populated to menu `Issues', which is done by `imenu-add-to-menubar'. Without really understanding your problem, I'd suggest using `M-x debug-on-entry imenu-add-to-menubar', to see why `Issues' is not being populated with what you think it should be. Or if you think that it is the call to `imenu' that somehow screws up the menu, then trace that through the debugger, to see just what it is doing.