|
16 | 16 | ;;
|
17 | 17 | ;;; Code:
|
18 | 18 |
|
| 19 | +(require 'consult) |
| 20 | + |
19 | 21 | (use-package tabspaces
|
20 |
| - :custom |
21 |
| - (tab-bar-show nil) |
22 |
| - (tabspaces-use-filtered-buffers-as-default t) |
23 |
| - (tabspaces-default-tab "Default") |
24 |
| - (tabspaces-remove-to-default t) |
25 |
| - (tabspaces-include-buffers '("*scratch*" "*Messages*" "*dashboard*" "*Org Agenda*")) |
26 |
| - ;; sessions |
27 |
| - (tabspaces-session t) |
28 |
| - (tabspaces-session-auto-restore t)) |
| 22 | + :functions (consult--source-workspace my--consult-tabspaces) |
| 23 | + ;;:hook (after-init . tabspaces-mode) |
| 24 | + :init |
| 25 | + (setq tab-bar-show nil |
| 26 | + tabspaces-use-filtered-buffers-as-default t |
| 27 | + tabspaces-default-tab "Home" |
| 28 | + tabspaces-remove-to-default t |
| 29 | + tabspaces-include-buffers '("*scratch*" "*Messages*" "*dashboard*" "*Org Agenda*") |
| 30 | + tabspaces-session t |
| 31 | + tabspaces-session-auto-restore t |
| 32 | + tabspaces-session-file (concat user-emacs-directory "tabspaces/tabsession.el") |
| 33 | + tabspaces-session-project-session-store (concat user-emacs-directory "tabspaces/sessions/")) |
| 34 | + :config |
| 35 | + ;; Filter Buffers for Consult-Buffer |
| 36 | + (with-eval-after-load 'consult |
| 37 | + ;; hide full buffer list (still available with "b" prefix) |
| 38 | + (consult-customize consult--source-buffer :hidden t :default nil) |
| 39 | + ;; set consult-workspace buffer list |
| 40 | + (defvar consult--source-workspace |
| 41 | + (list :name "Workspace Buffers" |
| 42 | + :narrow ?w |
| 43 | + :history 'buffer-name-history |
| 44 | + :category 'buffer |
| 45 | + :state #'consult--buffer-state |
| 46 | + :default t |
| 47 | + :items (lambda () (consult--buffer-query |
| 48 | + :predicate #'tabspaces--local-buffer-p |
| 49 | + :sort 'visibility |
| 50 | + :as #'buffer-name))) |
| 51 | + "Set workspace buffer list for consult-buffer.") |
| 52 | + (add-to-list 'consult-buffer-sources 'consult--source-workspace) |
| 53 | + |
| 54 | + (defun my--consult-tabspaces () |
| 55 | + "Deactivate isolated buffers when not using tabspaces." |
| 56 | + (require 'consult) |
| 57 | + (cond (tabspaces-mode |
| 58 | + ;; hide full buffer list (still available with "b") |
| 59 | + (consult-customize consult--source-buffer :hidden t :default nil) |
| 60 | + (add-to-list 'consult-buffer-sources 'consult--source-workspace)) |
| 61 | + (t |
| 62 | + ;; reset consult-buffer to show all buffers |
| 63 | + (consult-customize consult--source-buffer :hidden nil :default t) |
| 64 | + (setq consult-buffer-sources (remove #'consult--source-workspace consult-buffer-sources))))) |
| 65 | + (add-hook 'tabspaces-mode-hook #'my--consult-tabspaces))) |
| 66 | + |
29 | 67 |
|
30 | 68 | (provide 'init-workspace)
|
31 | 69 | ;;; init-workspace.el ends here
|
0 commit comments