unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "paul r" <paul.r.ml@gmail.com>
To: "emacs- devel" <emacs-devel@gnu.org>
Subject: Re: Patch: enhanced mark navigation commands
Date: Wed, 5 Mar 2008 13:23:11 +0100	[thread overview]
Message-ID: <e30f0f320803050423w1466dd9el5b2af2f09e2bb928@mail.gmail.com> (raw)
In-Reply-To: <buoy78xelqx.fsf@dhapc248.dev.necel.com>

> GIven that M-n and M-p are widely used bindings, I don't think you'll
> win many fans by adding global bindings for them, unless the new
> bindings clearly don't conflict or interact in strange ways with other
> uses.


M-n and M-p are also usefull and intuitive as forward-paragraph and
backward-paragraph.

I take this opportunity to propose something. It is clear that we all
must make choices on how to bind quick shortcuts. Usually, one wants a
simple and quick shortcut for operations (s)he does a lot. Of course,
if Adrian wants to jump 4 marks backward, he does not want to type,
for instance, C-x M-m p ( which would mean command - mark - previous )
4 times.
Given they are good chances that he would hit the keybinding 4 times
in a row, without doing any other operation in the middle, one could
take advantage of this special pattern, by letting him hit only 'p' as
long as he wants to keep jumping. This is exactly the behaviour of C-x
e and I find it very cleaver. Loop breaks when any other key it hit.
AFAIK, there is no common practice to make this kind of keybinding, at
least yet. That's why I use the following few lines that are rather
ugly but work well :

;;;; Auto-repeat any command by pressing last shortcut key
(defun auto-repeat-command (command)
 (let ((repeat-repeat-char
        (when (eq last-command-char
                  last-command-event)
          last-command-char)))
   (call-interactively command)
   (while (eq (read-event) repeat-repeat-char)
     ;; Make each repetition undo separately.
     (auto-repeat-command command)
     (setq unread-command-events (list last-input-event)))))


Then, mark jumping can be bound this way :

(global-set-key "\C-x\M-mn" (lambda () (interactive)
                            (auto-repeat-command 'marker-visit-next)))
(global-set-key "\C-x\M-mp" (lambda () (interactive)
                            (auto-repeat-command 'marker-visit-prev)))


Please understand I'm not proposing any particular implementation, but
only something I consider as a desirable behaviour that could be
encouraged when bindings functions that are likely to be called
several times in a row.
Hoping I was clear and used not-too-bad english,

-- paul




  reply	other threads:[~2008-03-05 12:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  5:12 Patch: enhanced mark navigation commands Adrian Robert
2008-03-05  6:19 ` Miles Bader
2008-03-05 12:23   ` paul r [this message]
2008-03-05  6:41 ` Dan Nicolaescu
2008-03-06  0:57   ` Juri Linkov
2008-03-06  1:47     ` Dan Nicolaescu
2008-03-06  7:18       ` Drew Adams
2008-03-06 10:09       ` Juri Linkov
2008-03-09 21:55     ` Juri Linkov
2008-03-05 16:11 ` Ted Zlatanov
2008-03-05 19:20   ` Stefan Monnier
2008-03-05 19:48     ` Ted Zlatanov
2008-03-05 22:10       ` Miles Bader
2008-03-10 13:09         ` Ted Zlatanov
2008-03-10 22:34           ` Juri Linkov
2008-03-11 15:08             ` Ted Zlatanov
2008-03-06  0:54 ` Juri Linkov

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=e30f0f320803050423w1466dd9el5b2af2f09e2bb928@mail.gmail.com \
    --to=paul.r.ml@gmail.com \
    --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 public inbox

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

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