From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: "Pascal J. Bourguignon" <pjb@informatimago.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Going to line n, column m
Date: Tue, 07 Oct 2008 20:43:35 +0200 [thread overview]
Message-ID: <48EBADD7.8060204@gmail.com> (raw)
In-Reply-To: <87zllg720r.fsf@hubble.informatimago.com>
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)))))))
>
>
next prev parent reply other threads:[~2008-10-07 18:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.476.1223399312.25473.help-gnu-emacs@gnu.org>
2008-10-07 17:23 ` Going to line n, column m Pascal J. Bourguignon
2008-10-07 18:43 ` Lennart Borgman (gmail) [this message]
[not found] ` <mailman.485.1223405182.25473.help-gnu-emacs@gnu.org>
2008-10-07 18:58 ` Pascal J. Bourguignon
2008-10-07 17:08 Mauricio
2008-10-07 20:32 ` Nikolaj Schumacher
[not found] ` <mailman.498.1223411586.25473.help-gnu-emacs@gnu.org>
2008-10-07 20:38 ` Pascal J. Bourguignon
2008-10-07 20:52 ` Joost Kremers
2008-10-07 20:54 ` Lennart Borgman (gmail)
2008-10-08 0:00 ` Xavier Maillard
[not found] ` <mailman.501.1223412938.25473.help-gnu-emacs@gnu.org>
2008-10-07 23:20 ` Pascal J. Bourguignon
2008-10-07 23:54 ` Lennart Borgman (gmail)
[not found] ` <mailman.512.1223423709.25473.help-gnu-emacs@gnu.org>
2008-10-08 2:29 ` Chetan
2008-10-08 14:22 ` Nikolaj Schumacher
[not found] ` <mailman.566.1223475737.25473.help-gnu-emacs@gnu.org>
2008-10-08 17:32 ` Pascal J. Bourguignon
2008-10-08 18:54 ` Nikolaj Schumacher
2008-10-08 19:57 ` Mauricio
[not found] ` <mailman.605.1223492071.25473.help-gnu-emacs@gnu.org>
2008-10-08 20:00 ` Pascal J. Bourguignon
2008-10-08 21:08 ` Andreas Politz
2008-10-08 21:15 ` Nikolaj Schumacher
[not found] ` <mailman.618.1223500557.25473.help-gnu-emacs@gnu.org>
2008-10-08 21:36 ` Pascal J. Bourguignon
2008-10-09 2:42 ` stan
2008-10-09 6:38 ` Pascal J. Bourguignon
2008-10-09 22:49 ` stan
2008-10-09 23:43 ` Lennart Borgman (gmail)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48EBADD7.8060204@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=pjb@informatimago.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).