From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#44294: No widen by xref-find-definitions Date: Wed, 28 Oct 2020 22:01:43 +0200 Organization: LINKOV.NET Message-ID: <87mu06p1aw.fsf_-_@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: dmitry gutov To: 44294@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 28 21:08:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXrjw-0001NN-4n for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Oct 2020 21:08:12 +0100 Original-Received: from localhost ([::1]:40796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXrjv-0000EH-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Oct 2020 16:08:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXrjn-0000Dl-Ay for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 16:08:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXrjn-00068d-2D for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 16:08:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXrjm-000834-IC; Wed, 28 Oct 2020 16:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: dgutov@yandex.ru, bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Oct 2020 20:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: dmitry gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.160391563030874 (code B ref -1); Wed, 28 Oct 2020 20:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Oct 2020 20:07:10 +0000 Original-Received: from localhost ([127.0.0.1]:50859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXriw-00081p-BV for submit@debbugs.gnu.org; Wed, 28 Oct 2020 16:07:10 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXris-00081X-RB for submit@debbugs.gnu.org; Wed, 28 Oct 2020 16:07:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXris-0007mQ-Lq for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 16:07:06 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:1365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXriq-0005zo-Kt for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 16:07:06 -0400 X-Originating-IP: 91.129.102.160 Original-Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 46DA7240004 for ; Wed, 28 Oct 2020 20:07:00 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.193; envelope-from=juri@linkov.net; helo=relay1-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/28 16:06:53 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191919 Archived-At: --=-=-= Content-Type: text/plain X-Debbugs-CC: Dmitry Gutov Tags: patch >>> diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el >>> @@ -897,8 +897,10 @@ xref-location-marker >>> - (goto-char (or (cdr buffer-point) (point-min))) >>> - (point-marker)))))) >>> + (save-restriction >>> + (widen) >>> + (goto-char (or (cdr buffer-point) (point-min))) >>> + (point-marker))))))) > > If this works, sure, please install. This piece by itself makes sense. > >> Hm... Does Dmitry have any comments here? (Added to Cc.) > > I'm subscribed to the bug tracker, but I skip over a number of discussions > automatically (and an extra email in a thread is relatively easy to miss, > too). > > In case I don't respond in similar circumstances in the future, may I ask > for a personal email? One without 'debbugs.gnu.org' in the From/To/Cc. Oh, sorry, I noticed this problem is just the tip of the iceberg, so creating a separate bug report from bug#5042 and bug#9917. The patch above fixes the problem of using xref-find-definitions in elisp-mode, but using xref-find-definitions in narrowed C files still fails with the error "Rerun etags: `%s' not found in %s". Here is an additional patch that fixes this as well: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=etags-goto-tag-location-widen.patch diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index f6af1f2ea8..1b7f3c72a2 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1406,8 +1406,12 @@ etags-goto-tag-location offset (* 3 offset))) ; expand search window (or found (re-search-forward pat nil t) - (user-error "Rerun etags: `%s' not found in %s" - pat buffer-file-name))) + (if (or (= (point-min) 1) (not widen-automatically)) + (user-error "Rerun etags: `%s' not found in %s" + pat buffer-file-name) + ;; Rerun after removing narrowing + (widen) + (etags-goto-tag-location tag-info)))) ;; Position point at the right place ;; if the search string matched an extra Ctrl-m at the beginning. (and (eq selective-display t) --=-=-=--