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#9917: bug#5042: bug#9917: 24.0.90; Make `goto-line' consistent with the line number from the minibuffer Date: Tue, 27 Oct 2020 22:52:10 +0200 Message-ID: <87zh478ovp.fsf@mail.linkov.net> References: <877dspmzo3.fsf@gnus.org> <83zh5l1uqw.fsf@gnu.org> <87wo0osspd.fsf@gnus.org> <87lfh3dtoj.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12410"; 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: 5042@debbugs.gnu.org, 9917@debbugs.gnu.org, monnier@iro.umontreal.ca, dmoncayo@gmail.com To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 27 21:54:20 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 1kXVz2-00036K-Lz for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 21:54:20 +0100 Original-Received: from localhost ([::1]:36500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXVyx-00048n-JB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 16:54:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXVym-00046v-6j for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:54:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34581) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXVyl-0008Lv-Tl for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:54:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXVyl-0007cm-TT for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:54:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Oct 2020 20:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9917 X-GNU-PR-Package: emacs Original-Received: via spool by 9917-submit@debbugs.gnu.org id=B9917.160383200929224 (code B ref 9917); Tue, 27 Oct 2020 20:54:03 +0000 Original-Received: (at 9917) by debbugs.gnu.org; 27 Oct 2020 20:53:29 +0000 Original-Received: from localhost ([127.0.0.1]:46121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXVyD-0007bD-GH for submit@debbugs.gnu.org; Tue, 27 Oct 2020 16:53:29 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:57953) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXVy9-0007aL-L5; Tue, 27 Oct 2020 16:53:25 -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 relay3-d.mail.gandi.net (Postfix) with ESMTPSA id AB6AD60006; Tue, 27 Oct 2020 20:53:17 +0000 (UTC) In-Reply-To: <87lfh3dtoj.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 21 Sep 2020 22:03:44 +0300") 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:191794 Archived-At: > This is what for example help-function-def--button-function does: > > ;; Widen the buffer if necessary to go to this position. > (when (or (< position (point-min)) > (> position (point-max))) > (widen)) > (goto-char position) > > Unfortunately, xref doesn't provide such nice feature, > so 'M-.' fails to navigate in a narrowed buffer. Here is the fix for xref: diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index eed73f5791..c7ff351845 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -897,8 +897,10 @@ xref-location-marker (let ((buffer-point (find-function-search-for-symbol symbol type file))) (with-current-buffer (car buffer-point) (save-excursion - (goto-char (or (cdr buffer-point) (point-min))) - (point-marker)))))) + (save-restriction + (widen) + (goto-char (or (cdr buffer-point) (point-min))) + (point-marker))))))) (cl-defmethod xref-location-group ((l xref-elisp-location)) (xref-elisp-location-file l))