about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-11 16:01:03 -0600
committerCase Duckworth2022-01-11 16:01:03 -0600
commite4f7ed9609d85f80f3f54dae7485f06a49fc4d3c (patch)
treef45f690e7c720177e359ad4a5d4f2f015f011103
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-e4f7ed9609d85f80f3f54dae7485f06a49fc4d3c.tar.gz
emacs-e4f7ed9609d85f80f3f54dae7485f06a49fc4d3c.zip
Lots o changes at work
I need to fix +circe-define-filter or something
-rw-r--r--early-init.el54
-rw-r--r--init.el59
-rw-r--r--lisp/+circe.el13
-rw-r--r--lisp/+modeline.el72
-rw-r--r--lisp/+org.el3
-rw-r--r--lisp/+tab-bar.el20
-rw-r--r--lisp/acdw.el5
7 files changed, 154 insertions, 72 deletions
diff --git a/early-init.el b/early-init.el index 2cfcb84..508336e 100644 --- a/early-init.el +++ b/early-init.el
@@ -75,34 +75,32 @@ See `no-littering' for examples.")
75 (bottom . right))) 75 (bottom . right)))
76 76
77;;; Fonts 77;;; Fonts
78 78(progn
79;; Set default faces 79 ;; Set default faces
80 80 (let ((font-name system-default-font)
81(let ((font-name system-default-font) 81 (font-size system-default-height)
82 (font-size system-default-height) 82 (variable-font-name system-variable-pitch-font)
83 (variable-font-name system-variable-pitch-font) 83 (variable-font-size system-variable-pitch-height))
84 (variable-font-size system-variable-pitch-height)) 84 (set-face-attribute 'default nil :family system-default-font
85 (set-face-attribute 'default nil :family system-default-font 85 :height font-size :weight 'book)
86 :height font-size :weight 'book) 86 (set-face-attribute 'italic nil :family font-name
87 (set-face-attribute 'italic nil :family font-name 87 :height font-size :slant 'italic)
88 :height font-size :slant 'italic) 88 (set-face-attribute 'variable-pitch nil :family variable-font-name
89 (set-face-attribute 'variable-pitch nil :family variable-font-name 89 :height variable-font-size))
90 :height variable-font-size)) 90
91 91 ;; Emoji fonts
92;; Emoji fonts 92 (let ((ffl (font-family-list)))
93 93 (dolist (font '("Noto Color Emoji"
94(let ((ffl (font-family-list))) 94 "Noto Emoji"
95 (dolist (font '("Noto Color Emoji" 95 "Segoe UI Emoji"
96 "Noto Emoji" 96 "Apple Color Emoji"
97 "Segoe UI Emoji" 97 "FreeSans"
98 "Apple Color Emoji" 98 "FreeMono"
99 "FreeSans" 99 "FreeSerif"
100 "FreeMono" 100 "Unifont"
101 "FreeSerif" 101 "Symbola"))
102 "Unifont" 102 (when (member font ffl)
103 "Symbola")) 103 (set-fontset-font t 'symbol (font-spec :family font) nil :append)))))
104 (when (member font ffl)
105 (set-fontset-font t 'symbol (font-spec :family font) nil :append))))
106 104
107;;; Packages 105;;; Packages
108 106
diff --git a/init.el b/init.el index 74d08a6..ca888da 100644 --- a/init.el +++ b/init.el
@@ -163,7 +163,6 @@
163 "imgur.com" 163 "imgur.com"
164 "pixelfed" "instagram.com" "bibliogram.art" 164 "pixelfed" "instagram.com" "bibliogram.art"
165 "reddit.com" "teddit.net" 165 "reddit.com" "teddit.net"
166 "tildes.net"
167 "taskiq" 166 "taskiq"
168 "twitter.com" "nitter.net" 167 "twitter.com" "nitter.net"
169 "streamable.com" 168 "streamable.com"
@@ -402,7 +401,12 @@
402 ;; context-menu-region 401 ;; context-menu-region
403 ;; context-menu-undo 402 ;; context-menu-undo
404 ;; context-menu-dictionary)) 403 ;; context-menu-dictionary))
405 (context-menu-mode +1))) 404 (context-menu-mode +1))
405 (dolist (click '( ; Fix scrolling in the margin
406 wheel-down double-wheel-down triple-wheel-down
407 wheel-up double-wheel-up triple-wheel-up))
408 (global-set-key (vector 'right-margin click) 'mwheel-scroll)
409 (global-set-key (vector 'left-margin click) 'mwheel-scroll)))
406 410
407(setup org 411(setup org
408 ;; Plain org with the `setup' form for sorting, but I install with straight. 412 ;; Plain org with the `setup' form for sorting, but I install with straight.
@@ -566,9 +570,21 @@
566 (:option shr-width (- fill-column 5) ; pad out for wide letters 570 (:option shr-width (- fill-column 5) ; pad out for wide letters
567 shr-use-fonts t)) 571 shr-use-fonts t))
568 572
573(setup tab-bar
574 (:require +tab-bar)
575 (:option tab-bar-tab-name-function '+tab-bar-tab-name-truncated-left
576 tab-bar-tab-name-truncated-max 20
577 tab-bar-tab-name-ellipsis truncate-string-ellipsis)
578 (tab-bar-mode +1)
579 (+tab-bar-misc-info-mode +1))
580
569(setup text 581(setup text
570 (:hook #'turn-on-auto-fill)) 582 (:hook #'turn-on-auto-fill))
571 583
584(setup time
585 (:option display-time-format "%H:%M")
586 (display-time-mode +1))
587
572(setup (:straight 0x0) 588(setup (:straight 0x0)
573 (:option 0x0-default-server 'ttm) 589 (:option 0x0-default-server 'ttm)
574 (with-eval-after-load 'embark 590 (with-eval-after-load 'embark
@@ -746,7 +762,7 @@
746 #'+circe-F/C-mode 762 #'+circe-F/C-mode
747 ;; For some reason `+circe-shorten-url-mode' won't work right out of 763 ;; For some reason `+circe-shorten-url-mode' won't work right out of
748 ;; the gate. 764 ;; the gate.
749 (lambda () (run-with-idle-timer 0.25 nil #'+circe-shorten-url-mode))) 765 (lambda () (run-at-time 0.25 nil #'+circe-shorten-url-mode)))
750 (:bind "C-c C-s" #'circe-command-SLAP)) 766 (:bind "C-c C-s" #'circe-command-SLAP))
751 767
752 (:with-mode lui-mode 768 (:with-mode lui-mode
@@ -774,13 +790,23 @@
774 (:local-set fringes-outside-margins t 790 (:local-set fringes-outside-margins t
775 right-margin-width (length lui-time-stamp-format) 791 right-margin-width (length lui-time-stamp-format)
776 scroll-margin 0 792 scroll-margin 0
793 scroll-step 1
777 word-wrap t 794 word-wrap t
778 wrap-prefix (+string-repeat +circe-left-margin " ") 795 wrap-prefix (+string-repeat +circe-left-margin " ")
779 line-number-mode nil 796 line-number-mode nil
780 column-number-mode nil 797 column-number-mode nil
781 file-percentage-mode nil 798 file-percentage-mode nil
782 visual-fill-column-extra-text-width 799 visual-fill-column-extra-text-width
783 (cons +circe-left-margin 0))) 800 (cons +circe-left-margin 0))
801 (with-eval-after-load 'vertico-multiform
802 (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands)
803 '(flat))))
804
805 (:with-mode tracking-mode
806 (:option tracking-position 'before-modes)
807 (add-to-list 'mode-line-misc-info
808 '(tracking-mode
809 tracking-mode-line-buffers)))
784 810
785 (with-eval-after-load 'topsy 811 (with-eval-after-load 'topsy
786 (:option (append topsy-mode-functions) 812 (:option (append topsy-mode-functions)
@@ -942,6 +968,7 @@ See also `crux-reopen-as-root-mode'."
942 elfeed-search-trailing-width 24 968 elfeed-search-trailing-width 24
943 elfeed-search-title-min-width 24 969 elfeed-search-title-min-width 24
944 elfeed-search-title-max-width 78 970 elfeed-search-title-max-width 78
971 elfeed-search-remain-on-entry t
945 elfeed-show-unique-buffers t 972 elfeed-show-unique-buffers t
946 elfeed-db-directory (elfeed/ "db/" t) 973 elfeed-db-directory (elfeed/ "db/" t)
947 elfeed-log 'debug ; until I can figure out syncing... 974 elfeed-log 'debug ; until I can figure out syncing...
@@ -1047,7 +1074,9 @@ See also `crux-reopen-as-root-mode'."
1047 (:option flyspell-correct--cr-key ";") 1074 (:option flyspell-correct--cr-key ";")
1048 (:bind-into flyspell 1075 (:bind-into flyspell
1049 "C-;" #'flyspell-correct-wrapper 1076 "C-;" #'flyspell-correct-wrapper
1050 "<f7>" #'+flyspell-correct-buffer)) 1077 "<f7>" #'+flyspell-correct-buffer)
1078 (with-eval-after-load 'vertico-multiform
1079 (setf (alist-get 'flyspell-correct-wrapper vertico-multiform-commands) nil)))
1051 1080
1052(setup (:straight-when (forge 1081(setup (:straight-when (forge
1053 :host github :repo "magit/forge") 1082 :host github :repo "magit/forge")
@@ -1200,8 +1229,6 @@ See also `crux-reopen-as-root-mode'."
1200 (setf (alist-get 'gfm-mode apheleia-mode-alist) 'markdownfmt)))) 1229 (setf (alist-get 'gfm-mode apheleia-mode-alist) 'markdownfmt))))
1201 1230
1202(setup (:straight minions) 1231(setup (:straight minions)
1203 (:option minions-prominent-modes
1204 '(tracking-mode))
1205 (minions-mode +1)) 1232 (minions-mode +1))
1206 1233
1207(setup (:straight (mode-line-bell 1234(setup (:straight (mode-line-bell
@@ -1428,12 +1455,17 @@ See also `crux-reopen-as-root-mode'."
1428 (helpful-function) 1455 (helpful-function)
1429 (helpful-macro) 1456 (helpful-macro)
1430 (helpful-callable) 1457 (helpful-callable)
1431 (helpful-variable)) 1458 (helpful-variable)
1459 (completion-at-point flat)
1460 (indent-for-tab-command flat)
1461 (consult-buffer flat)
1462 (insert-char))
1432 ;; This is applied /after/ the above, so default is at the end of 1463 ;; This is applied /after/ the above, so default is at the end of
1433 ;; this alist. 1464 ;; this alist.
1434 vertico-multiform-categories '((file buffer grid) 1465 vertico-multiform-categories '((file buffer grid)
1435 (t unobtrusive))) 1466 (t flat)))
1436 (dolist (buf-cmd '(consult-find 1467 (dolist (buf-cmd '(consult-find
1468 consult-yank-pop
1437 consult-locate 1469 consult-locate
1438 consult-grep 1470 consult-grep
1439 consult-git-grep 1471 consult-git-grep
@@ -1442,7 +1474,9 @@ See also `crux-reopen-as-root-mode'."
1442 consult-line-multi 1474 consult-line-multi
1443 consult-multi-occur 1475 consult-multi-occur
1444 consult-keep-lines 1476 consult-keep-lines
1445 consult-focus-lines)) 1477 consult-focus-lines
1478 consult-imenu
1479 consult-outline))
1446 (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer))) 1480 (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))
1447 (:with-map vertico-map 1481 (:with-map vertico-map
1448 (:bind "RET" #'vertico-directory-enter 1482 (:bind "RET" #'vertico-directory-enter
@@ -1491,8 +1525,3 @@ See also `crux-reopen-as-root-mode'."
1491 (:require +zzz-to-char) 1525 (:require +zzz-to-char)
1492 (:option zzz-to-char-reach 1024) 1526 (:option zzz-to-char-reach 1024)
1493 (:global "M-z" #'+zzz-to-char)) 1527 (:global "M-z" #'+zzz-to-char))
1494
1495(setup tab-bar
1496 (:require +tab-bar)
1497 (tab-bar-mode +1)
1498 (+tab-bar-misc-info-mode +1))
diff --git a/lisp/+circe.el b/lisp/+circe.el index 3d6ea60..a8db1ec 100644 --- a/lisp/+circe.el +++ b/lisp/+circe.el
@@ -245,6 +245,14 @@ can easily remove elements.")
245 match)) 245 match))
246 text))) 246 text)))
247 247
248(defun +circe-shorten-urls-all ()
249 "Turn on `+circe-shorten-url-mode' in all chat buffers."
250 (interactive)
251 (+mapc-some-buffers
252 (lambda () (+circe-shorten-url-mode +1))
253 (lambda (buf)
254 (derived-mode-p 'circe-chat-mode))))
255
248;; Temperature conversion 256;; Temperature conversion
249 257
250(+circe-define-filter +circe-F/C-mode 258(+circe-define-filter +circe-F/C-mode
@@ -261,12 +269,13 @@ can easily remove elements.")
261 (round (+ 32 (* (/ 9.0 5.0) degc)))) 269 (round (+ 32 (* (/ 9.0 5.0) degc))))
262 270
263(defun str-F/C (text) 271(defun str-F/C (text)
264 (replace-regexp-in-string "[0-9.]+[Ff]" 272 (replace-regexp-in-string "[^.]\\([[:digit:]]+\\(?:\\.[[:digit:]]+\\)?[fF]\\)"
265 (lambda (match) 273 (lambda (match)
266 (format "%s/%dC" match 274 (format "%s/%dC" match
267 (fahrenheit-to-celsius 275 (fahrenheit-to-celsius
268 (string-to-number match)))) 276 (string-to-number match))))
269 text)) 277 text
278 nil 1))
270 279
271(provide '+circe) 280(provide '+circe)
272;;; +circe.el ends here 281;;; +circe.el ends here
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 3f25a40..10bf6d2 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el
@@ -183,32 +183,54 @@ The order of elements matters: whichever one matches first is applied."
183 "Toggle the percentage display in the mode line (File Percentage Mode)." 183 "Toggle the percentage display in the mode line (File Percentage Mode)."
184 :init-value t :global t :group 'mode-line) 184 :init-value t :global t :group 'mode-line)
185 185
186(defun +modeline-position (&optional _) ; adapted from `simple-modeline' 186(defun +modeline-file-percentage (&optional spacer)
187 "Display the current cursor position." 187 "Display the position in the current file."
188 `(,(or spacer +modeline-default-spacer)
189 (:propertize (file-percentage-mode
190 (" " (-3 "%p") "%%"))
191 font-lock-face font-lock-comment-face)))
192
193(define-minor-mode region-indicator-mode
194 "Toggle the region indicator in the mode line."
195 :init-value t :global t :group 'mode-line)
196
197(defun +modeline-region (&optional spacer)
198 "Display an indicator if the region is active."
199 (when (and region-indicator-mode
200 (region-active-p))
201 (list
202 (format "%s%6s"
203 (or spacer +modeline-default-spacer)
204 (propertize (format "%s%d"
205 (if (and (< (point) (mark))) "-" "+")
206 (apply '+ (mapcar (lambda (pos)
207 (- (cdr pos)
208 (car pos)))
209 (region-bounds))))
210 'font-lock-face 'font-lock-variable-name-face)))))
211
212(defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline'
213 "Display the current cursor line and column depending on modes."
188 (let ((sep "|") (before " [") (after "]")) 214 (let ((sep "|") (before " [") (after "]"))
189 (list `(:propertize (line-number-mode 215 `(,(or spacer +modeline-default-spacer)
190 ((column-number-mode 216 (:propertize (line-number-mode
191 (column-number-indicator-zero-based 217 ((column-number-mode
192 ,(concat before "%l" sep "%c" after) 218 (column-number-indicator-zero-based
193 ,(concat before "%l" sep "%C" after)) 219 ,(concat before "%l" sep "%c" after)
194 ,(concat before "%l" sep "" after))) 220 ,(concat before "%l" sep "%C" after))
195 ((column-number-mode 221 ,(concat before "%l" sep "" after)))
196 (column-number-indicator-zero-based 222 ((column-number-mode
197 ,(concat before sep "%c" after) 223 (column-number-indicator-zero-based
198 ,(concat before sep "%C" after))))) 224 ,(concat before sep "%c" after)
199 font-lock-face font-lock-comment-face) 225 ,(concat before sep "%C" after)))))
200 (if (region-active-p) 226 font-lock-face font-lock-comment-face))))
201 (propertize (format "%s%-5d" 227
202 (if (and (mark) (< (point) (mark))) "-" "+") 228(defun +modeline-position (&optional _)
203 (apply '+ (mapcar 229 "Display the current cursor position.
204 (lambda (pos) 230See `line-number-mode', `column-number-mode', `file-percentage-mode'"
205 (- (cdr pos) 231 (append (+modeline-line-column)
206 (car pos))) 232 (+modeline-region)
207 (region-bounds)))) 233 (+modeline-file-percentage)))
208 'font-lock-face 'font-lock-variable-name-face))
209 '(:propertize (file-percentage-mode
210 (" " (-3 "%p") "%%"))
211 font-lock-face font-lock-comment-face))))
212 234
213(defun +modeline-vc (&optional spacer) 235(defun +modeline-vc (&optional spacer)
214 "Display the version control branch of the current buffer in the modeline." 236 "Display the version control branch of the current buffer in the modeline."
diff --git a/lisp/+org.el b/lisp/+org.el index 348ba6e..95a3da2 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -420,7 +420,8 @@ the deletion might narrow the column."
420 "Open thing at point, or if there isn't something, list things." 420 "Open thing at point, or if there isn't something, list things."
421 (interactive "P") 421 (interactive "P")
422 (save-excursion 422 (save-excursion
423 (let* ((this-char-type (org-element-type (org-element-context))) 423 (let* ((browse-url-browser-function #'browse-url-default-browser)
424 (this-char-type (org-element-type (org-element-context)))
424 (prev-char-type (ignore-errors 425 (prev-char-type (ignore-errors
425 (save-excursion 426 (save-excursion
426 (backward-char) 427 (backward-char)
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 2a03121..1dc1f68 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -21,6 +21,26 @@
21(defvar +tab-bar-show-original nil 21(defvar +tab-bar-show-original nil
22 "Original value of `tab-bar-show'.") 22 "Original value of `tab-bar-show'.")
23 23
24(defun +tab-bar-tab-name-truncated-left ()
25 "Generate the tab name from the buffer of the selected window.
26This is just like `tab-bar-tab-name-truncated', but truncates the
27name to the left."
28 (let* ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
29 (ellipsis (cond
30 (tab-bar-tab-name-ellipsis)
31 ((char-displayable-p ?…) "…")
32 ("...")))
33 (l-ell (length ellipsis))
34 (l-name (length tab-name)))
35 (if (< (length tab-name) tab-bar-tab-name-truncated-max)
36 tab-name
37 (propertize (concat
38 (when (> (+ l-name l-ell) tab-bar-tab-name-truncated-max)
39 ellipsis)
40 (truncate-string-to-width tab-name l-name
41 (max 0 (- l-name tab-bar-tab-name-truncated-max l-ell))))
42 'help-echo tab-name))))
43
24 44
25;; Emacs 27 45;; Emacs 27
26 46
diff --git a/lisp/acdw.el b/lisp/acdw.el index 603f46f..7cad67c 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -145,7 +145,10 @@ within a `with-current-buffer' form."
145 (let ((pred (or predicate t))) 145 (let ((pred (or predicate t)))
146 (dolist (buf (buffer-list)) 146 (dolist (buf (buffer-list))
147 (with-current-buffer buf 147 (with-current-buffer buf
148 (when (if (fboundp pred) (funcall pred buf) pred) 148 (when (if (or (eq (car-safe pred) 'closure)
149 (fboundp pred))
150 (funcall pred buf)
151 pred)
149 (funcall func)))))) 152 (funcall func))))))
150 153
151;; https://github.com/cstby/emacs.d/blob/main/init.el#L67 154;; https://github.com/cstby/emacs.d/blob/main/init.el#L67