summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-05-25 22:07:33 -0500
committerCase Duckworth2022-05-25 22:07:33 -0500
commit3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09 (patch)
treef7855986b30c5bc6e016fbfb67199d8abdd2cd0b /lisp
parentmeh (diff)
downloademacs-3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09.tar.gz
emacs-3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09.zip
i'm doing a terrible job
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+avy.el2
-rw-r--r--lisp/+modeline.el12
-rw-r--r--lisp/+tab-bar.el16
3 files changed, 22 insertions, 8 deletions
diff --git a/lisp/+avy.el b/lisp/+avy.el index 0606405..8056f00 100644 --- a/lisp/+avy.el +++ b/lisp/+avy.el
@@ -62,7 +62,7 @@
62 (setq buffer-face-mode-face +avy-buffer-face-mode-face) 62 (setq buffer-face-mode-face +avy-buffer-face-mode-face)
63 (buffer-face-mode +1))) 63 (buffer-face-mode +1)))
64 64
65(define-minor-mode +avy-buffer-face-local-mode 65(define-minor-mode +avy-buffer-face-mode
66 "Turn off `buffer-face-mode' before doing Avy selections. 66 "Turn off `buffer-face-mode' before doing Avy selections.
67Restore the mode after the selection." 67Restore the mode after the selection."
68 :lighter "" 68 :lighter ""
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 2c9bbee..33d34c3 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el
@@ -138,6 +138,9 @@ in the cdr will be applied to the major-mode in the mode line."
138 :type '(alist :key-type function 138 :type '(alist :key-type function
139 :value-type face)) 139 :value-type face))
140 140
141(defface +modeline-major-mode-face nil
142 "Face for modeline major-mode.")
143
141(defun +modeline-major-mode (&optional spacer) 144(defun +modeline-major-mode (&optional spacer)
142 "Display the current `major-mode'." 145 "Display the current `major-mode'."
143 (+modeline-spacer nil spacer 146 (+modeline-spacer nil spacer
@@ -149,10 +152,11 @@ in the cdr will be applied to the major-mode in the mode line."
149 ;; simply detect which mode it's in when I change major 152 ;; simply detect which mode it's in when I change major
150 ;; modes (`change-major-mode-hook') and change the face 153 ;; modes (`change-major-mode-hook') and change the face
151 ;; there, probably. 154 ;; there, probably.
152 (catch :done (dolist (cel +modeline-major-mode-faces) 155 ;; (catch :done (dolist (cel +modeline-major-mode-faces)
153 (when (derived-mode-p (car cel)) 156 ;; (when (derived-mode-p (car cel))
154 (throw :done (cdr cel)))) 157 ;; (throw :done (cdr cel))))
155 (alist-get t +modeline-major-mode-faces))) 158 ;; (alist-get t +modeline-major-mode-faces))
159 '+modeline-major-mode-face)
156 'keymap (let ((map (make-sparse-keymap))) 160 'keymap (let ((map (make-sparse-keymap)))
157 (bindings--define-key map [mode-line down-mouse-1] 161 (bindings--define-key map [mode-line down-mouse-1]
158 `(menu-item "Menu Bar" ignore 162 `(menu-item "Menu Bar" ignore
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 95f657d..e9daaf4 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -17,6 +17,10 @@
17 17
18;; Common 18;; Common
19 19
20(defun +tab-bar-space (&optional n)
21 "Display a space N characters long, or 1."
22 `((space menu-item ,(+string-repeat (or n 1) " ") ignore)))
23
20(defun +tab-bar-misc-info () 24(defun +tab-bar-misc-info ()
21 "Display `mode-line-misc-info', formatted for the tab-bar." 25 "Display `mode-line-misc-info', formatted for the tab-bar."
22 `((misc-info menu-item ,(string-trim-right 26 `((misc-info menu-item ,(string-trim-right
@@ -66,7 +70,7 @@
66 "Display `display-time-string' in the tab-bar." 70 "Display `display-time-string' in the tab-bar."
67 (when display-time-mode 71 (when display-time-mode
68 `((date-time-string menu-item 72 `((date-time-string menu-item
69 ,(propertize (concat " " display-time-string)) 73 ,(substring-no-properties (concat " " (string-trim display-time-string)))
70 (lambda (ev) 74 (lambda (ev)
71 (interactive "e") 75 (interactive "e")
72 (popup-menu 76 (popup-menu
@@ -257,8 +261,14 @@ name to the left."
257 (require 'shr) ; `shr-string-pixel-width' 261 (require 'shr) ; `shr-string-pixel-width'
258 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) 262 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format)))
259 (rest (tab-bar-format-list rest)) 263 (rest (tab-bar-format-list rest))
260 (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) 264 (rest (mapconcat (lambda (item) x(nth 2 item)) rest ""))
261 (hpos (shr-string-pixel-width rest)) 265 (hpos
266 ;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face
267 ;; into account.
268 (let ((pt (point)))
269 (prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar))
270 (shr-pixel-column))
271 (goto-char pt))))
262 (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) 272 (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
263 `((align-right menu-item ,str ignore)))) 273 `((align-right menu-item ,str ignore))))
264 274