diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7a0bf1fdbf..2cad66e705 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -592,29 +592,12 @@ project-prefix-map ;;;###autoload (define-key ctl-x-map "p" project-prefix-map) -;; We can't have these place-specific maps inherit from -;; project-prefix-map because project--other-place-command needs to -;; know which map the key binding came from, as if it came from one of -;; these maps, we don't want to set display-buffer-overriding-action - -(defvar project-other-window-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-o" #'project-display-buffer) - map) - "Keymap for project commands that display buffers in other windows.") - -(defvar project-other-frame-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-o" #'project-display-buffer-other-frame) - map) - "Keymap for project commands that display buffers in other frames.") - -(defun project--other-place-command (action &optional map) +(defun project--other-place-command (action) (let* ((key (read-key-sequence-vector nil t)) - (place-cmd (lookup-key map key)) - (generic-cmd (lookup-key project-prefix-map key)) - (display-buffer-overriding-action (unless place-cmd action))) - (if-let ((cmd (or place-cmd generic-cmd))) + (cmd (lookup-key project-prefix-map key)) + (display-buffer-overriding-action action) + (switch-to-buffer-obey-display-actions t)) + (if cmd (call-interactively cmd) (user-error "%s is undefined" (key-description key))))) @@ -628,8 +611,7 @@ project-other-window-command \\{project-other-window-map}" (interactive) (project--other-place-command '((display-buffer-pop-up-window) - (inhibit-same-window . t)) - project-other-window-map)) + (inhibit-same-window . t)))) ;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command) @@ -642,8 +624,7 @@ 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)) + (project--other-place-command '((display-buffer-pop-up-frame)))) ;;;###autoload (define-key ctl-x-5-map "p" #'project-other-frame-command) @@ -971,31 +952,7 @@ project-switch-to-buffer project instances, as reported by `project-current' in each buffer, are identical." (interactive (list (project--read-project-buffer))) - (switch-to-buffer buffer)) - -;;;###autoload -(defun project-display-buffer (buffer-or-name) - "Display BUFFER-OR-NAME in some window, without selecting it. -When called interactively, prompts for a buffer belonging to the -current project. Two buffers belong to the same project if their -project instances, as reported by `project-current' in each -buffer, are identical." - (interactive (list (project--read-project-buffer))) - (display-buffer buffer)) - -;;;###autoload -(defun project-display-buffer-other-frame (buffer-or-name) - "Display BUFFER-OR-NAME preferably in another frame. -When called interactively, prompts for a buffer belonging to the -current project. Two buffers belong to the same project if their -project instances, as reported by `project-current' in each -buffer, are identical. - -This function uses `display-buffer-other-frame' as a subroutine, -which see for how it is determined where the buffer will be -displayed." - (interactive (list (project--read-project-buffer))) - (display-buffer-other-frame buffer)) + (switch-to-buffer buffer-or-name)) (defcustom project-kill-buffers-ignores '("\\*Help\\*")