From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: pre-command-hook with input methods Date: Mon, 09 Feb 2015 15:30:45 +0000 Message-ID: <87egpz14re.fsf@newcastle.ac.uk> References: <878ugcmqr6.fsf@newcastle.ac.uk> <87fvajb0vs.fsf@newcastle.ac.uk> <87siej9h8c.fsf@newcastle.ac.uk> <87iofb2wfk.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423495863 31275 80.91.229.3 (9 Feb 2015 15:31:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2015 15:31:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 09 16:30:59 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YKqIc-000276-LA for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 16:30:58 +0100 Original-Received: from localhost ([::1]:33490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqIb-0005C6-W4 for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 10:30:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqIY-0005C1-3A for emacs-devel@gnu.org; Mon, 09 Feb 2015 10:30:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKqIT-0006pN-4T for emacs-devel@gnu.org; Mon, 09 Feb 2015 10:30:53 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:43217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqIS-0006mn-Sh for emacs-devel@gnu.org; Mon, 09 Feb 2015 10:30:49 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1YKqIR-0006da-Cu; Mon, 09 Feb 2015 15:30:47 +0000 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1YKqIP-0007TV-VN; Mon, 09 Feb 2015 15:30:45 +0000 In-Reply-To: (Stefan Monnier's message of "Mon, 9 Feb 2015 09:41:35 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182695 Archived-At: Stefan Monnier writes: >>> The Right Way to fix this is to change the default value to be non-nil. >>> In this case, I think using #'list might work. >> I am not sure how that would work. Surely the point of having this as a >> variable is that it can be changed? > > I'm only suggesting to change the default value from nil to `list', > which I just did in "master". > > This then allows you to use `add-function' on that variable. Ah, sorry. The advice is actually on the variable, and no on the symbol stored in the variable? So it runs even if the value changes? > But I still think there's room for improvement with something like > a `pre-interaction-hook' or something like that. Brings me to the next > question. We know you'd like such a pre-interaction-hook to be run just > before processing the first char in a multi-char input-method element, > but what about the simpler/common case of a key prefix: > > When the user hits C-x C-f, would you like to run this > pre-interaction-hook right when the user hits C-x, or only after the > user hit C-x C-f? > > Maybe what you're after is just an input-event-hook? So, currently, the offered completion remains in buffer until the key sequence has been completed. Once you have typed the first part of the keysequence through (C-u or C-x) then the abbreviation is going to disappear one way or the other. Either you complete the sequence (which runs a command) or you quit (which runs a command). I think for consistency, the hook should run immediately before or after Emacs responds to C-u (or C-x) depending on whether it is pre- or post-. Effectively, the C-x of a C-xC-f is, I think equivalent to the first "a" of a "a`" post-fix input key sequence. The only reason that the former works fine for me, and the latter is problematic is the latter changes the display of the buffer while the former changes just the mini-buffer. So, my initial feeling is that it doesn't make any difference for this particular use case. The other possibility is not to have an interaction hook but to have a "the buffer has just changed in some way that is liable to cause a redisplay"-hook. I don't know that this would be better. I throw it out as a possibility, depending on which is easier. Phil