diff options
author | Case Duckworth | 2022-01-16 23:13:30 -0600 |
---|---|---|
committer | Case Duckworth | 2022-01-16 23:13:30 -0600 |
commit | 596a21b6a0d665a56abe34d36cbacf10def89398 (patch) | |
tree | 6801a3ea03438420c176484cc5686dbc89dc4553 | |
parent | Dammit, lots of changes (diff) | |
parent | Un-propertize +tab-bar-misc-info (diff) | |
download | emacs-596a21b6a0d665a56abe34d36cbacf10def89398.tar.gz emacs-596a21b6a0d665a56abe34d36cbacf10def89398.zip |
Merge branch 'main' of https://tildegit.org/acdw/emacs
-rw-r--r-- | init.el | 12 | ||||
-rw-r--r-- | lisp/+orderless.el | 2 | ||||
-rw-r--r-- | lisp/+tab-bar.el | 74 |
3 files changed, 81 insertions, 7 deletions
diff --git a/init.el b/init.el index 9f4d2fe..5a9ee62 100644 --- a/init.el +++ b/init.el | |||
@@ -590,7 +590,17 @@ | |||
590 | tab-bar-tab-name-ellipsis truncate-string-ellipsis | 590 | tab-bar-tab-name-ellipsis truncate-string-ellipsis |
591 | tab-bar-show t) | 591 | tab-bar-show t) |
592 | (tab-bar-mode +1) | 592 | (tab-bar-mode +1) |
593 | (+tab-bar-misc-info-mode +1)) | 593 | (if (version< emacs-version "28.0") |
594 | (+tab-bar-misc-info-mode +1) | ||
595 | (:option tab-bar-format '(+tab-bar-format-menu-bar | ||
596 | tab-bar-format-history | ||
597 | tab-bar-format-tabs | ||
598 | tab-bar-separator | ||
599 | tab-bar-format-add-tab | ||
600 | tab-bar-format-align-right | ||
601 | +tab-bar-misc-info | ||
602 | tab-bar-separator | ||
603 | )))) | ||
594 | 604 | ||
595 | (setup text | 605 | (setup text |
596 | (:hook #'turn-on-auto-fill)) | 606 | (:hook #'turn-on-auto-fill)) |
diff --git a/lisp/+orderless.el b/lisp/+orderless.el index b2f53b0..ac8c1b4 100644 --- a/lisp/+orderless.el +++ b/lisp/+orderless.el | |||
@@ -40,7 +40,7 @@ segment to make that segment match accordingly." | |||
40 | (derived-mode-p 'eshell-mode)) | 40 | (derived-mode-p 'eshell-mode)) |
41 | ;; File extension | 41 | ;; File extension |
42 | (string-match-p "\\`\\.." pattern)) | 42 | (string-match-p "\\`\\.." pattern)) |
43 | (cons orderless-regexp | 43 | (cons 'orderless-regexp |
44 | (concat "\\." (substring pattern 1) "[\x100000-\x10FFFD]*$"))) | 44 | (concat "\\." (substring pattern 1) "[\x100000-\x10FFFD]*$"))) |
45 | ;; Ignore single ! | 45 | ;; Ignore single ! |
46 | ((string= "!" pattern) `(orderless-literal . "")) | 46 | ((string= "!" pattern) `(orderless-literal . "")) |
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 1ee7606..ffbdd70 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el | |||
@@ -9,13 +9,19 @@ | |||
9 | 9 | ||
10 | (require 'tab-bar) | 10 | (require 'tab-bar) |
11 | 11 | ||
12 | (defface +tab-bar-extra | ||
13 | '((t :inherit (tab-bar font-lock-comment-face))) | ||
14 | "Tab bar face for extra information, like the menu-bar and time." | ||
15 | :group 'basic-faces) | ||
16 | |||
12 | 17 | ||
13 | ;; Common | 18 | ;; Common |
14 | 19 | ||
15 | (defun +tab-bar-misc-info () | 20 | (defun +tab-bar-misc-info () |
16 | "Display `mode-line-misc-info', formatted for the tab-bar." | 21 | "Display `mode-line-misc-info', formatted for the tab-bar." |
17 | `((global menu-item ,(string-trim-right | 22 | `((global menu-item ,(string-trim-right |
18 | (format-mode-line mode-line-misc-info)) | 23 | (format-mode-line mode-line-misc-info)) |
24 | |||
19 | ignore))) | 25 | ignore))) |
20 | 26 | ||
21 | (defvar +tab-bar-show-original nil | 27 | (defvar +tab-bar-show-original nil |
@@ -24,10 +30,12 @@ | |||
24 | (defun +tab-bar-basename () | 30 | (defun +tab-bar-basename () |
25 | "Generate the tab name from the basename of the buffer of the | 31 | "Generate the tab name from the basename of the buffer of the |
26 | selected window." | 32 | selected window." |
27 | (let* ((tab-file-name (buffer-file-name (window-buffer (minibuffer-selected-window))))) | 33 | (let* ((tab-file-name (buffer-file-name (window-buffer |
28 | (if tab-file-name | 34 | (minibuffer-selected-window))))) |
29 | (file-name-nondirectory tab-file-name) | 35 | (concat " " |
30 | (+tab-bar-tab-name-truncated-left)))) | 36 | (if tab-file-name |
37 | (file-name-nondirectory tab-file-name) | ||
38 | (+tab-bar-tab-name-truncated-left))))) | ||
31 | 39 | ||
32 | (defun +tab-bar-tab-name-truncated-left () | 40 | (defun +tab-bar-tab-name-truncated-left () |
33 | "Generate the tab name from the buffer of the selected window. | 41 | "Generate the tab name from the buffer of the selected window. |
@@ -50,6 +58,62 @@ name to the left." | |||
50 | 'help-echo tab-name)))) | 58 | 'help-echo tab-name)))) |
51 | 59 | ||
52 | 60 | ||
61 | ;;; Menu bar | ||
62 | ;; stole from https://github.com/emacs-mirror/emacs/blob/master/lisp/tab-bar.el | ||
63 | |||
64 | (defun +tab-bar-menu-bar (event) | ||
65 | "Pop up the same menu as displayed by the menu bar. | ||
66 | Used by `tab-bar-format-menu-bar'." | ||
67 | (interactive "e") | ||
68 | (let ((menu (make-sparse-keymap (propertize "Menu Bar" 'hide t)))) | ||
69 | (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) | ||
70 | (map-keymap (lambda (key binding) | ||
71 | (when (consp binding) | ||
72 | (define-key-after menu (vector key) | ||
73 | (copy-sequence binding)))) | ||
74 | (menu-bar-keymap)) | ||
75 | (popup-menu menu event))) | ||
76 | |||
77 | (defun +tab-bar-format-menu-bar () | ||
78 | "Produce the Menu button for the tab bar that shows the menu bar." | ||
79 | `((menu-bar menu-item (propertize " Ɛ " 'face '+tab-bar-extra) | ||
80 | +tab-bar-menu-bar :help "Menu Bar"))) | ||
81 | |||
82 | |||
83 | ;;; Tab bar format tabs | ||
84 | |||
85 | (require 'el-patch) | ||
86 | |||
87 | (el-patch-defun tab-bar--format-tab (tab i) | ||
88 | (append | ||
89 | (el-patch-remove | ||
90 | `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))) | ||
91 | (cond | ||
92 | ((eq (car tab) 'current-tab) | ||
93 | `((current-tab | ||
94 | menu-item | ||
95 | ,(funcall tab-bar-tab-name-format-function tab i) | ||
96 | ignore | ||
97 | :help "Current tab"))) | ||
98 | (t | ||
99 | `((,(intern (format "tab-%i" i)) | ||
100 | menu-item | ||
101 | ,(funcall tab-bar-tab-name-format-function tab i) | ||
102 | ,(or | ||
103 | (alist-get 'binding tab) | ||
104 | `(lambda () | ||
105 | (interactive) | ||
106 | (tab-bar-select-tab ,i))) | ||
107 | :help "Click to visit tab")))) | ||
108 | `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) | ||
109 | menu-item "" | ||
110 | ,(or | ||
111 | (alist-get 'close-binding tab) | ||
112 | `(lambda () | ||
113 | (interactive) | ||
114 | (tab-bar-close-tab ,i))))))) | ||
115 | |||
116 | |||
53 | ;; Emacs 27 | 117 | ;; Emacs 27 |
54 | 118 | ||
55 | (defun +tab-bar-misc-info-27 (output &rest _) | 119 | (defun +tab-bar-misc-info-27 (output &rest _) |