* Adding missing C-x 5 C-j and C-x t C-j commands
@ 2022-05-22 19:53 Sean Whitton
2022-05-23 2:24 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Sean Whitton @ 2022-05-22 19:53 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
We have C-x d, C-x 4 d, C-x 5 d and C-x t d, but only C-x C-j
and C-x 4 C-j. My fingers try to use C-x 5 C-j, and find it isn't
there, at least biweekly. Here is a draft patch to fill the gap.
C-x t C-j temporarily doesn't work due to #55582.
--
Sean Whitton
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-dired-jump-other-frame-and-dired-jump-other-tab.patch --]
[-- Type: text/x-diff, Size: 7690 bytes --]
From 2b5ced057a959ab51387ac5d45d2a7b10a414591 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Sun, 22 May 2022 12:08:54 -0700
Subject: [PATCH] Add dired-jump-other-frame and dired-jump-other-tab
* lisp/bindings.el: Drop binding C-x C-j and C-x 4 C-j.
* lisp/dired.el: Bind C-x C-j, C-x 4 C-j, C-x 5 C-j and C-x t C-j
using autoload cookies. (This parallels the way in which C-x d,
C-x 4 d, C-x 5 d and C-x t d are bound.)
(dired-up-directory): When optional argument is a function, switch to
the buffer using that function.
(dired-jump): Refactor to call dired-jump--internal.
(dired-jump-other-window): Refactor to call dired-jump--internal and
add "... in other window" to read-file-name prompt.
(dired-jump-other-frame, dired-jump-other-tab): New commands.
(dired-jump--internal): New function factored out of dired-jump.
* etc/NEWS:
* doc/emacs/dired.texi (Entering Dired): Document the change.
---
doc/emacs/dired.texi | 9 +++++-
etc/NEWS | 4 +++
lisp/bindings.el | 3 --
lisp/dired.el | 66 ++++++++++++++++++++++++++++++++------------
4 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index ed4ff5213f..5a95d6e8e1 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -111,8 +111,12 @@ Dired Enter
@findex dired-jump
@findex dired-jump-other-window
+@findex dired-jump-other-frame
+@findex dired-jump-other-tab
@kindex C-x C-j
@kindex C-x 4 C-j
+@kindex C-x 5 C-j
+@kindex C-x t C-j
You can ask Emacs to invoke Dired on the default-directory
(@pxref{File Names, default-directory}) of any buffer, by typing
@kbd{C-x C-j} (@code{dired-jump}). If the buffer visits a file, this
@@ -123,7 +127,10 @@ Dired Enter
and places point on the line that corresponds to the directory where
you invoked @code{dired-jump}. Typing @kbd{C-x 4 C-j}
(@code{dired-jump-other-window}) has the same effect, but displays the
-Dired buffer in a new window.
+Dired buffer in a new window; similarly @kbd{C-x 5 C-j}
+(@code{dired-jump-other-frame}) to display the Dired buffer in a new
+frame and @kbd{C-x t C-j} (@code{dired-jump-other-tab}) to display the
+Dired buffer in a new tab.
The variable @code{dired-listing-switches} specifies the options to
give to @command{ls} for listing the directory; this string
diff --git a/etc/NEWS b/etc/NEWS
index 190620619f..31105bfbec 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1493,6 +1493,10 @@ If non-nil (which is the default), hitting 'RET' or 'mouse-1' on
the directory components at the directory displayed at the start of
the buffer will take you to that directory.
++++
+*** New commands 'dired-jump-other-frame' and 'dired-jump-other-tab'.
+These are bound to 'C-x 5 C-j' and 'C-x t C-j' respectively.
+
** Exif
---
diff --git a/lisp/bindings.el b/lisp/bindings.el
index ed1325e326..4ed197f1d4 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1501,9 +1501,6 @@ esc-map
(define-key ctl-x-map "'" 'expand-abbrev)
(define-key ctl-x-map "\C-b" 'list-buffers)
-(define-key ctl-x-map "\C-j" 'dired-jump)
-(define-key ctl-x-4-map "\C-j" 'dired-jump-other-window)
-
(define-key ctl-x-map "z" 'repeat)
(defvar ctl-x-x-map
diff --git a/lisp/dired.el b/lisp/dired.el
index 89fbd52aa6..d8fa726c6f 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2583,8 +2583,13 @@ dired-up-directory
"Run Dired on parent directory of current directory.
Find the parent directory either in this buffer or another buffer.
Creates a buffer if necessary.
-If OTHER-WINDOW (the optional prefix arg), display the parent
-directory in another window."
+
+When called interactively with a prefix argument, display the
+parent directory in another window.
+
+When called from Lisp, if OTHER-WINDOW is a function, switch to
+the buffer by calling that function. When OTHER-WINDOW is
+otherwise non-nil, use `switch-to-buffer-other-window'."
(interactive "P")
(let* ((dir (dired-current-directory))
(up (file-name-directory (directory-file-name dir))))
@@ -2592,11 +2597,12 @@ dired-up-directory
;; Only try dired-goto-subdir if buffer has more than one dir.
(and (cdr dired-subdir-alist)
(dired-goto-subdir up))
- (progn
- (if other-window
- (dired-other-window up)
- (dired--find-possibly-alternative-file up))
- (dired-goto-file dir)))))
+ (progn (pcase other-window
+ ('nil (dired--find-possibly-alternative-file up))
+ ((or (pred functionp) (pred symbolp))
+ (funcall other-window (dired-noselect up)))
+ (_ (dired-other-window up)))
+ (dired-goto-file dir)))))
(defun dired-get-file-for-visit ()
"Get the current line's file name, with an error if file does not exist."
@@ -4704,6 +4710,7 @@ archive-superior-buffer
(defvar tar-superior-buffer)
(declare-function dired-omit-mode "dired-x" (&optional arg))
+;;;###autoload (define-key ctl-x-map "\C-j" #'dired-jump)
;;;###autoload
(defun dired-jump (&optional other-window file-name)
"Jump to Dired buffer corresponding to current buffer.
@@ -4723,6 +4730,39 @@ dired-jump
(interactive
(list nil (and current-prefix-arg
(read-file-name "Jump to Dired file: "))))
+ (dired-jump--internal (if other-window
+ #'switch-to-buffer-other-window
+ #'pop-to-buffer-same-window)
+ file-name))
+
+;;;###autoload (define-key ctl-x-4-map "\C-j" #'dired-jump-other-window)
+;;;###autoload
+(defun dired-jump-other-window (&optional file-name)
+ "Like \\[dired-jump] (`dired-jump') but in other window."
+ (interactive
+ (list (and current-prefix-arg
+ (read-file-name "Jump to Dired file in other window: "))))
+ (dired-jump--internal #'switch-to-buffer-other-window file-name))
+
+;;;###autoload (define-key ctl-x-5-map "\C-j" #'dired-jump-other-frame)
+;;;###autoload
+(defun dired-jump-other-frame (&optional file-name)
+ "Like \\[dired-jump] (`dired-jump') but in other frame."
+ (interactive
+ (list (and current-prefix-arg
+ (read-file-name "Jump to Dired file in other frame: "))))
+ (dired-jump--internal #'switch-to-buffer-other-frame file-name))
+
+;;;###autoload (define-key tab-prefix-map "\C-j" #'dired-jump-other-tab)
+;;;###autoload
+(defun dired-jump-other-tab (&optional file-name)
+ "Like \\[dired-jump] (`dired-jump') but make new tab."
+ (interactive
+ (list (and current-prefix-arg
+ (read-file-name "Jump to Dired file in other tab: "))))
+ (dired-jump--internal #'switch-to-buffer-other-tab file-name))
+
+(defun dired-jump--internal (other-window file-name)
(cond
((and (bound-and-true-p archive-subfile-mode)
(buffer-live-p archive-superior-buffer))
@@ -4746,9 +4786,7 @@ dired-jump
;; refresh and try again
(dired-insert-subdir (file-name-directory dir))
(dired-goto-file dir)))
- (if other-window
- (dired-other-window dir)
- (dired dir))
+ (funcall other-window (dired-noselect dir))
(if file
(or (dired-goto-file file)
;; refresh and try again
@@ -4760,14 +4798,6 @@ dired-jump
(dired-omit-mode)
(dired-goto-file file)))))))))
-;;;###autoload
-(defun dired-jump-other-window (&optional file-name)
- "Like \\[dired-jump] (`dired-jump') but in other window."
- (interactive
- (list (and current-prefix-arg
- (read-file-name "Jump to Dired file: "))))
- (dired-jump t file-name))
-
(provide 'dired)
(run-hooks 'dired-load-hook) ; for your customizations
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-22 19:53 Adding missing C-x 5 C-j and C-x t C-j commands Sean Whitton
@ 2022-05-23 2:24 ` Eli Zaretskii
2022-05-23 4:57 ` Sean Whitton
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2022-05-23 2:24 UTC (permalink / raw)
To: Sean Whitton; +Cc: emacs-devel
> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Sun, 22 May 2022 12:53:25 -0700
>
> We have C-x d, C-x 4 d, C-x 5 d and C-x t d, but only C-x C-j
> and C-x 4 C-j. My fingers try to use C-x 5 C-j, and find it isn't
> there, at least biweekly. Here is a draft patch to fill the gap.
We have the "C-x 5 5" prefix for purposes like this one.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 2:24 ` Eli Zaretskii
@ 2022-05-23 4:57 ` Sean Whitton
2022-05-23 4:59 ` Sean Whitton
2022-05-23 12:26 ` Stefan Monnier
0 siblings, 2 replies; 22+ messages in thread
From: Sean Whitton @ 2022-05-23 4:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hello,
On Mon 23 May 2022 at 05:24am +03, Eli Zaretskii wrote:
>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Sun, 22 May 2022 12:53:25 -0700
>>
>> We have C-x d, C-x 4 d, C-x 5 d and C-x t d, but only C-x C-j
>> and C-x 4 C-j. My fingers try to use C-x 5 C-j, and find it isn't
>> there, at least biweekly. Here is a draft patch to fill the gap.
>
> We have the "C-x 5 5" prefix for purposes like this one.
It's a great fallback, but in this case I don't think one should have to
use it. For everything else under C-x 4 for which -other-frame and
-other-tab variants make sense, we also have bindings under C-x 5 and
C-x t. If we miss some of them out because we've since added C-x 5 5,
we are asking the user to keep track of which things under C-x 4 have
bindings under C-x 5 and which don't -- one has to remember that C-x 4
C-j exists but C-x 5 C-j doesn't. I'd prefer that we don't impose that
cognitive burden on users just because we now have C-x 5 5.
--
Sean Whitton
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 4:57 ` Sean Whitton
@ 2022-05-23 4:59 ` Sean Whitton
2022-05-23 7:56 ` Juri Linkov
2022-05-23 12:26 ` Stefan Monnier
1 sibling, 1 reply; 22+ messages in thread
From: Sean Whitton @ 2022-05-23 4:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hello,
On Sun 22 May 2022 at 09:57pm -07, Sean Whitton wrote:
> If we miss some of them out because we've since added C-x 5 5,
> we are asking the user to keep track of which things under C-x 4 have
> bindings under C-x 5 and which don't -- one has to remember that C-x 4
> C-j exists but C-x 5 C-j doesn't.
I meant: one has to remember that C-x 5 p and C-x 5 d exist but
C-x 5 C-j doesn't.
--
Sean Whitton
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 4:59 ` Sean Whitton
@ 2022-05-23 7:56 ` Juri Linkov
2022-05-23 9:16 ` Eli Zaretskii
2022-05-23 13:35 ` Sean Whitton
0 siblings, 2 replies; 22+ messages in thread
From: Juri Linkov @ 2022-05-23 7:56 UTC (permalink / raw)
To: Sean Whitton; +Cc: Eli Zaretskii, emacs-devel
>> If we miss some of them out because we've since added C-x 5 5,
>> we are asking the user to keep track of which things under C-x 4 have
>> bindings under C-x 5 and which don't -- one has to remember that C-x 4
>> C-j exists but C-x 5 C-j doesn't.
>
> I meant: one has to remember that C-x 5 p and C-x 5 d exist but
> C-x 5 C-j doesn't.
For new commands that don't have a C-x 4 binding
it makes sense to use C-x 5 5, but if a binding
already exists in the C-x 4 keymap, it could be synced
with the C-x 5 keymap for consistency. And indeed
dired-jump-other-frame is missing among existing keys:
C-x 4 C-f find-file-other-window C-x 5 C-f find-file-other-frame
C-x 4 C-j dired-jump-other-window !!!
C-x 4 C-o display-buffer C-x 5 C-o display-buffer-other-frame
C-x 4 . xref-find-definitions-other-window C-x 5 . xref-find-definitions-other-frame
C-x 4 0 kill-buffer-and-window C-x 5 0 delete-frame
C-x 4 4 other-window-prefix C-x 5 5 other-frame-prefix
C-x 4 a add-change-log-entry-other-window
C-x 4 b switch-to-buffer-other-window C-x 5 b switch-to-buffer-other-frame
C-x 4 c clone-indirect-buffer-other-window C-x 5 c clone-frame
C-x 4 d dired-other-window C-x 5 d dired-other-frame
C-x 4 f find-file-other-window C-x 5 f find-file-other-frame
C-x 4 m compose-mail-other-window C-x 5 m compose-mail-other-frame
C-x 4 p project-other-window-command C-x 5 p project-other-frame-command
C-x 4 r find-file-read-only-other-window C-x 5 r find-file-read-only-other-frame
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 7:56 ` Juri Linkov
@ 2022-05-23 9:16 ` Eli Zaretskii
2022-05-23 13:54 ` Sean Whitton
2022-05-23 13:35 ` Sean Whitton
1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2022-05-23 9:16 UTC (permalink / raw)
To: emacs-devel, Juri Linkov, Sean Whitton
On May 23, 2022 10:56:47 AM GMT+03:00, Juri Linkov <juri@linkov.net> wrote:
> >> If we miss some of them out because we've since added C-x 5 5,
> >> we are asking the user to keep track of which things under C-x 4 have
> >> bindings under C-x 5 and which don't -- one has to remember that C-x 4
> >> C-j exists but C-x 5 C-j doesn't.
> >
> > I meant: one has to remember that C-x 5 p and C-x 5 d exist but
> > C-x 5 C-j doesn't.
>
> For new commands that don't have a C-x 4 binding
> it makes sense to use C-x 5 5, but if a binding
> already exists in the C-x 4 keymap, it could be synced
> with the C-x 5 keymap for consistency. And indeed
> dired-jump-other-frame is missing among existing keys:
>
> C-x 4 C-f find-file-other-window C-x 5 C-f find-file-other-frame
> C-x 4 C-j dired-jump-other-window !!!
> C-x 4 C-o display-buffer C-x 5 C-o display-buffer-other-frame
> C-x 4 . xref-find-definitions-other-window C-x 5 . xref-find-definitions-other-frame
> C-x 4 0 kill-buffer-and-window C-x 5 0 delete-frame
> C-x 4 4 other-window-prefix C-x 5 5 other-frame-prefix
> C-x 4 a add-change-log-entry-other-window
> C-x 4 b switch-to-buffer-other-window C-x 5 b switch-to-buffer-other-frame
> C-x 4 c clone-indirect-buffer-other-window C-x 5 c clone-frame
> C-x 4 d dired-other-window C-x 5 d dired-other-frame
> C-x 4 f find-file-other-window C-x 5 f find-file-other-frame
> C-x 4 m compose-mail-other-window C-x 5 m compose-mail-other-frame
> C-x 4 p project-other-window-command C-x 5 p project-other-frame-command
> C-x 4 r find-file-read-only-other-window C-x 5 r find-file-read-only-other-frame
>
>
I don't think we agreed to have full symmetry between C-x 4 and C-x 5. I see no special reason for 100% consistency here. Simple key sequences are at a premium, and we shouldn't usurp them just because we can.
Any user who wants a C-x 5 binding for dired-jump can have such a binding for him or herself. But why do this by default for everyone?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 9:16 ` Eli Zaretskii
@ 2022-05-23 13:54 ` Sean Whitton
2022-05-23 14:07 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Sean Whitton @ 2022-05-23 13:54 UTC (permalink / raw)
To: Eli Zaretskii, emacs-devel, Juri Linkov
Hello,
On Mon 23 May 2022 at 12:16pm +03, Eli Zaretskii wrote:
> I don't think we agreed to have full symmetry between C-x 4 and C-x 5. I see no special reason for 100% consistency here. Simple key sequences are at a premium, and we shouldn't usurp them just because we can.
>
> Any user who wants a C-x 5 binding for dired-jump can have such a binding for him or herself. But why do this by default for everyone?
I certainly agree with you that we shouldn't bind things into C-x 5
willy-nilly. In this case, however, it's not just because we can, but
because it makes things consistent with C-x 4 in a way that's helpful.
As Juri has determined, it's almost the only one that doesn't match
right now.
Here's a different way to look at it. Given the existing symmetry
between C-x 4 and C-x 5, if we later bind anything *other* than
dired-jump-other-window to C-x 5 C-j, we would be introducing a special
exception that users would have to remember. That is, the existing
symmetry has already implicitly semi-reserved C-x 5 C-j for
dired-jump-other-window, by giving us a strong reason not to put
anything else there.
So, given that I'm unlikely to be the only person who has naturally
tried to reach for C-x 5 C-j, let's make the implicit semi-reservation
explicit. This command is as useful as C-x 4 C-j.
--
Sean Whitton
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 13:54 ` Sean Whitton
@ 2022-05-23 14:07 ` Eli Zaretskii
2022-05-23 20:52 ` Sean Whitton
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2022-05-23 14:07 UTC (permalink / raw)
To: Sean Whitton; +Cc: emacs-devel, juri
> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Mon, 23 May 2022 06:54:20 -0700
>
> I certainly agree with you that we shouldn't bind things into C-x 5
> willy-nilly. In this case, however, it's not just because we can, but
> because it makes things consistent with C-x 4 in a way that's helpful.
My point is that it may be useful for you, but is not necessarily
useful enough for others to justify a global "C-x 5" binding.
> As Juri has determined, it's almost the only one that doesn't match
> right now.
"C-x 4 a" is also unpaired, as are "C-x 5 u", "C-x 5 2", and "C-x 5 o".
That's hardly "almost".
> Here's a different way to look at it. Given the existing symmetry
> between C-x 4 and C-x 5, if we later bind anything *other* than
> dired-jump-other-window to C-x 5 C-j, we would be introducing a special
> exception that users would have to remember. That is, the existing
> symmetry has already implicitly semi-reserved C-x 5 C-j for
> dired-jump-other-window, by giving us a strong reason not to put
> anything else there.
See above: we already have asymmetry.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 14:07 ` Eli Zaretskii
@ 2022-05-23 20:52 ` Sean Whitton
0 siblings, 0 replies; 22+ messages in thread
From: Sean Whitton @ 2022-05-23 20:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel, juri
Hello,
On Mon 23 May 2022 at 05:07pm +03, Eli Zaretskii wrote:
>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Mon, 23 May 2022 06:54:20 -0700
>>
>> I certainly agree with you that we shouldn't bind things into C-x 5
>> willy-nilly. In this case, however, it's not just because we can, but
>> because it makes things consistent with C-x 4 in a way that's helpful.
>
> My point is that it may be useful for you, but is not necessarily
> useful enough for others to justify a global "C-x 5" binding.
>
>> As Juri has determined, it's almost the only one that doesn't match
>> right now.
>
> "C-x 4 a" is also unpaired, as are "C-x 5 u", "C-x 5 2", and "C-x 5 o".
> That's hardly "almost".
I wrote "almost" because only C-x 4 a and C-x 4 C-j satisfy both of the
following conditions:
1. Obvious -other-window and -other-frame variants exist
2. There is already a binding under C-x 4.
For commands satisfying these two conditions, symmetry is worthwhile --
otherwise, we're asking the user to remember which of them is missing.
All of C-x 5 u, C-x 5 2, and C-x 5 o fail condition (1).
In addition, I think the existing symmetry makes it such that binding
anything else to C-x 5 C-j would be hard for people to remember --
that's what I mean by an implicit semi-reservation. If I'm right that
the only thing we would want to bind there is what I'm proposing to bind
there, then it makes sense to do so for everyone.
--
Sean Whitton
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 7:56 ` Juri Linkov
2022-05-23 9:16 ` Eli Zaretskii
@ 2022-05-23 13:35 ` Sean Whitton
1 sibling, 0 replies; 22+ messages in thread
From: Sean Whitton @ 2022-05-23 13:35 UTC (permalink / raw)
To: Juri Linkov; +Cc: Eli Zaretskii, emacs-devel
Hello,
On Mon 23 May 2022 at 10:56am +03, Juri Linkov wrote:
>>> If we miss some of them out because we've since added C-x 5 5,
>>> we are asking the user to keep track of which things under C-x 4 have
>>> bindings under C-x 5 and which don't -- one has to remember that C-x 4
>>> C-j exists but C-x 5 C-j doesn't.
>>
>> I meant: one has to remember that C-x 5 p and C-x 5 d exist but
>> C-x 5 C-j doesn't.
>
> For new commands that don't have a C-x 4 binding
> it makes sense to use C-x 5 5, but if a binding
> already exists in the C-x 4 keymap, it could be synced
> with the C-x 5 keymap for consistency. And indeed
> dired-jump-other-frame is missing among existing keys:
>
> C-x 4 C-f find-file-other-window C-x 5 C-f find-file-other-frame
> C-x 4 C-j dired-jump-other-window !!!
Thank you for the analysis, I hadn't realised that C-x 5 C-j is
literally the only one that's missing!
--
Sean Whitton
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 4:57 ` Sean Whitton
2022-05-23 4:59 ` Sean Whitton
@ 2022-05-23 12:26 ` Stefan Monnier
2022-05-23 16:52 ` Juri Linkov
1 sibling, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2022-05-23 12:26 UTC (permalink / raw)
To: Sean Whitton; +Cc: Eli Zaretskii, emacs-devel
>> We have the "C-x 5 5" prefix for purposes like this one.
> It's a great fallback,
It shouldn't be a fallback. It should be "the new C-x 5" and it should
hopefully completely replace `C-x 5` at some point.
Stefan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 12:26 ` Stefan Monnier
@ 2022-05-23 16:52 ` Juri Linkov
2022-06-07 20:17 ` Howard Melman
0 siblings, 1 reply; 22+ messages in thread
From: Juri Linkov @ 2022-05-23 16:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Sean Whitton, Eli Zaretskii, emacs-devel
>>> We have the "C-x 5 5" prefix for purposes like this one.
>> It's a great fallback,
>
> It shouldn't be a fallback. It should be "the new C-x 5" and it should
> hopefully completely replace `C-x 5` at some point.
Should the prefix `C-x 5` take keys from the `C-x` keymap?
So any key in the `C-x` keymap will be automatically
available in a key sequence starting with `C-x 5`?
For example, `C-x C-d` is bound to `list-directory`,
then the inferred `C-x 5 C-d` will show the output
of `list-directory` in a new frame?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-05-23 16:52 ` Juri Linkov
@ 2022-06-07 20:17 ` Howard Melman
2022-06-08 2:29 ` Eli Zaretskii
2022-06-08 6:40 ` Juri Linkov
0 siblings, 2 replies; 22+ messages in thread
From: Howard Melman @ 2022-06-07 20:17 UTC (permalink / raw)
To: emacs-devel
Juri Linkov <juri@linkov.net> writes:
>>> We have the "C-x 5 5" prefix for purposes like this one.
>>> It's a great fallback,
>>
>> It shouldn't be a fallback. It should be "the new C-x 5" and it should
>> hopefully completely replace `C-x 5` at some point.
>
> Should the prefix `C-x 5` take keys from the `C-x` keymap?
> So any key in the `C-x` keymap will be automatically
> available in a key sequence starting with `C-x 5`?
>
> For example, `C-x C-d` is bound to `list-directory`,
> then the inferred `C-x 5 C-d` will show the output
> of `list-directory` in a new frame?
I have a question the other way. I forgot that `C-x 5 .'
exists and tried `C-x 5 5 M-.' and was surprised to find it
didn't work (it opened in the same frame as if I just did
`M-.'. Is it supposed to work or should I open a bug?
--
Howard
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-07 20:17 ` Howard Melman
@ 2022-06-08 2:29 ` Eli Zaretskii
2022-06-08 6:40 ` Juri Linkov
1 sibling, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2022-06-08 2:29 UTC (permalink / raw)
To: Howard Melman; +Cc: emacs-devel
> From: Howard Melman <hmelman@gmail.com>
> Date: Tue, 07 Jun 2022 16:17:29 -0400
>
> Juri Linkov <juri@linkov.net> writes:
>
> >>> We have the "C-x 5 5" prefix for purposes like this one.
> >>> It's a great fallback,
> >>
> >> It shouldn't be a fallback. It should be "the new C-x 5" and it should
> >> hopefully completely replace `C-x 5` at some point.
> >
> > Should the prefix `C-x 5` take keys from the `C-x` keymap?
> > So any key in the `C-x` keymap will be automatically
> > available in a key sequence starting with `C-x 5`?
> >
> > For example, `C-x C-d` is bound to `list-directory`,
> > then the inferred `C-x 5 C-d` will show the output
> > of `list-directory` in a new frame?
>
> I have a question the other way. I forgot that `C-x 5 .'
> exists and tried `C-x 5 5 M-.' and was surprised to find it
> didn't work (it opened in the same frame as if I just did
> `M-.'. Is it supposed to work or should I open a bug?
I suggest to file a bug report. If this is supposed to work the way
it does, someone will explain there why.
Thanks.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-07 20:17 ` Howard Melman
2022-06-08 2:29 ` Eli Zaretskii
@ 2022-06-08 6:40 ` Juri Linkov
2022-06-08 12:27 ` Howard Melman
1 sibling, 1 reply; 22+ messages in thread
From: Juri Linkov @ 2022-06-08 6:40 UTC (permalink / raw)
To: Howard Melman; +Cc: emacs-devel
> I have a question the other way. I forgot that `C-x 5 .'
> exists and tried `C-x 5 5 M-.' and was surprised to find it
> didn't work (it opened in the same frame as if I just did
> `M-.'. Is it supposed to work or should I open a bug?
It does the right thing after customizing
switch-to-buffer-obey-display-actions to t.
Maybe its default value should be changed to t?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-08 6:40 ` Juri Linkov
@ 2022-06-08 12:27 ` Howard Melman
2022-06-08 16:08 ` Juri Linkov
0 siblings, 1 reply; 22+ messages in thread
From: Howard Melman @ 2022-06-08 12:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Jun 8, 2022, at 2:40 AM, Juri Linkov <juri@linkov.net> wrote:
>
>> I have a question the other way. I forgot that `C-x 5 .'
>> exists and tried `C-x 5 5 M-.' and was surprised to find it
>> didn't work (it opened in the same frame as if I just did
>> `M-.'. Is it supposed to work or should I open a bug?
>
> It does the right thing after customizing
> switch-to-buffer-obey-display-actions to t.
Yes I see that too.
> Maybe its default value should be changed to t?
At least the docstring of other-frame-prefix (and friends) should
be clearer about it's effect. I don't think I'm supposed to know
which commands use switch-to-buffer internally.
If the default value isn't changed, maybe other-frame-prefix
should let bind it to t since if you're using it you presumably
want a new frame. Same for the window and tab variants.
project.el seems to do this in project--other-place-command
which the project-other-{frame,window,tab}-commands use.
Howard
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-08 12:27 ` Howard Melman
@ 2022-06-08 16:08 ` Juri Linkov
2022-06-08 19:17 ` Howard Melman
0 siblings, 1 reply; 22+ messages in thread
From: Juri Linkov @ 2022-06-08 16:08 UTC (permalink / raw)
To: Howard Melman; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
>>> I have a question the other way. I forgot that `C-x 5 .'
>>> exists and tried `C-x 5 5 M-.' and was surprised to find it
>>> didn't work (it opened in the same frame as if I just did
>>> `M-.'. Is it supposed to work or should I open a bug?
>>
>> It does the right thing after customizing
>> switch-to-buffer-obey-display-actions to t.
>
> Yes I see that too.
>
>> Maybe its default value should be changed to t?
>
> At least the docstring of other-frame-prefix (and friends) should
> be clearer about it's effect. I don't think I'm supposed to know
> which commands use switch-to-buffer internally.
Maybe more commands should use pop-to-buffer-same-window
instead of switch-to-buffer. But OTOH, too much commands
already use switch-to-buffer.
> If the default value isn't changed, maybe other-frame-prefix
> should let bind it to t since if you're using it you presumably
> want a new frame. Same for the window and tab variants.
> project.el seems to do this in project--other-place-command
> which the project-other-{frame,window,tab}-commands use.
I'm not sure if the default value can be changed,
but you are right about other-frame-prefix.
I didn't know that project--other-place-command
let binds it to t. But doing the same is not possible
in other-frame-prefix, that just sets a display action
for the next command. So a more elaborate fix is required:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: obey-display.patch --]
[-- Type: text/x-diff, Size: 1294 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index 1b8fe2b262..eba888a89d 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8931,6 +8931,7 @@ display-buffer-override-next-command
(let* ((old-window (or (minibuffer-selected-window) (selected-window)))
(new-window nil)
(minibuffer-depth (minibuffer-depth))
+ (obey-display switch-to-buffer-obey-display-actions)
(clearfun (make-symbol "clear-display-buffer-overriding-action"))
(postfun (make-symbol "post-display-buffer-override-next-command"))
(action (lambda (buffer alist)
@@ -8955,6 +8956,7 @@ display-buffer-override-next-command
(funcall post-function old-window new-window)))))
(fset clearfun
(lambda ()
+ (setq switch-to-buffer-obey-display-actions obey-display)
(setcar display-buffer-overriding-action
(delq action (car display-buffer-overriding-action)))))
(fset postfun
@@ -8971,6 +8973,7 @@ display-buffer-override-next-command
(add-hook 'post-command-hook postfun)
(when echofun
(add-hook 'prefix-command-echo-keystrokes-functions echofun))
+ (setq switch-to-buffer-obey-display-actions t)
(push action (car display-buffer-overriding-action))
exitfun))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-08 16:08 ` Juri Linkov
@ 2022-06-08 19:17 ` Howard Melman
2022-06-09 2:41 ` Howard Melman
2022-06-09 5:02 ` Eli Zaretskii
0 siblings, 2 replies; 22+ messages in thread
From: Howard Melman @ 2022-06-08 19:17 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Jun 8, 2022, at 12:08 PM, Juri Linkov <juri@linkov.net> wrote:
>
> I'm not sure if the default value can be changed,
> but you are right about other-frame-prefix.
> I didn't know that project--other-place-command
> let binds it to t. But doing the same is not possible
> in other-frame-prefix, that just sets a display action
> for the next command. So a more elaborate fix is required:
Seems to work for me. Any chance this could make it into a 28.2?
Howard
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-08 19:17 ` Howard Melman
@ 2022-06-09 2:41 ` Howard Melman
2022-06-09 6:44 ` Juri Linkov
2022-06-09 5:02 ` Eli Zaretskii
1 sibling, 1 reply; 22+ messages in thread
From: Howard Melman @ 2022-06-09 2:41 UTC (permalink / raw)
To: emacs-devel
Howard Melman <hmelman@gmail.com> writes:
> On Jun 8, 2022, at 12:08 PM, Juri Linkov <juri@linkov.net> wrote:
>>
>> I'm not sure if the default value can be changed,
>> but you are right about other-frame-prefix.
>> I didn't know that project--other-place-command
>> let binds it to t. But doing the same is not possible
>> in other-frame-prefix, that just sets a display action
>> for the next command. So a more elaborate fix is required:
>
> Seems to work for me. Any chance this could make it into a 28.2?
Also, should the equivalent be done for other-window-prefix
and other-tab-prefix?
--
Howard
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Adding missing C-x 5 C-j and C-x t C-j commands
2022-06-08 19:17 ` Howard Melman
2022-06-09 2:41 ` Howard Melman
@ 2022-06-09 5:02 ` Eli Zaretskii
2022-06-09 6:42 ` Juri Linkov
1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2022-06-09 5:02 UTC (permalink / raw)
To: Howard Melman; +Cc: juri, emacs-devel
> From: Howard Melman <hmelman@gmail.com>
> Date: Wed, 8 Jun 2022 15:17:02 -0400
> Cc: emacs-devel@gnu.org
>
> On Jun 8, 2022, at 12:08 PM, Juri Linkov <juri@linkov.net> wrote:
> >
> > I'm not sure if the default value can be changed,
> > but you are right about other-frame-prefix.
> > I didn't know that project--other-place-command
> > let binds it to t. But doing the same is not possible
> > in other-frame-prefix, that just sets a display action
> > for the next command. So a more elaborate fix is required:
>
> Seems to work for me. Any chance this could make it into a 28.2?
No, it's too late for adding such non-trivial behavior changes. We
could have unintended consequences, and we don't want to risk that on
the release branch.
Sorry.
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2022-06-09 6:44 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-22 19:53 Adding missing C-x 5 C-j and C-x t C-j commands Sean Whitton
2022-05-23 2:24 ` Eli Zaretskii
2022-05-23 4:57 ` Sean Whitton
2022-05-23 4:59 ` Sean Whitton
2022-05-23 7:56 ` Juri Linkov
2022-05-23 9:16 ` Eli Zaretskii
2022-05-23 13:54 ` Sean Whitton
2022-05-23 14:07 ` Eli Zaretskii
2022-05-23 20:52 ` Sean Whitton
2022-05-23 13:35 ` Sean Whitton
2022-05-23 12:26 ` Stefan Monnier
2022-05-23 16:52 ` Juri Linkov
2022-06-07 20:17 ` Howard Melman
2022-06-08 2:29 ` Eli Zaretskii
2022-06-08 6:40 ` Juri Linkov
2022-06-08 12:27 ` Howard Melman
2022-06-08 16:08 ` Juri Linkov
2022-06-08 19:17 ` Howard Melman
2022-06-09 2:41 ` Howard Melman
2022-06-09 6:44 ` Juri Linkov
2022-06-09 5:02 ` Eli Zaretskii
2022-06-09 6:42 ` Juri Linkov
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.