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: [Emacs-diffs] master 7b31de4: Add hook for all events Date: Thu, 24 Jan 2019 10:41:18 +0000 Message-ID: <87k1iu2v8x.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="96448"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.91 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 24 11:52:14 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 1gmccH-000Otl-A8 for ged-emacs-devel@m.gmane.org; Thu, 24 Jan 2019 11:52:13 +0100 Original-Received: from localhost ([127.0.0.1]:51206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmccG-0001H3-Bi for ged-emacs-devel@m.gmane.org; Thu, 24 Jan 2019 05:52:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmcRy-0002j7-Pa for emacs-devel@gnu.org; Thu, 24 Jan 2019 05:41:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmcRu-0007r6-Se for emacs-devel@gnu.org; Thu, 24 Jan 2019 05:41:31 -0500 Original-Received: from cloud103.planethippo.com ([78.129.138.110]:44124) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmcRm-0007aK-OU for emacs-devel@gnu.org; Thu, 24 Jan 2019 05:41:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References: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=HLb84PhnRWibyxzOLFm1udSvL3SsRAjk6eQOwPqfJSA=; b=VPZ3cZoUd+As8DrNbH8Sqt4cs K5DxC3IQwv080/drEUo5jApDkoLKnJER/zN0MfFNZVGuvrPRfhurj7w6r+1o5J3K3oK/fkWyDusjn MSVbnN/8gPX7sFLOgBximpX2DGc5GgPdVfl9yf1H9EmL/q6Hh42wm12JeAcL2/jN5r5woG5oARiHp MFv2/ahCRISp0t/+/PSCFeogi1TJFinkl8/9UJQvp60akUG+ArcKO9xcXn8Lhldl43daRKRkGmpwj 8ZCzXATLKhd6sD+3rRP+veRfIqO9yUfFtSck0L+ZzMSAbCILHFpHVTGingoLyMzFmFdskPyXy0hwC s6d+6ewag==; Original-Received: from janus-nat-128-240-225-124.ncl.ac.uk ([128.240.225.124]:48869 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gmcRi-00BsCk-Ma; Thu, 24 Jan 2019 10:41:18 +0000 In-Reply-To: (Stefan Monnier's message of "Wed, 23 Jan 2019 21:06:14 -0500") 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:232671 Archived-At: Stefan Monnier writes: >> The problem is that company uses pre-command-hook to remove old offered >> completions. But self-insert hasn't run yet, because the user hasn't >> decided whether to type "e" or "e'". With this hook, I can pick up the >> intermediate keypresses. > > So, IIUC the issue is to detect when to pop down the completions offered > by the likes of company/pabbrev/... > And the idea is that those packages can stop using pre-command-hook and > use input-event-functions. I'm currently using both pre-command and input-event but yes, you are probably correct I wouldn't need pre-command any more. Currently, I am doing this: (defun pabbrev-input-event-functions (event) "Remove offering expansion from buffer on events. This function is normally run off `input-event-functions'. It main purpose is to remove completions during multi-keystroke keyboard events associated with many input methods. These do not signal a pre-command-hook because the command only completes when they are unambiguously complete." (cond ((mouse-movement-p event) nil) (t (pabbrev-pre-command-hook)))) > So, IIUC now company will pop down its menu as soon as you hit a prefix > key like C-x or C-c, right? Is that a desirable or undesirable > side-effect? Yes, I think it would do that. I don't know if this is desirable or not. I will have to try it. I expect it is a difference most people wouldn't see. It also has a practical impact; it is not possible to complete when an input method is in the middle of the multi key press. So, for example, with italian-postfix you can no longer complete on a prefix ending in an "e" or and "i"; pressing "e" removes completion suggestions, but does not trigger adding them because "e" could be "e`". > I guess the previously available alternative was to use sit-for to wait > for the next event, right (and indeed, I think input-event-functions is > a better option than sit-for)? Well, you should find it better; this hook is your code (I stole it from a patch you sent in 2015). Sit-for, yes, would be a possibility, that I hadn't thought off; you'd still need to filter the event using `last-input-event' I guess. That would be a way of fixing company and pabbrev in current Emacs. I will investigate. Phil