unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 7b31de4: Add hook for all events
Date: Thu, 24 Jan 2019 10:41:18 +0000	[thread overview]
Message-ID: <87k1iu2v8x.fsf@russet.org.uk> (raw)
In-Reply-To: <jwvk1iu24sz.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 23 Jan 2019 21:06:14 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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



  reply	other threads:[~2019-01-24 10:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190122214637.25164.20429@vcs0.savannah.gnu.org>
     [not found] ` <20190122214639.B2E13203DD@vcs0.savannah.gnu.org>
2019-01-22 23:17   ` master 7b31de4: Add hook for all events Michael Albinus
2019-01-23 22:56     ` Phillip Lord
2019-01-24  3:36       ` Eli Zaretskii
2019-01-23  1:30   ` [Emacs-diffs] " Daniel Colascione
2019-01-23 23:10     ` Phillip Lord
2019-01-24  2:06       ` Stefan Monnier
2019-01-24 10:41         ` Phillip Lord [this message]
2019-01-25 13:56           ` Stefan Monnier
2019-01-28  9:42             ` Phillip Lord
2019-01-26  0:50           ` Stefan Monnier
2019-01-28  9:54             ` Phillip Lord
2019-02-02 16:13               ` Timing of input-method output (was: [Emacs-diffs] master 7b31de4: Add hook for all events) Stefan Monnier
2019-02-03 22:06                 ` Timing of input-method output Phillip Lord
2019-02-05 14:49                   ` Stefan Monnier
2019-02-06 22:18                     ` Phillip Lord
2019-02-06 22:55                       ` Stefan Monnier
2019-02-11 22:10                         ` Phillip Lord
2019-02-11 22:20                           ` Stefan Monnier
2019-02-12 12:21                             ` Phillip Lord
2019-03-25 21:48                               ` Phillip Lord
2019-03-26 15:12                                 ` Stefan Monnier
2019-03-28 13:54                                   ` Phillip Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1iu2v8x.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).