From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: pre-command-hook with input methods Date: Thu, 05 Feb 2015 15:19:40 -0500 Message-ID: References: <878ugcmqr6.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423167597 16909 80.91.229.3 (5 Feb 2015 20:19:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2015 20:19:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: phillip.lord@newcastle.ac.uk (Phillip Lord) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 05 21:19:52 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 1YJStz-00027b-Tm for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 21:19:52 +0100 Original-Received: from localhost ([::1]:45400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJStz-00042C-8b for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 15:19:51 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJStv-0003z1-5j for emacs-devel@gnu.org; Thu, 05 Feb 2015 15:19:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJStr-0004vH-1R for emacs-devel@gnu.org; Thu, 05 Feb 2015 15:19:47 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:50968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJStq-0004vC-R8 for emacs-devel@gnu.org; Thu, 05 Feb 2015 15:19:42 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t15KJegW019716; Thu, 5 Feb 2015 15:19:41 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2A19FF5F; Thu, 5 Feb 2015 15:19:40 -0500 (EST) In-Reply-To: <878ugcmqr6.fsf@newcastle.ac.uk> (Phillip Lord's message of "Thu, 05 Feb 2015 13:28:45 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5208=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5208> : inlines <2040> : streams <1385321> : uri <1847360> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.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:182477 Archived-At: > So, the pre-command-hook runs only *after* the multi-key press behaviour > has been completed (either by introducing a diacritical letter or by not > doing so). Hence on pressing "b" it gets run twice -- once to say "a has > been entered" and once to say "b has been entered". This is correct, since when you hit `a' the self-insert-command is not run yet (instead the `a' char is inserted in the buffer by the input method, which then waits for the next key to see which character was really meant); it's only run after you hit `b'. > All fine, but it's breaking my completion framework which removes > previously offered completions on the pre-command-hook. Indeed, I wouldn't be surprised if several other uses of pre-command-hook could suffer from unexpected behaviors in such situations. > I need it to run as soon as the "a" key has been pressed. Of course, you can do that using one of the input-method hooks (maybe input-method-after-insert-chunk-hook), or you could rely on before-change-functions. > Is there a better hook? I don't think so, sadly. Maybe we could introduce a new hook like `after-idle-hook'. Part of the question is what should happen if a timer or a process filter runs (these can run while Emacs is "idle")? How 'bout when that timer/process-filter inserts text near/at point? Stefan