From 35fbd99419282c966fbabe49f098cdf1beef4817 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Jan 2022 15:53:44 -0600 Subject: Fix typo --- lisp/+orderless.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp') 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." (derived-mode-p 'eshell-mode)) ;; File extension (string-match-p "\\`\\.." pattern)) - (cons orderless-regexp + (cons 'orderless-regexp (concat "\\." (substring pattern 1) "[\x100000-\x10FFFD]*$"))) ;; Ignore single ! ((string= "!" pattern) `(orderless-literal . "")) -- cgit 1.4.1-21-gabe81 From 84c320cda4fd0257eb9d2e1d78ff1124a473cf69 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Jan 2022 15:54:00 -0600 Subject: Make tab bar more better --- init.el | 12 ++++++++++- lisp/+tab-bar.el | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 5 deletions(-) (limited to 'lisp') diff --git a/init.el b/init.el index 4136271..63d0f87 100644 --- a/init.el +++ b/init.el @@ -584,7 +584,17 @@ tab-bar-tab-name-ellipsis truncate-string-ellipsis tab-bar-show t) (tab-bar-mode +1) - (+tab-bar-misc-info-mode +1)) + (if (version< emacs-version "28.0") + (+tab-bar-misc-info-mode +1) + (:option tab-bar-format '(+tab-bar-format-menu-bar + tab-bar-format-history + tab-bar-format-tabs + tab-bar-separator + tab-bar-format-add-tab + tab-bar-format-align-right + +tab-bar-misc-info + tab-bar-separator + )))) (setup text (:hook #'turn-on-auto-fill)) diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 1ee7606..02f3a0d 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -24,10 +24,12 @@ (defun +tab-bar-basename () "Generate the tab name from the basename of the buffer of the selected window." - (let* ((tab-file-name (buffer-file-name (window-buffer (minibuffer-selected-window))))) - (if tab-file-name - (file-name-nondirectory tab-file-name) - (+tab-bar-tab-name-truncated-left)))) + (let* ((tab-file-name (buffer-file-name (window-buffer + (minibuffer-selected-window))))) + (concat " " + (if tab-file-name + (file-name-nondirectory tab-file-name) + (+tab-bar-tab-name-truncated-left))))) (defun +tab-bar-tab-name-truncated-left () "Generate the tab name from the buffer of the selected window. @@ -49,6 +51,62 @@ name to the left." (max 0 (- l-name tab-bar-tab-name-truncated-max l-ell)))) 'help-echo tab-name)))) + +;;; Menu bar +;; stole from https://github.com/emacs-mirror/emacs/blob/master/lisp/tab-bar.el + +(defun +tab-bar-menu-bar (event) + "Pop up the same menu as displayed by the menu bar. +Used by `tab-bar-format-menu-bar'." + (interactive "e") + (let ((menu (make-sparse-keymap (propertize "Menu Bar" 'hide t)))) + (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) + (map-keymap (lambda (key binding) + (when (consp binding) + (define-key-after menu (vector key) + (copy-sequence binding)))) + (menu-bar-keymap)) + (popup-menu menu event))) + +(defun +tab-bar-format-menu-bar () + "Produce the Menu button for the tab bar that shows the menu bar." + `((menu-bar menu-item (propertize "Ɛ " 'face 'tab-bar-tab-inactive) + +tab-bar-menu-bar :help "Menu Bar"))) + + +;;; Tab bar format tabs + +(require 'el-patch) + +(el-patch-defun tab-bar--format-tab (tab i) + (append + (el-patch-remove + `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))) + (cond + ((eq (car tab) 'current-tab) + `((current-tab + menu-item + ,(funcall tab-bar-tab-name-format-function tab i) + ignore + :help "Current tab"))) + (t + `((,(intern (format "tab-%i" i)) + menu-item + ,(funcall tab-bar-tab-name-format-function tab i) + ,(or + (alist-get 'binding tab) + `(lambda () + (interactive) + (tab-bar-select-tab ,i))) + :help "Click to visit tab")))) + `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) + menu-item "" + ,(or + (alist-get 'close-binding tab) + `(lambda () + (interactive) + (tab-bar-close-tab ,i))))))) + ;; Emacs 27 -- cgit 1.4.1-21-gabe81 From dba542cc18d9531abe3c6ce9b59d05e67aeffc2b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Jan 2022 16:19:45 -0600 Subject: Define `+tab-bar-extra' face I don't think this allows any reface-whatevers. --- lisp/+tab-bar.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lisp') diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 02f3a0d..bd5d17e 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -9,13 +9,19 @@ (require 'tab-bar) +(defface +tab-bar-extra + '((t :inherit (tab-bar font-lock-comment-face))) + "Tab bar face for extra information, like the menu-bar and time." + :group 'basic-faces) + ;; Common (defun +tab-bar-misc-info () "Display `mode-line-misc-info', formatted for the tab-bar." - `((global menu-item ,(string-trim-right - (format-mode-line mode-line-misc-info)) + `((global menu-item ,(propertize (string-trim-right + (format-mode-line mode-line-misc-info)) + 'face '+tab-bar-extra) ignore))) (defvar +tab-bar-show-original nil @@ -70,7 +76,7 @@ Used by `tab-bar-format-menu-bar'." (defun +tab-bar-format-menu-bar () "Produce the Menu button for the tab bar that shows the menu bar." - `((menu-bar menu-item (propertize "Ɛ " 'face 'tab-bar-tab-inactive) + `((menu-bar menu-item (propertize " Ɛ " 'face '+tab-bar-extra) +tab-bar-menu-bar :help "Menu Bar"))) -- cgit 1.4.1-21-gabe81 From 0a0c898a28370a0f7a95910f54a99f05a1a391c7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Jan 2022 16:31:17 -0600 Subject: Un-propertize +tab-bar-misc-info --- lisp/+tab-bar.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp') diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index bd5d17e..ffbdd70 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -19,9 +19,9 @@ (defun +tab-bar-misc-info () "Display `mode-line-misc-info', formatted for the tab-bar." - `((global menu-item ,(propertize (string-trim-right - (format-mode-line mode-line-misc-info)) - 'face '+tab-bar-extra) + `((global menu-item ,(string-trim-right + (format-mode-line mode-line-misc-info)) + ignore))) (defvar +tab-bar-show-original nil -- cgit 1.4.1-21-gabe81