emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: while-no-input and pending input (was: while-no-input interrupted by


From: Drew Adams
Subject: RE: while-no-input and pending input (was: while-no-input interrupted by *shell*)
Date: Tue, 25 Sep 2018 10:53:36 -0700 (PDT)

> I ran into other trouble with `while-no-input': A command I use - it
> calls w-n-i to generate feedback for the echo area unless the user hits
> a key - sometimes needs to select a different frame.  AFAIK this
> generates an event and w-n-i then does nothing because of its implicit
> `input-pending-p' test.
> 
> Using a modified version of w-n-i with the input-pending-p test removed
> solves the problem, but that's not good because (1) I have to duplicate
> the definition of w-n-i in my code (it's what Helm does btw.) and (2)
> hmm, can doing this have downsides?
> 
> What could I else do in this situation to prevent the frame switch or
> whatever event to be misinterpreted as user input?  Could/should w-n-i
> generally ignore events in `while-no-input-ignore-events' - I mean, also
> the input-pending-p part?

Dunno whether this helps or whether it's a good idea, but this is what I do:

(defun icicle-skip-this-command ()
  "Prevent `handle-switch-frame' from being added to `this-command'."
  (interactive)
  (setq this-command  last-command))

(defun icicle-handle-switch-frame (event)
  "Call `handle-switch-frame', but don't add it to `this-command'."
  (interactive "e")
  (handle-switch-frame event)
  (setq this-command  last-command))

 (define-key global-map [handle-switch-frame] 'icicle-skip-this-command)
 (define-key global-map [switch-frame] 'icicle-handle-switch-frame))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]