all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: unreading a command key sequence
Date: Thu, 08 May 2008 10:04:45 +0200	[thread overview]
Message-ID: <4822B41D.1050408@gmail.com> (raw)
In-Reply-To: <jwvprrxzi50.fsf-monnier+emacs@gnu.org>

Stefan Monnier wrote:
>> I do this in pre-command-hook and I just did forget that this-command still
>> will be carried out (and that was what I wanted to prevent). I think this is
>> what I should do instead:
> 
>>   (setq this-command 'tunnel-last-command)
>>   (setq unread-command-events
>>         (append unread-command-events
>>                 (listify-key-sequence
>>                  (this-command-keys-vector))
>>                 nil))
>>   (defun tunnel-last-command ()
>>     "Set `this-command' to `last-command'."
>>     (interactive)
>>     (setq this-command last-command))
> 
>> This works for in the tests I have made (including some with Viper undo
>> involved). If this is the way to do such things in pre-command-hook then
>> this might be worth documenting.
> 
> You seem to be thinking out loud.  I don't know what you mean by "such
> things".

Sorry. "Such things" = when you want to prevent running this-command at 
the moment and instead want to change some things first, but still want 
the read key sequence to be used as input.

In my situation I want to change major mode first.




  reply	other threads:[~2008-05-08  8:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07  1:43 unreading a command key sequence Lennart Borgman (gmail)
2008-05-07  2:31 ` Stefan Monnier
2008-05-07  8:01   ` Lennart Borgman (gmail)
     [not found]     ` <jwvod7i883u.fsf-monnier+emacs@gnu.org>
2008-05-07 18:35       ` Lennart Borgman (gmail)
2008-05-08  1:43         ` Stefan Monnier
2008-05-08  8:04           ` Lennart Borgman (gmail) [this message]
2008-05-08 13:55             ` Stefan Monnier
2008-05-08 21:00               ` Lennart Borgman (gmail)
2008-05-08 21:15                 ` David Kastrup
2008-05-08 21:19                   ` 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

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

  git send-email \
    --in-reply-to=4822B41D.1050408@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.