From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] emacs-26 b1aaa72: Improve documentation of Xref
Date: Tue, 13 Mar 2018 01:45:48 +0200 [thread overview]
Message-ID: <dc974533-d09b-267e-254d-6e648782ca4c@yandex.ru> (raw)
In-Reply-To: <jwv1sgo9as9.fsf-monnier+gmane.emacs.devel@gnu.org>
On 3/13/18 12:43 AM, Stefan Monnier wrote:
> Maybe xref could have an ad-hoc hack which does:
> - if there's no match
> - and there's a tags table installed.
> - and there's a match in the tags table.
> - then kindly suggest to the user to activate xref-etags-mode
Is that going to be a temporary measure? If so, when do we phase it out?
Anyway, here's a patch that somebody could test out:
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 5a9a7a925a..bdb1503c2e 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -828,10 +828,19 @@ xref--read-identifier
\f
;;; Commands
+(defvar xref--warned-about-xref-etags-mode nil)
+
(defun xref--find-xrefs (input kind arg display-action)
- (let ((xrefs (funcall (intern (format "xref-backend-%s" kind))
- (xref-find-backend)
- arg)))
+ (let* ((fun (intern (format "xref-backend-%s" kind)))
+ (xrefs (funcall fun (xref-find-backend) arg)))
+ (unless (or xrefs
+ xref--warned-about-xref-etags-mode)
+ (when (and tags-file-name
+ (funcall fun 'etags arg))
+ (setq xref--warned-about-xref-etags-mode t)
+ (user-error (concat "No %s found for: %s; did you mean to use
etags?"
+ " If so, turn on xref-etags-mode")
+ (symbol-name kind) input)))
(unless xrefs
(user-error "No %s found for: %s" (symbol-name kind) input))
(xref--show-xrefs xrefs display-action)))
next prev parent reply other threads:[~2018-03-12 23:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180311173926.29923.58430@vcs0.savannah.gnu.org>
[not found] ` <20180311173928.14DD220B54@vcs0.savannah.gnu.org>
2018-03-11 23:15 ` [Emacs-diffs] emacs-26 b1aaa72: Improve documentation of Xref Dmitry Gutov
2018-03-12 16:04 ` Eli Zaretskii
2018-03-12 20:34 ` Dmitry Gutov
2018-03-12 22:43 ` Stefan Monnier
2018-03-12 23:45 ` Dmitry Gutov [this message]
2018-03-13 2:18 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc974533-d09b-267e-254d-6e648782ca4c@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).