all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2
Date: Thu, 3 Mar 2005 14:24:41 -0800	[thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBEENMCMAA.drew.adams@oracle.com> (raw)
In-Reply-To: <d07ukv$pci$1@sea.gmane.org>

    > What I suggested was a simple command to pick up a numeral
    > from any buffer,
    > regardless of what the numeral might mean in that buffer. It would be
    > rudimentary, but would do at least what people are doing with
    > `goto-line',
    > without requiring them to key in the line number.

    Is this what you have in mind?

    (defun goto-line-at-point (&optional buffer)
       "Go to the line whose number is given at point, counting like \
    \\[goto-line].
    With a prefix arg, prompt for a BUFFER and select it before moving."
       (interactive (list (if current-prefix-arg
                              (read-buffer "Goto buffer: "
                                           (other-buffer (current-buffer) t)
                                           t))))
       (when buffer
         (pop-to-buffer buffer))
       (goto-line (number-at-point)))

I was thinking more like the following. You don't want to have to input the
buffer each time (even hitting RET to get the default). And it's unlikely
that you would want to go to a line in the same buffer in which the line
number appears.

(defun goto-line-at-point (buffer)
  "In another buffer, go to the line whose number is at point.
With prefix argument, you are prompted for the buffer.
Without it, `other-buffer' is used."
  (interactive
   (list (if current-prefix-arg
             (read-buffer
                "Buffer: "
                (other-buffer (current-buffer) t)
                t)
           (other-buffer (current-buffer) t))))
  (let ((lineno (or (number-at-point)
                    (error "No number near cursor"))))
    (unless (wholenump lineno)
            (setq lineno (abs (truncate lineno))))
    (message "Line %s in buffer `%s'" lineno buffer)
    (pop-to-buffer buffer)
    (goto-line lineno)))

    If so, maybe a mouse- version would be useful, too.

Yes, that's what I was suggesting. I don't have a need for such commands,
but it sounded like they might be useful for the use case cited.

  reply	other threads:[~2005-03-03 22:24 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 [this message]
2005-03-04 23:45                 ` Richard Stallman
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=FDELKNEBLPKKDCEBEJCBEENMCMAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.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.
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.