diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index b9ecb770e60..508ade2e0c7 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -880,6 +880,17 @@ project--other-place-command (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,10 +900,13 @@ project-other-window-command \\{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))) +;; TODO: maybe rename to project-other-window-prefix ;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command) ;;;###autoload @@ -904,8 +918,10 @@ project-other-frame-command \\{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 +933,9 @@ project-other-tab-command \\{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)