From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Allow xref to use other than current major-mode Date: Tue, 25 Aug 2015 05:00:50 -0500 Message-ID: <86fv37it65.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440496915 14304 80.91.229.3 (25 Aug 2015 10:01:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2015 10:01:55 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 25 12:01:44 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZUB2u-0001Ly-T4 for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2015 12:01:37 +0200 Original-Received: from localhost ([::1]:59062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUB2t-0006te-Ol for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2015 06:01:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUB2g-0006tY-Q8 for emacs-devel@gnu.org; Tue, 25 Aug 2015 06:01:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUB2d-0005bV-Js for emacs-devel@gnu.org; Tue, 25 Aug 2015 06:01:22 -0400 Original-Received: from gproxy1-pub.mail.unifiedlayer.com ([69.89.25.95]:45920) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1ZUB2d-0005WS-Dn for emacs-devel@gnu.org; Tue, 25 Aug 2015 06:01:19 -0400 Original-Received: (qmail 5743 invoked by uid 0); 25 Aug 2015 10:01:12 -0000 Original-Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy1.mail.unifiedlayer.com with SMTP; 25 Aug 2015 10:01:12 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw4 with id 8y121r00x2UdiVW01y15bV; Tue, 25 Aug 2015 04:01:12 -0600 X-Authority-Analysis: v=2.1 cv=QdD14Krv c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=9i_RQKNPAAAA:8 a=y7kgw_RnJtkA:10 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=uRRa74qj2VoA:10 a=Lv8HyETGyEeurq-AlBwA:9 Original-Received: from [76.218.37.33] (port=60300 helo=TAKVER2) by host114.hostmonster.com with esmtpa (Exim 4.84) (envelope-from ) id 1ZUB2M-0001Y8-Gi for emacs-devel@gnu.org; Tue, 25 Aug 2015 04:01:02 -0600 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.25.95 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189148 Archived-At: I have the following use case: I'm in a C buffer, asking "what elisp function will semantic-parse-region dispatch to in this buffer?". semantic-parse-region is a mode-local overloadable function; it dispatches based on the current major mode. elisp--xref-find-definitions doesn't currently show mode-local overrides; I'm working on adding that capability. I'd like to use xref-find-definitions to answer this question, so I invoke it with C-u M-. That prompts me for an identifier. However, it uses the c-mode value of xref-identifier-completion-table-function, so I can't complete to semantic-parse-region. In addition, xref--show-xrefs uses the c-mode value of xref-find-function, so it won't find the elisp function. To handle this, I propose changing both xref-identifier-completion-table-function and xref-find-function to be mode-local, instead of buffer-local. Then, when current-prefix-arg is non-nil, xref--read-identifier can prompt for the mode to use when completing the identifier, and xref--show-xrefs can use that mode when calling xref-find-function. There are similar use cases; from a LaTeX document buffer, looking at the description of an Ada function, find the Ada code that defines that function. Or from a text mode notes file, look for a definition in any one of several languages. -- -- Stephe