From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Newsgroups: gmane.emacs.bugs Subject: bug#32034: 26.1; [PACTH] better xref-location-marker for imperfect file locations Date: Mon, 02 Jul 2018 16:50:27 +0100 Message-ID: <87bmbpskl8.fsf@gmail.com> References: <87y3etsqb7.fsf@gmail.com> <83601xlmno.fsf@gnu.org> <87muv9sll6.fsf@gmail.com> <83po05k5rx.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1530546769 13205 195.159.176.226 (2 Jul 2018 15:52:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2018 15:52:49 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32034@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 02 17:52:45 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fa186-0003Fk-3a for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2018 17:52:42 +0200 Original-Received: from localhost ([::1]:33774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa1AD-0005os-CB for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2018 11:54:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa16Z-00039k-LG for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 11:51:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa16U-0002Se-8G for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 11:51:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35899) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa16U-0002SW-4I for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 11:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fa16T-0006x0-QU for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 11:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Jul 2018 15:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32034 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32034-submit@debbugs.gnu.org id=B32034.153054663726685 (code B ref 32034); Mon, 02 Jul 2018 15:51:01 +0000 Original-Received: (at 32034) by debbugs.gnu.org; 2 Jul 2018 15:50:37 +0000 Original-Received: from localhost ([127.0.0.1]:43796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fa164-0006wL-TY for submit@debbugs.gnu.org; Mon, 02 Jul 2018 11:50:37 -0400 Original-Received: from mail-wr0-f179.google.com ([209.85.128.179]:46182) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fa163-0006w8-L2 for 32034@debbugs.gnu.org; Mon, 02 Jul 2018 11:50:36 -0400 Original-Received: by mail-wr0-f179.google.com with SMTP id s11-v6so6796602wra.13 for <32034@debbugs.gnu.org>; Mon, 02 Jul 2018 08:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=83BzZa3riWYI+g0UbzR/jFLR88di/FA+jZZI3uAdTcw=; b=WSwh2XxAobbqi/uepfruJFyWYEh1w0+rdjMdHaOkvClCGf148xG7gcoYCDuB1H3ZzN IWM9KqZgUORa6g/hHNpYKVVVVk79EEyHxXSlgaHr+xb5pj+iY5VfcR/uD/pILbPmybSG OrhqGT92QfVC5l8xnpGya+vxloGywgrk5iH2ENtxjrOzq25lDPwXm4QyHrWBdDDpWLHY ndaH0mzvljEYeio6NkOKRSXAGXJDSrhVuXUvsCtJP2Nol5W4jwhOlwZzPRsFgiXaNSqE Cx5cJA9deymmXK42O5yTHUPL7aXfcD6Mf8olmknqLTuN1pHnAE3zpR/z4t4QnS56QyIh 1gTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=83BzZa3riWYI+g0UbzR/jFLR88di/FA+jZZI3uAdTcw=; b=sxmc9zOi6vT77JEL0FNC9f14JFYGbfOc9akiWetPG/cFe7FDLdDBIbQDyxQ1qJQLCe vEfx4/iUm3JSwpbpwJEfSWsuY5kNaGhh9NPog0IeAQmYql31zsHvBGfmmk0ilqm3BuGf /LYq7LfDx2qA/LCmhI1K1kgPBWeE3B29RC7Gts28HR3DiPjVx92s9w9CdLPu9f8vAlal u521WX1Y4/sLAOzaU6AGxJZJ2xZTk6vWcHNQP0dVC4BbTorHuNt7tGQVFg1O6aGzXLd1 zSIb4Qnnua5wiIX/NMmTceiJpaT8hGJTZwaWgyTVgpkVuvZOaqFwo9Y7VhG1B5R6D7Zr 9Ubw== X-Gm-Message-State: APt69E2LAOBCm6/PA8tJUXp9Wgs9OqW376UKHX6KNg+2uW8ujh4/uDG9 kr1A4XfbKKJVvE/MyT3uS/M= X-Google-Smtp-Source: AAOMgpdmPXc2+ClUnLTdVYXiqWzrCILiO/uOS8rg1JMjYojYUxILLmNufM0xlK2Q4GNrozQDTDngwg== X-Received: by 2002:adf:f210:: with SMTP id p16-v6mr7768020wro.184.1530546629943; Mon, 02 Jul 2018 08:50:29 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id 131-v6sm20662998wmm.31.2018.07.02.08.50.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 08:50:29 -0700 (PDT) In-Reply-To: <83po05k5rx.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Jul 2018 18:37:38 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148105 Archived-At: Eli Zaretskii writes: >> From: joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) >> Cc: 32034@debbugs.gnu.org, dgutov@yandex.ru >> Date: Mon, 02 Jul 2018 16:28:53 +0100 >>=20 >> Eli Zaretskii writes: >>=20 >> >> (beginning-of-line line) >> >> - (forward-char column) >> >> + (ignore-errors (forward-char column)) >> >> + (unless (and (=3D (1+ (current-line)) line) >> >> + (=3D (current-column) column)) >> >> + (message "Intended xref location was line=3D%d, column= =3D%d" >> >> + line column)) >> >> (point-marker)))))) >> > >> > What will the last hunk do when a file changed, but the identifier was >> > still found? >>=20 >> The function is completely oblivious to the identifier being found or >> not. So it would do what it does now: jump to the wrong location > > And display the message, right? Not necessarily, if that line and column still exists. > If so, the message would be an annoyance if displayed unconditionally, > because at least the etags back-end can cope with these calamities, > and users rely on that (it lets one re-generate TAGS only once in a > blue moon). That's what I wrote in the original message. I added it under the assumption that it would be less of an annoyance than silently jumping to the wrong spot int he file. The feature you want to add to the relevant xref-location-marker method makes a lot of sense, but it's a new feature nevertheless. > Or maybe I misunderstand the context in which this code runs, in > which case ignore me. No, I think your understanding is fine. The current code is really quite dumb. The reason you don't come across it often is that the elisp and etags backend use their own "location" class, xref-etags-location and xref-elisp-location. But eglot uses the xref-file-location class bundled with xref (it could also use its own, but then what's the point of having a built-in class for this? perhaps none, in this case I move to delete it) >> > AFAIR, the etags back-end is capable of doing that >> > (because it searches the file in the vicinity of the line/column if >> > not found at the exact location), and it's a valuable feature, for >> > obvious reasons. >>=20 >> IIUC, that's what I'm proposing in my point 3: add a "hint" field to >> xref-file-location and default that hint to the identifier being looked >> for. If etags has code for that already, then great, we could try to >> share it > > I don't think you can share that code, because it relies on the > contents of the TAGS file, where the 'etags' utility records not only > the position of the identifier, but also a string to search for it. I meant the code that searches for the string then, if it isn't too trivial. When you can, please comment on the possibility of fixing this in emacs-26 or master. Jo=C3=A3o