emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goto-line trouble with narrowing


From: Kevin Rodgers
Subject: Re: goto-line trouble with narrowing
Date: Mon, 30 Jan 2006 09:57:35 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Richard M. Stallman wrote:
    The defun for `goto-line' in emacs/lisp/simple.el specifically calls

        (widen)

    on the buffer before moving to the specified line number.  I don't
    know whether this is intended.

That line wasn't written by accident!

Perhaps the doc string should be changed from:
"Goto line ARG, counting from line 1 at beginning of buffer."

to:
"Goto line ARG, counting from line 1 at beginning of widened buffer."

The most common use of goto-line is to go to a line number
that you got from some other program.  That program normally
operates on the whole file.  For goto-line to use a narrowed
line number would hardly ever be useful.

I sometimes would like to be able to do that, as when working
in a narrowed buffer visiting a very large file that I pipe into
a shell command that reports line numbers (e.g. C-x h M-| grep -n foo).

goto-line already takes a prefix arg to mean a different buffer,
which is useful in the resulting *Shell Command Output* buffer, so I
guess I need to roll my own goto-line-in-narrowed-buffer command that
just omits the call to (widen).  :-(

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]