emacs-devel
[Top][All Lists]
Advanced

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

other-frame, other-window prefix keys


From: Stephen Leake
Subject: other-frame, other-window prefix keys
Date: Sat, 08 Aug 2015 02:24:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

I finally made time to work on universal other-frame and other-window
prefix keys. This was discussed about 2 years ago here:
https://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00075.html. It
turned out to be easier than I anticipated.

Attached is a minor mode that implements this.

It advises switch-to-buffer and temp-buffer-window-show-advice, and
binds C-x 7 and C-x 8 such that:

C-x 7 <command> causes a buffer displayed by <command> to appear in
another window in the same frame; a window is created if necessary.

C-x 8 <command> causes a buffer displayed by <command> to appear in
another frame; a frame is created if necessary.


This avoids the need to define -other-window and -other-frame variants
of commands that switch to a new buffer; it adds those variants in a
generic way.

It also binds:

C-x W move current buffer to another window in the same frame

C-x F move current buffer to another frame

These make it easy to rearrange the buffer placement, and to recover
from forgetting to type C-x 7 or 8.


It works nicely, and I'm already getting dependent on it. 

I used C-x 7, C-x 8 because they are currently unbound. That's a bit
awkward to type, so in my personal setup I bound M-m, M-M, which are
close to M-. , which I use a lot, so this is very convenient.

Advising temp-buffer-window-show-advice addresses the issue of how
temporary prompt buffers are displayed.

There is one issue (see the FIXMEs); if the command is aborted for any
reason, the prefix (set in ofw-frame-window-prefix-arg) needs to be
reset. I haven't looked into doing that yet.

If post-command-hook is run even if a command is aborted, that might be
a good place to reset this. I'll have to try it.

I also haven't finished porting this to Emacs 24.3.

I'd be happy to put this in Gnu ELPA (in part so it is available for
Emacs 24.3), but there was some discussion in the original thread about
having something like this in core.

The advice on switch-to-buffer simply redefines the function; it is
probably possible to do that more carefully, to preserve more of the
current semantics.

-- 
-- Stephe

Attachment: other-frame-window.el
Description: application/emacs-lisp


reply via email to

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