help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: use of special-event-map


From: Michael Cadilhac
Subject: Re: use of special-event-map
Date: Sat, 07 May 2005 02:42:26 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <drew.adams@oracle.com> writes:

> Another question about use of `special-event-map' - consider this code:
>
> (define-key special-event-map [iconify-frame] 'toto)
>
> (defun foo ()
>   (interactive)
>   (let ((binding (lookup-key special-event-map [iconify-frame])))
>     (define-key special-event-map [iconify-frame] 'ignore-event)
>     (iconify-frame)
>     (define-key special-event-map [iconify-frame] binding)))
>
> (defun toto (event)
>   (interactive "e")
>   (message "TOTO"))
>
> When I try M-x foo, `toto' gets executed, even though `foo' tries to remove
> its binding. Same thing happens if I use `nil' instead of `ignore-event'.
>
> Explanation? Any way around this? That is, is there some way I can inhibit
> the binding of [iconify-frame] for the duration of command foo?

  Hi !

  Mhhh, don't know if it works in any case (using Ion, iconify doesn't
  make much sense), but, well... Try this:

(defun foo ()
  (interactive)
  (iconify-frame)
  (while (not (input-pending-p))
    (sit-for 1))
  (discard-input))

-- 
    Michael Cadilhac, a.k.a. Micha [mika] |
                    Epita/LRDE promo 2007 |  Please note that you should
  2 rue de la Convention | 01.46.70.90.75 |  s/-@t-/@/ my mail address.
94270 Le Kremlin Bicetre | 06.23.20.31.30 |

Attachment: pgpcHKTaZPcpl.pgp
Description: PGP signature


reply via email to

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