emacs-devel
[Top][All Lists]
Advanced

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

Re: Use of where-is-internal


From: Stefan Monnier
Subject: Re: Use of where-is-internal
Date: Sat, 01 Feb 2020 09:24:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I'm considering of using where-is-internal in a program outside of the
> help library. I've used the following in my init for a while to cycle
> windows and so far the world has persisted unscathed:
>
>    (defun other-window-and-beyond (count &optional all-frames)
>      "Select another window in cyclic ordering of windows.
>    Successive pressing `o' calls `other-window'."
>      (interactive "p")
>      (let ((key-vector (where-is-internal this-command
>                                           overriding-local-map t)))
>        (set-transient-map
>         (let ((map (make-sparse-keymap)))
>           (define-key map (vector (aref key-vector (1- (length key-vector))))
>             'other-window)
>           map)
>         t)
>        (other-window count all-frames)))

I have a feeling of "déjà vu"!

The answer involved `this-single-command-keys`.


        Stefan




reply via email to

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