emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unreading a command key sequence


From: Lennart Borgman (gmail)
Subject: Re: unreading a command key sequence
Date: Thu, 08 May 2008 10:04:45 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

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 via email to

[Prev in Thread] Current Thread [Next in Thread]