[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Going to line n, column m
From: |
Pascal J. Bourguignon |
Subject: |
Re: Going to line n, column m |
Date: |
Tue, 07 Oct 2008 20:58:25 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux) |
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Pascal J. Bourguignon wrote:
>> Mauricio <briqueabraque@yahoo.com> writes:
>>> I think this is simple, but I wasn't able
>>> to find it anywhere: how can I tell emacs
>>> I want to go to line x, column y?
>>
>> Usually, x is the column, and y is the line.
>>
>> (defun goto-xy (column line)
>> (interactive "nColumn:
>> nLine: ")
>> (let ((lines (count-lines (point-min) (point-max))))
>> (cond
>> ((< line 0) (error "Cannot go before the beginning of buffer."))
>> ((< line lines) (beginning-of-buffer) (forward-line line))
>
> I think you need to use (widen) above. Please see `goto-line' - and why
> not use goto-line?
I didn't think about it, but now that you ask, goto-line is an
interactive function that does much more than going to some line. And
it will eventuall call forward-line, so I think it's a good idea to
call it directly.
Otherwise, you're correct about widen, but there must be a good reason
why the user narrowed, I'd guess.
The point is that, obviously, my command lacks a good documentation
string. Sorry about that.
--
__Pascal Bourguignon__ http://www.informatimago.com/
This is a signature virus. Add me to your signature and help me to live.
- Re: Going to line n, column m, (continued)
- Message not available
- Re: Going to line n, column m, Pascal J. Bourguignon, 2008/10/08
- Re: Going to line n, column m, Nikolaj Schumacher, 2008/10/08
- Re: Going to line n, column m, Andreas Politz, 2008/10/08
- Message not available
- Re: Going to line n, column m, Pascal J. Bourguignon, 2008/10/08
- Message not available
- Re: Going to line n, column m, stan, 2008/10/08
- Re: Going to line n, column m, Pascal J. Bourguignon, 2008/10/09
- Re: Going to line n, column m, stan, 2008/10/09
- Re: Going to line n, column m, Lennart Borgman (gmail), 2008/10/09
Re: Going to line n, column m, Pascal J. Bourguignon, 2008/10/07