From 0ff357940946def05fe9e20d4ddef4553b23f71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Tue, 1 Aug 2023 08:17:44 -0700 Subject: emacs: add new display-buffer-alist rules --- .emacs.d/rul-lisp/packages/rul-wm.el | 58 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 21 deletions(-) (limited to '.emacs.d/rul-lisp') diff --git a/.emacs.d/rul-lisp/packages/rul-wm.el b/.emacs.d/rul-lisp/packages/rul-wm.el index 7b44163..eac14e7 100644 --- a/.emacs.d/rul-lisp/packages/rul-wm.el +++ b/.emacs.d/rul-lisp/packages/rul-wm.el @@ -1,3 +1,4 @@ +;;;; window.el ;; Inspiration: https://christiantietze.de/posts/2022/12/updated-org-mode-agenda-display-buffer-alist/ (defun rul/display-buffer-org-agenda-managed-p (buffer-name action) "Determine whether BUFFER-NAME is an org-agenda managed buffer." @@ -5,36 +6,51 @@ (or (derived-mode-p 'org-mode 'org-agenda-mode) (member (buffer-file-name) (org-agenda-files))))) -(add-to-list 'display-buffer-alist - `("\\*Org Agenda\\*" - (display-buffer-in-tab ;; Make sure to use the "Org Files" tab - display-buffer-reuse-mode-window) - (ignore-current-tab . t) - (tab-name . "Org") - (dedicated . side) ;; Make the Agenda a dedicated side-window - (side . left) ;; to the left so it always stays open. - (inhibit-same-window . nil))) - -(add-to-list 'display-buffer-alist - '(rul/display-buffer-org-agenda-managed-p - (display-buffer-reuse-mode-window ;; Prioritize reuse of current window - display-buffer-in-tab) ;; over switching to the Org tab. - (tab-name . "Org"))) +(setq display-buffer-alist + '(;; Org Agenda in dedicated side-window + ("\\*Org Agenda\\*" + (display-buffer-in-tab + display-buffer-reuse-mode-window) + (ignore-current-tab . t) + (tab-name . "Org") + (dedicated . side) + (side . left) + (inhibit-same-window . nil)) + ;; Attempt window reuse for org-mode + (rul/display-buffer-org-agenda-managed-p + (display-buffer-reuse-mode-window + display-buffer-in-tab) + (tab-name . "Org")) + (;; Notmuch in dedicated tab + ".*notmuch.*" + (display-buffer-in-tab + display-buffer-reuse-mode-window) + (ignore-current-tab . t) + (tab-name . "Mail")) + (;; Notmuch in dedicated tab + ".*elfeed.*" + (display-buffer-in-tab + display-buffer-reuse-mode-window) + (ignore-current-tab . t) + (tab-name . "Elfeed")) + )) -; tab-bar configuration -(global-set-key (kbd "C-") 'tab-bar-switch-to-next-tab) -(global-set-key (kbd "C-") 'tab-bar-switch-to-prev-tab) -;(setq switch-to-buffer-obey-display-actions nil) +;;;; tab-bar.el +(let ((map global-map)) +(define-key map (kbd "C-") 'tab-bar-switch-to-next-tab) +(define-key map (kbd "C-") 'tab-bar-switch-to-prev-tab) +(define-key map (kbd "") 'tab-bar-mode)) (setq tab-bar-format '(tab-bar-format-tabs - tab-bar-format-align-right - tab-bar-format-global + ;; tab-bar-format-align-right + ;; tab-bar-format-global )) (setq tab-bar-new-tab-to 'rightmost) (setq tab-bar-close-button-show nil) (set-face-attribute 'tab-bar nil :height 0.8) (tab-bar-mode 1) + (provide 'rul-wm) -- cgit v1.2.3