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: pre-command-hook with input methods Date: Thu, 05 Feb 2015 13:28:45 +0000 Message-ID: <878ugcmqr6.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423142951 32639 80.91.229.3 (5 Feb 2015 13:29:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2015 13:29:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 05 14:29:10 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 1YJMUW-00079R-D9 for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 14:29:08 +0100 Original-Received: from localhost ([::1]:41913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJMUV-0007Jy-GP for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 08:29:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJMUG-0007Jm-8q for emacs-devel@gnu.org; Thu, 05 Feb 2015 08:28:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJMUB-0000Ti-6m for emacs-devel@gnu.org; Thu, 05 Feb 2015 08:28:52 -0500 Original-Received: from cheviot12.ncl.ac.uk ([128.240.234.12]:41067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJMUB-0000TZ-0W for emacs-devel@gnu.org; Thu, 05 Feb 2015 08:28:47 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot12.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1YJMUA-0005S7-A9 for emacs-devel@gnu.org; Thu, 05 Feb 2015 13:28:46 +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 1YJMUA-000891-13 for emacs-devel@gnu.org; Thu, 05 Feb 2015 13:28:46 +0000 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.12 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:182441 Archived-At: I'm trying to understand the behaviour of pre-command-hook with an input method set. Using the code below to probe this, I find that with italian-postfix the pre-command-hook does not get run when I expect. For instance consider this scenario Key Cumulative OnScreen p-c-h-fired? g g Yes a ga[_`] No b gab Yes, twice 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". All fine, but it's breaking my completion framework which removes previously offered completions on the pre-command-hook. I need it to run as soon as the "a" key has been pressed. Is there a better hook? (add-hook 'pre-command-hook 'temp-pre-command-hook) (defvar-local temp-enable nil) (defvar temp-count 1) (defun temp-pre-command-hook () (when temp-enable (message "pch:%s" (incf temp-count))))