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: Fri, 06 Feb 2015 15:45:07 +0000 Message-ID: <87siej9h8c.fsf@newcastle.ac.uk> References: <878ugcmqr6.fsf@newcastle.ac.uk> <87fvajb0vs.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423237519 28162 80.91.229.3 (6 Feb 2015 15:45:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2015 15:45:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 06 16:45:18 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 1YJl5q-0002TG-2e for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2015 16:45:18 +0100 Original-Received: from localhost ([::1]:49021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJl5p-0006DT-HX for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2015 10:45:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJl5m-0006AL-2x for emacs-devel@gnu.org; Fri, 06 Feb 2015 10:45:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJl5h-00057x-9z for emacs-devel@gnu.org; Fri, 06 Feb 2015 10:45:14 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:58921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJl5h-00057W-4p for emacs-devel@gnu.org; Fri, 06 Feb 2015 10:45:09 -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 1YJl5g-0003Ww-Dn; Fri, 06 Feb 2015 15:45:08 +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 1YJl5f-000555-SW; Fri, 06 Feb 2015 15:45:07 +0000 In-Reply-To: (Stefan Monnier's message of "Fri, 6 Feb 2015 10:17:55 -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:182543 Archived-At: Stefan Monnier writes: >> Gave that a quick go. As far as I can see, after-insert-chunk-hook >> runs after the input is complete. > > Hmm... > >> Likewise, b-c-f which only runs when the buffer has changed. > > No, it should run *before* the buffer is changed, and AFAIK the buffer > *is* changed (by inserting an "a") when you hit the "a". this "a" will > get removed later (after you hit the "b") before running the > self-insert-command which will (re)do the insertion. > > Oh, wait, I see that quail-input-method starts by let-binding > inhibit-modification-hooks, so indeed, before-change-functions won't be run. > Hmm... of course, you can still try > > (add-function :before input-method-function ...) > > but since its default value is nil (i.e. incompatible with > add-function), it'll be a bit more tricky That's because by default there's no input method active. So, I guess, the trick would be to use input-method-activate-hook to advice the input-method-function. > (you'll need an :around advice, and you'll need to check the orig > function (in case it's nil) before calling it). > > There's clearly room for improvement here. A bit messy, yes. I blame all foreigners and their diacritics. Phil