* lisp/progmodes/project.el (project--other-place-prefix): New function.

(project-other-window-command, project-other-frame-command)
(project-other-tab-command): Use it in Emacs versions not less than 30
where other-*-prefix commands are available.
This fixes the cases such as 'C-u C-x 5 p p f TAB' from bug#65558.
This commit is contained in:
Juri Linkov 2023-10-19 21:50:28 +03:00
parent abbd86d90e
commit 4ace48f394

View file

@ -880,6 +880,17 @@ DIRS must contain directory names."
(call-interactively cmd)
(user-error "%s is undefined" (key-description key)))))
(defun project--other-place-prefix (place &optional extra-keymap)
(cl-assert (member place '(window frame tab)))
(prefix-command-preserve-state)
(let ((inhibit-message t)) (funcall (intern (format "other-%s-prefix" place))))
(message "Display next project command buffer in a new %s..." place)
;; Should return exitfun from set-transient-map
(set-transient-map (if extra-keymap
(make-composed-keymap project-prefix-map
extra-keymap)
project-prefix-map)))
;;;###autoload
(defun project-other-window-command ()
"Run project command, displaying resultant buffer in another window.
@ -889,9 +900,11 @@ The following commands are available:
\\{project-prefix-map}
\\{project-other-window-map}"
(interactive)
(project--other-place-command '((display-buffer-pop-up-window)
(inhibit-same-window . t))
project-other-window-map))
(if (< emacs-major-version 30)
(project--other-place-command '((display-buffer-pop-up-window)
(inhibit-same-window . t))
project-other-window-map)
(project--other-place-prefix 'window project-other-window-map)))
;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command)
@ -904,8 +917,10 @@ The following commands are available:
\\{project-prefix-map}
\\{project-other-frame-map}"
(interactive)
(project--other-place-command '((display-buffer-pop-up-frame))
project-other-frame-map))
(if (< emacs-major-version 30)
(project--other-place-command '((display-buffer-pop-up-frame))
project-other-frame-map)
(project--other-place-prefix 'frame project-other-frame-map)))
;;;###autoload (define-key ctl-x-5-map "p" #'project-other-frame-command)
@ -917,7 +932,9 @@ The following commands are available:
\\{project-prefix-map}"
(interactive)
(project--other-place-command '((display-buffer-in-new-tab))))
(if (< emacs-major-version 30)
(project--other-place-command '((display-buffer-in-new-tab)))
(project--other-place-prefix 'tab)))
;;;###autoload
(when (bound-and-true-p tab-prefix-map)