Closed bennofs closed 7 years ago
Only windows can be dedicated to purposes, buffers can't be dedicated to purposes. A buffer's purpose depends on its name and major-mode, and a window's purpose depends on the buffer it displays.
There isn't a simple setting to dedicate a window to a purpose, but in most cases you can use the hook purpose-display-buffer-functions
. For example:
(defun dedicate-if-terminal (window)
(when (eq (purpose-window-purpose window) 'terminal)
(purpose-set-window-purpose-dedicated-p window t)))
(add-hook 'purpose-display-buffer-functions #'dedicate-if-terminal)
Note that this hook is only called when a buffer is displayed via display-buffer
(or a function that calls it), and only if Purpose isn't configured to ignore the buffer (see purpose-action-function-ignore-buffer-names
for details). I wrote "only", but it actually covers most cases.
Is there a setting to automatically dedicate-to-purpose any buffers if they get a certain purpose? For example, I'd like my
terminal
buffers to be automatically dedicated.