From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-26 b1aaa72: Improve documentation of Xref Date: Tue, 13 Mar 2018 01:45:48 +0200 Message-ID: References: <20180311173926.29923.58430@vcs0.savannah.gnu.org> <20180311173928.14DD220B54@vcs0.savannah.gnu.org> <83o9jts2jj.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1520898243 14229 195.159.176.226 (12 Mar 2018 23:44:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Mar 2018 23:44:03 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 13 00:43:59 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1evX6k-0003XZ-KR for ged-emacs-devel@m.gmane.org; Tue, 13 Mar 2018 00:43:58 +0100 Original-Received: from localhost ([::1]:36203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evX8n-0005Ge-L6 for ged-emacs-devel@m.gmane.org; Mon, 12 Mar 2018 19:46:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evX8h-0005El-3x for emacs-devel@gnu.org; Mon, 12 Mar 2018 19:46:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evX8c-0001Jy-8B for emacs-devel@gnu.org; Mon, 12 Mar 2018 19:45:59 -0400 Original-Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:45765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evX8c-0001IT-0f for emacs-devel@gnu.org; Mon, 12 Mar 2018 19:45:54 -0400 Original-Received: by mail-wr0-x229.google.com with SMTP id h2so10284692wre.12 for ; Mon, 12 Mar 2018 16:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XbP1r5EW+PiLPq4E5gwrJ+VAkJ/wj9VPnxoFrzgbmWk=; b=oKB+iICec34Kg07KbQ5cyGP9Ivbk2I65aoCy4AdE+KlfHwv6gajM+ihX/gLn6N+Bjz euhs0oIySMFMoiXaofNBrSmLnUK1iCSAUcy95ttm54AvDi9xVRAZEaPRXMDgrJnlCaXW Hdpa6feezwIVflYzV2tcy9tvWFIEWS4RpzmpjGcLp6r/tnEa+K2X64SPCRwH6xcFHBx+ cnI0d8VtYGi87TFFZIXGGNRnGT6mEBD/D9e04BjsvP3bhZ72BNY/JnAqbSlBh8w2LHub wIc+sNs6dKd6iyV5X6PWwOLLXcQlCvEYJ7V21Ls1XvD+QI8Ppp8xlig/CATCk82mgk++ dq2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XbP1r5EW+PiLPq4E5gwrJ+VAkJ/wj9VPnxoFrzgbmWk=; b=KYB4Wkwv3ie1vatnP5sTtUaIRcoOJq7xqNXFx0R1WYdacjLOEdd7/vuftFRS/ss0Q1 rtxmq4DmSm7Ta0NjmE70gKPWBxEiAIopKR2cc3LE4ZTKo4ZwF9FnynrRF8T1anIt45qU uen/npl4kbWyVD2qIoSTqoHu7eD8VgXbzs0y9WC68rYdpS1FY5MvE+kAS6JkR+1JfWyo aDr3qFVbs8x1DJGc6Yoja2pAUO/g5bEyhApRWpDLJKIJKDCjH0r8DOHOT+9angzAldKS cvKJ5DwQbvvA2O3BIguPS4WidAbNF3JxIpG/qlDWgsuBsuvODC66vQsG7+3JGpr7UDfF iigw== X-Gm-Message-State: AElRT7FmHoi3cbImvQJcciyuD1erDTH44qt8gB6J9DnW95CIqdkqCG76 vyn5lIEzS6e6VlcQjP23pIu64U3F X-Google-Smtp-Source: AG47ELuz0qRPZ+GY+LLvrn/mMSZYoyTmy9awRpLsrdYyyh/aiLVxU6cUXMYYCnF6gPOJdAQGADvPiw== X-Received: by 10.80.214.75 with SMTP id c11mr13088001edj.80.1520898352393; Mon, 12 Mar 2018 16:45:52 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.174.23]) by smtp.googlemail.com with ESMTPSA id i7sm951408edk.7.2018.03.12.16.45.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 16:45:50 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:223671 Archived-At: 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 ;;; 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)))