[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2
From: |
Richard Stallman |
Subject: |
Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2 |
Date: |
Fri, 04 Mar 2005 18:45:32 -0500 |
How about making goto-line suggest the number at point
as its default argument?
(defun goto-line (arg &optional buffer)
"Goto line ARG, counting from line 1 at beginning of buffer.
With just C-u as argument, move point in the most recently displayed
other buffer, and display it."
(interactive
(if (and current-prefix-arg (not (consp current-prefix-arg)))
(list (prefix-numeric-value current-prefix-arg))
;; Look for a default, a number in the buffer at point.
(let ((default
(save-excursion
(skip-chars-backward "0-9")
(if (looking-at "[0-9]")
(buffer-substring-no-properties
(point)
(progn (skip-chars-forward "0-9")
(point)))))))
;; Read the argument, offering that number (if any) default.
(list (read-from-minibuffer (format "Goto line (%s): " default)
nil nil t
'minibuffer-history
default)
(if (consp current-prefix-arg)
(other-buffer (current-buffer) t))))))
(with-current-buffer (or buffer (current-buffer))
(save-restriction
(widen)
(goto-char 1)
(if (eq selective-display t)
(re-search-forward "[\n\C-m]" nil 'end (1- arg))
(forward-line (1- arg)))
(if buffer
(let ((window (get-buffer-window buffer)))
(if window
(set-window-point window (point))
(display-buffer buffer)))))))
- Re: Key binding M-g should really be goto-line autolearn=no version=3.0.2, (continued)
- Re: Key binding M-g should really be goto-line autolearn=no version=3.0.2, Alfred M. Szmidt, 2005/03/02
- Re: Key binding M-g should really be goto-line autolearn=no version=3.0.2 autolearn=no version=3.0.2, Jari Aalto+mail.linux, 2005/03/02
- Re: Key binding M-g should really be goto-line, Kim F. Storm, 2005/03/02
- Re: Key binding M-g should really be goto-line autolearn=no version=3.0.2 autolearn=no version=3.0.2, Alfred M. Szmidt, 2005/03/02
- Re: Key binding M-g should really be goto-line autolearn=no version=3.0.2 autolearn=no version=3.0.2 autolearn=no version=3.0.2, Jari Aalto, 2005/03/02
- RE: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Drew Adams, 2005/03/02
- Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Andreas Schwab, 2005/03/03
- RE: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Drew Adams, 2005/03/03
- Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Kevin Rodgers, 2005/03/03
- RE: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Drew Adams, 2005/03/03
- Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2,
Richard Stallman <=
- Re: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2, Miles Bader, 2005/03/04
- RE: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Drew Adams, 2005/03/04
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Miles Bader, 2005/03/04
- RE: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Drew Adams, 2005/03/04
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Miles Bader, 2005/03/04
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Luc Teirlinck, 2005/03/04
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Reiner Steib, 2005/03/05
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Stefan Monnier, 2005/03/05
- Re: Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 autolearn=no version=3.0.2, Miles Bader, 2005/03/05
- Re: Key binding M-g should really be goto-line, Johan Bockgård, 2005/03/05