From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: unreading a command key sequence Date: Thu, 08 May 2008 10:04:45 +0200 Message-ID: <4822B41D.1050408@gmail.com> References: <48210959.9050500@gmail.com> <482161D0.1030203@gmail.com> <4821F678.4070100@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1210233931 32693 80.91.229.12 (8 May 2008 08:05:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2008 08:05:31 +0000 (UTC) Cc: Emacs Devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 08 10:06:07 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ju18M-00054P-Tp for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 10:05:48 +0200 Original-Received: from localhost ([127.0.0.1]:37397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ju17e-00069O-RV for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 04:05:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ju17b-00069J-0G for emacs-devel@gnu.org; Thu, 08 May 2008 04:04:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ju17Z-000696-13 for emacs-devel@gnu.org; Thu, 08 May 2008 04:04:58 -0400 Original-Received: from [199.232.76.173] (port=59126 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ju17Y-000693-TK for emacs-devel@gnu.org; Thu, 08 May 2008 04:04:56 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:3436) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ju17Y-0006o3-54 for emacs-devel@gnu.org; Thu, 08 May 2008 04:04:56 -0400 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ju17W-0002XG-Ij for emacs-devel@gnu.org; Thu, 08 May 2008 04:04:54 -0400 Original-Received: from c83-254-150-27.bredband.comhem.se ([83.254.150.27]:59675 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1Ju17T-0006rz-47; Thu, 08 May 2008 10:04:51 +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 In-Reply-To: X-Antivirus: avast! (VPS 080507-0, 2008-05-07), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.150.27 X-Scan-Result: No virus found in message 1Ju17T-0006rz-47. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Ju17T-0006rz-47 b3feaa5f9800c8166f8f2c228da8481a X-detected-kernel: by mx20.gnu.org: Linux 2.6? (barebone, rare!) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:96732 Archived-At: 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.