From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Timing of input-method output Date: Mon, 25 Mar 2019 21:48:23 +0000 Message-ID: <87va06bp7c.fsf@russet.org.uk> References: <20190122214637.25164.20429@vcs0.savannah.gnu.org> <20190122214639.B2E13203DD@vcs0.savannah.gnu.org> <40f2dac5-f342-b9f0-a792-796a6baf9a56@dancol.org> <87fttj55t8.fsf@russet.org.uk> <87k1iu2v8x.fsf@russet.org.uk> <87munlumyn.fsf@russet.org.uk> <875zu0edcf.fsf@russet.org.uk> <878syssgr6.fsf@russet.org.uk> <87ftsukmci.fsf@russet.org.uk> <87mun1w61s.fsf@russet.org.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="248145"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 25 22:49:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8XTE-0012QM-S9 for ged-emacs-devel@m.gmane.org; Mon, 25 Mar 2019 22:49:29 +0100 Original-Received: from localhost ([127.0.0.1]:48986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8XTD-0004xU-5z for ged-emacs-devel@m.gmane.org; Mon, 25 Mar 2019 17:49:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8XT1-0004vO-7u for emacs-devel@gnu.org; Mon, 25 Mar 2019 17:49:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8XT0-00050L-B2 for emacs-devel@gnu.org; Mon, 25 Mar 2019 17:49:15 -0400 Original-Received: from cloud103.planethippo.com ([78.129.138.110]:32770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8XSz-0004YO-SB for emacs-devel@gnu.org; Mon, 25 Mar 2019 17:49:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:References:Message-ID :Date:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=grgEtlevaobPQdPqgzQv36ILwgcpkLj5s0DwOSX0C5U=; b=x3z7UKHHuqIE71eiMMrpFDhhQ pwig71fFpw5k2S7U2T/OAyar/ZrXMS4J2rFMisz/dabqA9aAkcflSd3zzl8HSDW6LyKXr/2KHzEsE SQpGasxEelSBDJ4bKElP+oQefZwwYsfkDODtRstWylJVFIDmNZHY7UEzSuqW89LZy8+K5pJKtZEnh LQWPGrdWSDBceyITYQjAefiYED7DB+i3faVLWm7y7G8KQMC/KfPzDnI1vaeKHRfdNACzFHYPmsRvF MFRsSwTYvrKpnJJVGpKLH0en6EUigEM6eJrHtUAtl1R35AcGxl0pq62w0HLmBjTsssw+d0IxSm+Bb pqubNBuYQ==; Original-Received: from cpc142652-benw12-2-0-cust953.16-2.cable.virginm.net ([82.21.43.186]:53786 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h8XSI-0006N8-NF; Mon, 25 Mar 2019 21:48:30 +0000 In-Reply-To: <87mun1w61s.fsf@russet.org.uk> (Phillip Lord's message of "Tue, 12 Feb 2019 12:21:51 +0000") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 78.129.138.110 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:234732 Archived-At: Stefan I've done a bit more work on this and come up with a much simpler solution which is specificially plumbed into quail. It looks like this: modified lisp/international/quail.el @@ -59,6 +59,10 @@ quail "Quail: multilingual input method." :group 'leim) + +(defvar quail-pre-translation-hook nil + "Normal hook run before quail starts or updates a translation.") + ;; Buffer local variables (defvar quail-current-package nil @@ -1548,6 +1552,7 @@ quail-update-translation `quail-current-key'. If CONTROL-FLAG is nil, proceed the translation with more keys." (let ((func (quail-update-translation-function))) + (run-hooks 'quail-pre-translation-hook) (if func (setq control-flag (funcall func control-flag)) (cond ((numberp control-flag) pabbrev.el uses this very simply like so: (add-hook 'quail-pre-translation-hook 'pabbrev-pre-command-hook nil t) (add-hook 'pre-command-hook 'pabbrev-pre-command-hook nil t) (add-hook 'post-command-hook 'pabbrev-post-command-hook nil t) pabbrev-pre-command-hook was always badly named (since it's the function to go on a hook, not a variable defining a hook), and is now worse. Basically, we just run the "remove the abbreviation expansion which is being offered in readiness for a command to run". So, a couple of questions: pre-command-hook is current run by "safe_run_hooks". Does `quail-pre-translation-hook' need to be as well (in which case, it would need uncovering in lisp)? I guess the counter here is that it's possible to get out so long as you don't type certain characters, or you change buffer. But, it leaves emacs fairly unusuable none the less. And, where do you think I should document it? Perhaps "Invoking the Input Method"; but "Command Loop Overview" is the place where the people who might want to use it might actually see it? Phil