Skip to content

Commit

Permalink
Set magit-display-buffer-function
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho authored and bmag committed Feb 13, 2021
1 parent a5c66c2 commit 4772219
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion window-purpose-x.el
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,40 @@ imenu."
(magit-wazzup-mode . magit-wazzup)))
"Configuration that gives each magit major mode its own purpose.")

(defvar purpose-x-old-magit-display-buffer-function nil
"Stores `magit-display-buffer-function'.
The value of `magit-display-buffer-function' at the time
`purpose-x-magit-single-on' or `purpose-x-magit-multi-on' is
invoked.")

(defun purpose-x-magit-display-buffer-function (buffer)
"Integrate `magit' with `window-purpose'."
(let ((display-buffer-overriding-action '(purpose--action-function . nil)))
(funcall purpose-x-old-magit-display-buffer-function buffer)))

;;;###autoload
(defun purpose-x-magit-single-on ()
"Turn on magit-single purpose configuration."
(interactive)
(setq purpose-x-old-magit-display-buffer-function magit-display-buffer-function
magit-display-buffer-function 'purpose-x-magit-display-buffer-function)
(purpose-set-extension-configuration :magit purpose-x-magit-single-conf))

;;;###autoload
(defun purpose-x-magit-multi-on ()
"Turn on magit-multi purpose configuration."
(interactive)
(setq purpose-x-old-magit-display-buffer-function magit-display-buffer-function
magit-display-buffer-function 'purpose-x-magit-display-buffer-function)
(purpose-set-extension-configuration :magit purpose-x-magit-multi-conf))

(defun purpose-x-magit-off ()
"Turn off magit purpose configuration (single or multi)."
(interactive)
(purpose-del-extension-configuration :magit))
(purpose-del-extension-configuration :magit)
(setq magit-display-buffer-function purpose-x-old-magit-display-buffer-function
purpose-x-old-magit-display-buffer-function nil))

;;; --- purpose-x-magit ends here ---

Expand Down

0 comments on commit 4772219

Please sign in to comment.