* Key bindings for info in other window or frame
@ 2013-07-24 21:28 Matthias Meulien
2013-07-25 1:09 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Meulien @ 2013-07-24 21:28 UTC (permalink / raw)
To: bug-gnu-emacs; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
Severity: wishlist Tags: patch
Everything is in the subject!
The attached patch defines `info-other-frame' and bind it to `C-x
5 i'. It also bind `info-other-window' to `C-x 4 i'.
I know that `info-other-window' is already bind to `C-h 4 i' but I
found it more difficult to remember than the key binding which use
the ubiquitous `C-x 4' keymap.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Key bindings for info in other window or frame --]
[-- Type: text/x-diff, Size: 1590 bytes --]
From cf8d4210743c1c9b06db28e5b5bb5a51f8a190bf Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Wed, 24 Jul 2013 23:23:44 +0200
Subject: [PATCH] lisp/info.el (info-other-window): Add key binding and other
frame defun
---
lisp/info.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lisp/info.el b/lisp/info.el
index 0e0a117..99098e8 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -745,6 +745,7 @@ in `Info-file-supports-index-cookies-list'."
(not (member dir (split-string path ":" t)))
(push dir Info-directory-list)))))))
+;;;###autoload (define-key ctl-x-4-map "i" 'info-other-window)
;;;###autoload
(defun info-other-window (&optional file-or-node buffer)
"Like `info' but show the Info buffer in another window."
@@ -756,6 +757,18 @@ in `Info-file-supports-index-cookies-list'."
(info-setup file-or-node
(switch-to-buffer-other-window (or buffer "*info*"))))
+;;;###autoload (define-key ctl-x-5-map "i" 'info-other-frame)
+;;;###autoload
+(defun info-other-frame (&optional file-or-node buffer)
+ "Like `info' but put the Info buffer in another frame."
+ (interactive (list
+ (if (and current-prefix-arg (not (numberp current-prefix-arg)))
+ (read-file-name "Info file name: " nil nil t))
+ (if (numberp current-prefix-arg)
+ (format "*info*<%s>" current-prefix-arg))))
+ (info-setup file-or-node
+ (switch-to-buffer-other-frame (or buffer "*info*"))))
+
;;;###autoload (put 'info 'info-file (purecopy "emacs"))
;;;###autoload
(defun info (&optional file-or-node buffer)
--
1.8.3.3
[-- Attachment #3: Type: text/plain, Size: 34 bytes --]
Thanks for reading,
--
Matthias
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-24 21:28 Key bindings for info in other window or frame Matthias Meulien
@ 2013-07-25 1:09 ` Stefan Monnier
2013-07-25 8:15 ` Matthias Meulien
2013-07-26 21:46 ` Matthias Meulien
0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-07-25 1:09 UTC (permalink / raw)
To: Matthias Meulien; +Cc: bug-gnu-emacs, emacs-devel
> The attached patch defines `info-other-frame' and bind it to `C-x
> 5 i'. It also bind `info-other-window' to `C-x 4 i'.
Thanks. But what I'm looking for is a C-x 4 command and a C-x 5 command
which work like prefix keys changing the subsequent command to use a new
window/frame (presumably using display-buffer-overriding-action).
Then C-x 4 C-x C-f would do the same as the current C-x 4 f,
and C-x 4 M-x info would do the same as your C-x 4 i.
Also we could further tweak those commands to use
a set-temporary-overlay-map so as to provide shortcuts like the
preexisting C-x 4 f (which would map to C-x 4 C-x C-f), at which point
adding C-x 4 i and C-x 5 i would be easy and wouldn't require any
new command.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-25 1:09 ` Stefan Monnier
@ 2013-07-25 8:15 ` Matthias Meulien
2013-07-26 21:46 ` Matthias Meulien
1 sibling, 0 replies; 8+ messages in thread
From: Matthias Meulien @ 2013-07-25 8:15 UTC (permalink / raw)
To: Stefan Monnier; +Cc: bug-gnu-emacs, emacs-devel
> (...) But what I'm looking for is a C-x 4 command and a C-x 5 command
> which work like prefix keys changing the subsequent command to use a new
> window/frame (presumably using display-buffer-overriding-action).
I see. You're right and I'll make a try in that direction.
--
Matthias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-25 1:09 ` Stefan Monnier
2013-07-25 8:15 ` Matthias Meulien
@ 2013-07-26 21:46 ` Matthias Meulien
2013-07-27 14:05 ` Stefan Monnier
2013-07-27 14:06 ` Stefan Monnier
1 sibling, 2 replies; 8+ messages in thread
From: Matthias Meulien @ 2013-07-26 21:46 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> (...) But what I'm looking for is a C-x 4 command and a C-x 5
> command which work like prefix keys changing the subsequent
> command to use a new window/frame (presumably using
> display-buffer-overriding-action).
Here is my 2c. It works as expected with the key bindings `C-x 5
C-h i', `C-x 5 C-x C-b' or `C-x 5 M-x compose-mail' but not with
`C-x 5 C-x d' or `C-x 5 M-x gnus'... So I am not sure, I am doing
it the right way... Please feel free to comment.
(defun other-frame-visitor (_arg)
(interactive "p") (let* ((key-seq (read-key-sequence "Other
frame: "))
(display-buffer-alist (cons '(".*"
(display-buffer-pop-up-frame)) display-buffer-alist))
(cmd (lookup-key (current-global-map) key-seq)))
(call-interactively cmd)))
(global-set-key "\C-x5" 'other-frame-visitor)
--
Matthias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-26 21:46 ` Matthias Meulien
@ 2013-07-27 14:05 ` Stefan Monnier
2013-07-27 21:02 ` Matthias Meulien
2013-07-27 14:06 ` Stefan Monnier
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-07-27 14:05 UTC (permalink / raw)
To: Matthias Meulien; +Cc: emacs-devel
>> (...) But what I'm looking for is a C-x 4 command and a C-x 5 command
>> which work like prefix keys changing the subsequent command to use a new
>> window/frame (presumably using display-buffer-overriding-action).
> Here is my 2c. It works as expected with the key bindings `C-x 5 C-h i',
> C-x 5 C-x C-b' or `C-x 5 M-x compose-mail' but not with `C-x 5 C-x d' or
> C-x 5 M-x gnus'... So I am not sure, I am doing it the right way... Please
Why do you use display-buffer-alist rather than
display-buffer-overriding-action?
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-26 21:46 ` Matthias Meulien
2013-07-27 14:05 ` Stefan Monnier
@ 2013-07-27 14:06 ` Stefan Monnier
2013-07-27 21:06 ` Matthias Meulien
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-07-27 14:06 UTC (permalink / raw)
To: Matthias Meulien; +Cc: emacs-devel
> (defun other-frame-visitor (_arg) (interactive "p") (let* ((key-seq
> (read-key-sequence "Other frame: ")) (display-buffer-alist (cons '(".*"
> (display-buffer-pop-up-frame)) display-buffer-alist)) (cmd (lookup-key
> (current-global-map) key-seq))) (call-interactively cmd)))
Another problem is that it should not call read-key-sequence.
Instead it should set display-buffer-overriding-action, then return.
But after returning, it should arrange to reset
display-buffer-overriding-action after the next command (maybe with
a post-command-hook).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Key bindings for info in other window or frame
2013-07-27 14:06 ` Stefan Monnier
@ 2013-07-27 21:06 ` Matthias Meulien
0 siblings, 0 replies; 8+ messages in thread
From: Matthias Meulien @ 2013-07-27 21:06 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> (...) But after returning, it should arrange to reset
> display-buffer-overriding-action after the next command (maybe
> with a post-command-hook).
Ho, I am happy to read your suggestion because I know that hook and I
was wondering if it was not the thing to use. Good. I'll review my code
snippet...
--
Matthias
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-07-27 21:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 21:28 Key bindings for info in other window or frame Matthias Meulien
2013-07-25 1:09 ` Stefan Monnier
2013-07-25 8:15 ` Matthias Meulien
2013-07-26 21:46 ` Matthias Meulien
2013-07-27 14:05 ` Stefan Monnier
2013-07-27 21:02 ` Matthias Meulien
2013-07-27 14:06 ` Stefan Monnier
2013-07-27 21:06 ` Matthias Meulien
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.