unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Use of where-is-internal
@ 2020-02-01  6:53 Paul W. Rankin
  2020-02-01 13:01 ` Adam Porter
  2020-02-01 14:24 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Paul W. Rankin @ 2020-02-01  6:53 UTC (permalink / raw)
  To: emacs-devel

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)))

This function allows me to type C-x o o o o to cycle through all windows
with the idea being to allow the command to work with any key binding
rather than hardcoding anything.

I maintain a minor mode called olivetti that also uses a transient key
map to allow changing a buffer-local variable with C-c { { { ... The key
binding is currently hardcoded within the transient key map but I'd like
to allow user customisation.

So, should I throw caution to the wind and reimplement the transient key
map in olivetti using where-is-internal despite it being clearly marked
as internal, or is there a better way?

Thanks,

--
Paul W. Rankin
https://www.paulwrankin.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-01 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-01  6:53 Use of where-is-internal Paul W. Rankin
2020-02-01 13:01 ` Adam Porter
2020-02-01 14:24 ` Stefan Monnier
2020-02-01 15:27   ` Noam Postavsky

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).