all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <E1D7MU8-0002ND-Rz@fencepost.gnu.org> (raw)
In-Reply-To: <d07ukv$pci$1@sea.gmane.org> (message from Kevin Rodgers on Thu,  03 Mar 2005 14:18:00 -0700)

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)))))))

  parent reply	other threads:[~2005-03-04 23:45 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01 22:58 Key binding M-g should really be goto-line Jari Aalto+mail.emacs
2005-03-01 23:35 ` David Kastrup
2005-03-02  4:50   ` Eli Zaretskii
2005-03-02  5:39     ` Nick Roberts
2005-03-02  6:24     ` Miles Bader
2005-03-02  8:31     ` Key binding M-g should really be goto-line autolearn=no version=3.0.2 Jari Aalto+mail.emacs
2005-03-02 11:30       ` Alfred M. Szmidt
2005-03-02 12:15         ` Miles Bader
2005-03-02 13:54           ` Alfred M. Szmidt
2005-03-02 20:54             ` Miles Bader
2005-03-02 12:43         ` Andreas Schwab
2005-03-02 14:00         ` Stefan Monnier
2005-03-02 14:13           ` Alfred M. Szmidt
2005-03-02 12:17       ` Key binding M-g should really be goto-line autolearn=no version=3.0.2 " Jari Aalto+mail.linux
2005-03-02 13:42         ` Key binding M-g should really be goto-line Kim F. Storm
2005-03-02 13:53         ` 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 15:36         ` Key binding M-g should really be goto-line autolearn=no version=3.0.2 " Jari Aalto
2005-03-02 19:03         ` Key binding M-g should really be goto-line autolearn=noversion=3.0.2 " Drew Adams
2005-03-03 12:29           ` Andreas Schwab
2005-03-03 17:27             ` Drew Adams
2005-03-03 21:18               ` Kevin Rodgers
2005-03-03 22:24                 ` Drew Adams
2005-03-04 23:45                 ` Richard Stallman [this message]
2005-03-05  0:24                   ` Miles Bader
2005-03-05  0:49                     ` Key binding M-g should really be goto-lineautolearn=noversion=3.0.2 " Drew Adams
2005-03-05  1:27                       ` Miles Bader
2005-03-05  1:55                         ` Luc Teirlinck
2005-03-05 11:05                           ` Reiner Steib
2005-03-05  2:00                         ` Drew Adams
2005-03-05  2:32                           ` Miles Bader
2005-03-05 19:00                         ` Stefan Monnier
2005-03-05 19:32                           ` Miles Bader
2005-03-05 20:22                           ` Key binding M-g should really be goto-line Johan Bockgård
2005-03-05 23:16                             ` Miles Bader
2005-03-06  9:50                               ` David Kastrup
2005-03-06 21:15                   ` Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2 Kim F. Storm
2005-03-06 22:38                     ` Miles Bader
2005-03-06 22:40                       ` Miles Bader
2005-03-03 21:58               ` Andreas Schwab
2005-03-02 18:18       ` Key binding M-g should really be goto-line " Eli Zaretskii
2005-03-01 23:49 ` Key binding M-g should really be goto-line Alfred M. Szmidt
2005-03-02  1:00   ` Ralf Angeli
2005-03-02  1:14     ` Alfred M. Szmidt
2005-03-02  8:08       ` Ralf Angeli
2005-03-02  1:19     ` David Kastrup
2005-03-02 13:40   ` Robert J. Chassell
2005-03-02  2:01 ` Key binding M-g should really be goto-line autolearn=no version=3.0.2 Jari Aalto+mail.linux
2005-03-02  2:06 ` Key binding M-g should really be goto-line Luc Teirlinck
2005-03-03  2:29   ` Richard Stallman
2005-03-02  9:24 ` Kai Großjohann
2005-03-02 11:15 ` Jari Aalto+mail.emacs
2005-03-02 13:52   ` Alfred M. Szmidt
2005-03-02 14:50     ` Josh Varner
2005-03-02 16:38       ` Alfred M. Szmidt
2005-03-02 17:16         ` Reiner Steib
2005-03-02 17:52           ` Alfred M. Szmidt
2005-03-02 19:01           ` Johan Bockgård
2005-03-02 20:23             ` Gaetan Leurent
2005-03-02 20:46               ` Miles Bader
2005-03-02 20:33             ` Alfred M. Szmidt
2005-03-02 15:38   ` Jari Aalto
2005-03-03  2:29 ` Richard Stallman
2005-03-03  7:19 ` Jari Aalto

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1D7MU8-0002ND-Rz@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.