all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* other-frame, other-window prefix keys
@ 2015-08-08  7:24 Stephen Leake
  2015-08-08  7:31 ` Andreas Schwab
  2015-08-08 20:52 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Leake @ 2015-08-08  7:24 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

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 #2: other-frame-window.el --]
[-- Type: application/emacs-lisp, Size: 10139 bytes --]

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

end of thread, other threads:[~2015-08-11 17:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-08  7:24 other-frame, other-window prefix keys Stephen Leake
2015-08-08  7:31 ` Andreas Schwab
2015-08-09  5:32   ` Stephen Leake
2015-08-08 20:52 ` Stefan Monnier
2015-08-09  6:06   ` Stephen Leake
2015-08-09  8:10     ` Kalle Olavi Niemitalo
2015-08-09 16:17     ` Stefan Monnier
2015-08-11 17:37       ` Setting "echoing prefix" from Elisp (was: other-frame, other-window prefix keys) Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.