Function: majutsu-display-buffer

majutsu-display-buffer is a natively compiled function defined in majutsu-base.el.

Signature

(majutsu-display-buffer BUFFER &optional DISPLAY-FUNCTION)

Documentation

Display BUFFER in some window and maybe select it.

If optional DISPLAY-FUNCTION is non-nil, then use that to display the buffer. Otherwise use majutsu-display-buffer-function, which is the normal case.

Then, unless majutsu-display-buffer-noselect is non-nil, select the window which was used to display the buffer.

Also run the hooks majutsu-pre-display-buffer-hook and majutsu-post-display-buffer-hook.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-base.el
(defun majutsu-display-buffer (buffer &optional display-function)
  "Display BUFFER in some window and maybe select it.

If optional DISPLAY-FUNCTION is non-nil, then use that to display
the buffer.  Otherwise use `majutsu-display-buffer-function', which
is the normal case.

Then, unless `majutsu-display-buffer-noselect' is non-nil, select
the window which was used to display the buffer.

Also run the hooks `majutsu-pre-display-buffer-hook'
and `majutsu-post-display-buffer-hook'."
  (with-current-buffer buffer
    (run-hooks 'majutsu-pre-display-buffer-hook))
  (let ((window (funcall (or display-function majutsu-display-buffer-function)
                         buffer)))
    (unless majutsu-display-buffer-noselect
      (let ((old-frame (selected-frame))
            (new-frame (window-frame window)))
        (select-window window)
        (unless (eq old-frame new-frame)
          (select-frame-set-input-focus new-frame)))))
  (with-current-buffer buffer
    (run-hooks 'majutsu-post-display-buffer-hook)))