Subject: bug#19468: 25.0.50; UI inconveniences with M-.

From: Stefan Monnier <[email-masked]>
Date: Mon, 27 Apr 2015 13:21:07 -0400

> I certainly hope that at least the Semantic one materializes soon
> enough, otherwise it sounds like all this move to xref was for the
> benefit of unbundled packages,

IMO one of the main tasks of the maintainers is to provide
infrastructure that consolidates the features that are duplicated out
there in many different packages, all mutually slightly incompatible.

So the usefulness does not directly depend on whether that feature is
used by bundled or unbundled packages.  Emacs thrives in large part
thanks to all the unbundled packages out there and we shouldn't treat
them as second-rate citizens.

[ Of course, I much prefer when a package's copyright is assigned and when
it's either in GNU ELPA or in Emacs proper, especially because it makes
it easier to incorporate its features into the core so as to expand the
general infrastructure and let other packages build on it.  ]

> and users of Emacs are just punished by having to learn a new UI for
> no real advantage.

I like the new UI, FWIW.  But clearly, we need to work to make it better
for those users who miss some aspects of the old UI.

BTW, w.r.t the use of etags, what do you think of the patch below, which
lets the elisp-xref functionality fallback on etags for functions/vars
that aren't currently bound?
[ Clearly, the patch doesn't work as is, since it only works once xref
  is loaded, but I hope you see what this is intended to do.  ]

> That said, the usual way in Emacs to provide minor variants of a
> command is via special values of the prefix argument, like, for
> example, "C-x C-s" does.

The different ways to call xref-find-function are to distinguish
jumping to the definition or to "all uses", and currently few backends
support those features, I don't think we have a clear idea yet of how
they should be presented to the user, and there are too many variants to
collapse them all into C-u.  So they'd probably be provided via
different commands instead of all being accessed via M-.

        Stefan

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index f289068..04bf49d 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -235,9 +235,9 @@ Blank lines separate paragraphs.  Semicolons start comments.
   (setq imenu-case-fold-search nil)
   (add-function :before-until (local 'eldoc-documentation-function)
                 #'elisp-eldoc-documentation-function)
-  (setq-local xref-find-function #'elisp-xref-find)
-  (setq-local xref-identifier-completion-table-function
-              #'elisp--xref-identifier-completion-table)
+  (add-function :before-until (local 'xref-find-function) #'elisp-xref-find)
+  (add-function :before-until (local 'xref-identifier-completion-table-function)
+                #'elisp--xref-identifier-completion-table)
   (add-hook 'completion-at-point-functions
             #'elisp-completion-at-point nil 'local))