unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Allow xref to use other than current major-mode
@ 2015-08-25 10:00 Stephen Leake
  2015-08-25 11:48 ` Dmitry Gutov
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Leake @ 2015-08-25 10:00 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-08-25 22:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 10:00 Allow xref to use other than current major-mode Stephen Leake
2015-08-25 11:48 ` Dmitry Gutov
2015-08-25 12:19   ` João Távora
2015-08-25 12:25   ` David Engster
2015-08-25 14:47     ` Stephen Leake
2015-08-25 15:07       ` David Engster
2015-08-25 15:23   ` Eli Zaretskii
2015-08-25 17:25     ` Dmitry Gutov
2015-08-25 21:17       ` Stephen Leake
2015-08-25 15:31   ` Stephen Leake
2015-08-25 15:41     ` Stephen Leake
2015-08-25 17:05     ` Dmitry Gutov
2015-08-25 21:13       ` Stephen Leake
2015-08-25 22:11         ` Dmitry Gutov
2015-08-25 22:15     ` Stefan Monnier
2015-08-25 22:29       ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).