GNU bug report logs - #9917
24.0.90; Make `goto-line' consistent with the line number from the minibuffer

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Mon, 31 Oct 2011 14:34:01 UTC

Severity: wishlist

Merged with 5042, 16173

Found in versions 24.0.90, 24.3.50

Forwarded to http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00143.html

Full log


Message #65 received at 9917 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 5042 <at> debbugs.gnu.org, 9917 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca, dmoncayo <at> gmail.com
Subject: Re: bug#5042: bug#9917: 24.0.90; Make `goto-line' consistent with
 the line number from the minibuffer
Date: Mon, 21 Sep 2020 22:03:44 +0300
> However, if people have a narrowed buffer, and are looking at (say) the
> compilation output that says "error on like 45" in a shell, then `M-g g
> 45' will definitely do the wrong thing is we change the command to start
> counting from the start of the narrowed region.

In this case another option is to widen the buffer before going to that line.
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.

For 'M-g M-g' this means removing 'save-restriction' from 'goto-line'.

> So a new command and keystroke seems warranted.  How about...
> `M-g M-v'?   (The mnemonic is "goto visual line".)

Or to add a new key to narrow-map 'C-x n' that currently
contains only 4 keys:

  C-x n d         narrow-to-defun
  C-x n n         narrow-to-region
  C-x n p         narrow-to-page
  C-x n w         widen

where a new key could be:

  C-x n g         go to narrowed line




This bug report was last modified 4 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.