[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Going to line n, column m
From: |
Lennart Borgman (gmail) |
Subject: |
Re: Going to line n, column m |
Date: |
Tue, 07 Oct 2008 20:43:35 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
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?
> (t (end-of-buffer) (insert (make-string (- line lines) 10))))
> (let ((columns (- (progn (end-of-line) (point))
> (progn (beginning-of-line) (point)))))
> (cond ((< column 0) (error "Cannot go before the beginning of line"))
> ((< column columns) (forward-char column))
> (t (end-of-line) (insert (make-string (- column columns) 32)))))))
>
>
- Re: Going to line n, column m, (continued)
- Re: Going to line n, column m, Mauricio, 2008/10/08
- 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
- Re: Going to line n, column m,
Lennart Borgman (gmail) <=
- Message not available