Lots o changes at work

I need to fix +circe-define-filter or something
This commit is contained in:
Case Duckworth 2022-01-11 16:01:03 -06:00
parent 1c6d042d2f
commit e4f7ed9609
7 changed files with 153 additions and 71 deletions

View File

@ -75,34 +75,32 @@ See `no-littering' for examples.")
(bottom . right))) (bottom . right)))
;;; Fonts ;;; Fonts
(progn
;; Set default faces
(let ((font-name system-default-font)
(font-size system-default-height)
(variable-font-name system-variable-pitch-font)
(variable-font-size system-variable-pitch-height))
(set-face-attribute 'default nil :family system-default-font
:height font-size :weight 'book)
(set-face-attribute 'italic nil :family font-name
:height font-size :slant 'italic)
(set-face-attribute 'variable-pitch nil :family variable-font-name
:height variable-font-size))
;; Set default faces ;; Emoji fonts
(let ((ffl (font-family-list)))
(let ((font-name system-default-font) (dolist (font '("Noto Color Emoji"
(font-size system-default-height) "Noto Emoji"
(variable-font-name system-variable-pitch-font) "Segoe UI Emoji"
(variable-font-size system-variable-pitch-height)) "Apple Color Emoji"
(set-face-attribute 'default nil :family system-default-font "FreeSans"
:height font-size :weight 'book) "FreeMono"
(set-face-attribute 'italic nil :family font-name "FreeSerif"
:height font-size :slant 'italic) "Unifont"
(set-face-attribute 'variable-pitch nil :family variable-font-name "Symbola"))
:height variable-font-size)) (when (member font ffl)
(set-fontset-font t 'symbol (font-spec :family font) nil :append)))))
;; Emoji fonts
(let ((ffl (font-family-list)))
(dolist (font '("Noto Color Emoji"
"Noto Emoji"
"Segoe UI Emoji"
"Apple Color Emoji"
"FreeSans"
"FreeMono"
"FreeSerif"
"Unifont"
"Symbola"))
(when (member font ffl)
(set-fontset-font t 'symbol (font-spec :family font) nil :append))))
;;; Packages ;;; Packages

59
init.el
View File

@ -163,7 +163,6 @@
"imgur.com" "imgur.com"
"pixelfed" "instagram.com" "bibliogram.art" "pixelfed" "instagram.com" "bibliogram.art"
"reddit.com" "teddit.net" "reddit.com" "teddit.net"
"tildes.net"
"taskiq" "taskiq"
"twitter.com" "nitter.net" "twitter.com" "nitter.net"
"streamable.com" "streamable.com"
@ -402,7 +401,12 @@
;; context-menu-region ;; context-menu-region
;; context-menu-undo ;; context-menu-undo
;; context-menu-dictionary)) ;; context-menu-dictionary))
(context-menu-mode +1))) (context-menu-mode +1))
(dolist (click '( ; Fix scrolling in the margin
wheel-down double-wheel-down triple-wheel-down
wheel-up double-wheel-up triple-wheel-up))
(global-set-key (vector 'right-margin click) 'mwheel-scroll)
(global-set-key (vector 'left-margin click) 'mwheel-scroll)))
(setup org (setup org
;; Plain org with the `setup' form for sorting, but I install with straight. ;; Plain org with the `setup' form for sorting, but I install with straight.
@ -566,9 +570,21 @@
(:option shr-width (- fill-column 5) ; pad out for wide letters (:option shr-width (- fill-column 5) ; pad out for wide letters
shr-use-fonts t)) shr-use-fonts t))
(setup tab-bar
(:require +tab-bar)
(:option tab-bar-tab-name-function '+tab-bar-tab-name-truncated-left
tab-bar-tab-name-truncated-max 20
tab-bar-tab-name-ellipsis truncate-string-ellipsis)
(tab-bar-mode +1)
(+tab-bar-misc-info-mode +1))
(setup text (setup text
(:hook #'turn-on-auto-fill)) (:hook #'turn-on-auto-fill))
(setup time
(:option display-time-format "%H:%M")
(display-time-mode +1))
(setup (:straight 0x0) (setup (:straight 0x0)
(:option 0x0-default-server 'ttm) (:option 0x0-default-server 'ttm)
(with-eval-after-load 'embark (with-eval-after-load 'embark
@ -746,7 +762,7 @@
#'+circe-F/C-mode #'+circe-F/C-mode
;; For some reason `+circe-shorten-url-mode' won't work right out of ;; For some reason `+circe-shorten-url-mode' won't work right out of
;; the gate. ;; the gate.
(lambda () (run-with-idle-timer 0.25 nil #'+circe-shorten-url-mode))) (lambda () (run-at-time 0.25 nil #'+circe-shorten-url-mode)))
(:bind "C-c C-s" #'circe-command-SLAP)) (:bind "C-c C-s" #'circe-command-SLAP))
(:with-mode lui-mode (:with-mode lui-mode
@ -774,13 +790,23 @@
(:local-set fringes-outside-margins t (:local-set fringes-outside-margins t
right-margin-width (length lui-time-stamp-format) right-margin-width (length lui-time-stamp-format)
scroll-margin 0 scroll-margin 0
scroll-step 1
word-wrap t word-wrap t
wrap-prefix (+string-repeat +circe-left-margin " ") wrap-prefix (+string-repeat +circe-left-margin " ")
line-number-mode nil line-number-mode nil
column-number-mode nil column-number-mode nil
file-percentage-mode nil file-percentage-mode nil
visual-fill-column-extra-text-width visual-fill-column-extra-text-width
(cons +circe-left-margin 0))) (cons +circe-left-margin 0))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands)
'(flat))))
(:with-mode tracking-mode
(:option tracking-position 'before-modes)
(add-to-list 'mode-line-misc-info
'(tracking-mode
tracking-mode-line-buffers)))
(with-eval-after-load 'topsy (with-eval-after-load 'topsy
(:option (append topsy-mode-functions) (:option (append topsy-mode-functions)
@ -942,6 +968,7 @@ See also `crux-reopen-as-root-mode'."
elfeed-search-trailing-width 24 elfeed-search-trailing-width 24
elfeed-search-title-min-width 24 elfeed-search-title-min-width 24
elfeed-search-title-max-width 78 elfeed-search-title-max-width 78
elfeed-search-remain-on-entry t
elfeed-show-unique-buffers t elfeed-show-unique-buffers t
elfeed-db-directory (elfeed/ "db/" t) elfeed-db-directory (elfeed/ "db/" t)
elfeed-log 'debug ; until I can figure out syncing... elfeed-log 'debug ; until I can figure out syncing...
@ -1047,7 +1074,9 @@ See also `crux-reopen-as-root-mode'."
(:option flyspell-correct--cr-key ";") (:option flyspell-correct--cr-key ";")
(:bind-into flyspell (:bind-into flyspell
"C-;" #'flyspell-correct-wrapper "C-;" #'flyspell-correct-wrapper
"<f7>" #'+flyspell-correct-buffer)) "<f7>" #'+flyspell-correct-buffer)
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'flyspell-correct-wrapper vertico-multiform-commands) nil)))
(setup (:straight-when (forge (setup (:straight-when (forge
:host github :repo "magit/forge") :host github :repo "magit/forge")
@ -1200,8 +1229,6 @@ See also `crux-reopen-as-root-mode'."
(setf (alist-get 'gfm-mode apheleia-mode-alist) 'markdownfmt)))) (setf (alist-get 'gfm-mode apheleia-mode-alist) 'markdownfmt))))
(setup (:straight minions) (setup (:straight minions)
(:option minions-prominent-modes
'(tracking-mode))
(minions-mode +1)) (minions-mode +1))
(setup (:straight (mode-line-bell (setup (:straight (mode-line-bell
@ -1428,12 +1455,17 @@ See also `crux-reopen-as-root-mode'."
(helpful-function) (helpful-function)
(helpful-macro) (helpful-macro)
(helpful-callable) (helpful-callable)
(helpful-variable)) (helpful-variable)
(completion-at-point flat)
(indent-for-tab-command flat)
(consult-buffer flat)
(insert-char))
;; This is applied /after/ the above, so default is at the end of ;; This is applied /after/ the above, so default is at the end of
;; this alist. ;; this alist.
vertico-multiform-categories '((file buffer grid) vertico-multiform-categories '((file buffer grid)
(t unobtrusive))) (t flat)))
(dolist (buf-cmd '(consult-find (dolist (buf-cmd '(consult-find
consult-yank-pop
consult-locate consult-locate
consult-grep consult-grep
consult-git-grep consult-git-grep
@ -1442,7 +1474,9 @@ See also `crux-reopen-as-root-mode'."
consult-line-multi consult-line-multi
consult-multi-occur consult-multi-occur
consult-keep-lines consult-keep-lines
consult-focus-lines)) consult-focus-lines
consult-imenu
consult-outline))
(setf (alist-get buf-cmd vertico-multiform-commands) '(buffer))) (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))
(:with-map vertico-map (:with-map vertico-map
(:bind "RET" #'vertico-directory-enter (:bind "RET" #'vertico-directory-enter
@ -1491,8 +1525,3 @@ See also `crux-reopen-as-root-mode'."
(:require +zzz-to-char) (:require +zzz-to-char)
(:option zzz-to-char-reach 1024) (:option zzz-to-char-reach 1024)
(:global "M-z" #'+zzz-to-char)) (:global "M-z" #'+zzz-to-char))
(setup tab-bar
(:require +tab-bar)
(tab-bar-mode +1)
(+tab-bar-misc-info-mode +1))

View File

@ -245,6 +245,14 @@ can easily remove elements.")
match)) match))
text))) text)))
(defun +circe-shorten-urls-all ()
"Turn on `+circe-shorten-url-mode' in all chat buffers."
(interactive)
(+mapc-some-buffers
(lambda () (+circe-shorten-url-mode +1))
(lambda (buf)
(derived-mode-p 'circe-chat-mode))))
;; Temperature conversion ;; Temperature conversion
(+circe-define-filter +circe-F/C-mode (+circe-define-filter +circe-F/C-mode
@ -261,12 +269,13 @@ can easily remove elements.")
(round (+ 32 (* (/ 9.0 5.0) degc)))) (round (+ 32 (* (/ 9.0 5.0) degc))))
(defun str-F/C (text) (defun str-F/C (text)
(replace-regexp-in-string "[0-9.]+[Ff]" (replace-regexp-in-string "[^.]\\([[:digit:]]+\\(?:\\.[[:digit:]]+\\)?[fF]\\)"
(lambda (match) (lambda (match)
(format "%s/%dC" match (format "%s/%dC" match
(fahrenheit-to-celsius (fahrenheit-to-celsius
(string-to-number match)))) (string-to-number match))))
text)) text
nil 1))
(provide '+circe) (provide '+circe)
;;; +circe.el ends here ;;; +circe.el ends here

View File

@ -183,32 +183,54 @@ The order of elements matters: whichever one matches first is applied."
"Toggle the percentage display in the mode line (File Percentage Mode)." "Toggle the percentage display in the mode line (File Percentage Mode)."
:init-value t :global t :group 'mode-line) :init-value t :global t :group 'mode-line)
(defun +modeline-position (&optional _) ; adapted from `simple-modeline' (defun +modeline-file-percentage (&optional spacer)
"Display the current cursor position." "Display the position in the current file."
`(,(or spacer +modeline-default-spacer)
(:propertize (file-percentage-mode
(" " (-3 "%p") "%%"))
font-lock-face font-lock-comment-face)))
(define-minor-mode region-indicator-mode
"Toggle the region indicator in the mode line."
:init-value t :global t :group 'mode-line)
(defun +modeline-region (&optional spacer)
"Display an indicator if the region is active."
(when (and region-indicator-mode
(region-active-p))
(list
(format "%s%6s"
(or spacer +modeline-default-spacer)
(propertize (format "%s%d"
(if (and (< (point) (mark))) "-" "+")
(apply '+ (mapcar (lambda (pos)
(- (cdr pos)
(car pos)))
(region-bounds))))
'font-lock-face 'font-lock-variable-name-face)))))
(defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline'
"Display the current cursor line and column depending on modes."
(let ((sep "|") (before " [") (after "]")) (let ((sep "|") (before " [") (after "]"))
(list `(:propertize (line-number-mode `(,(or spacer +modeline-default-spacer)
((column-number-mode (:propertize (line-number-mode
(column-number-indicator-zero-based ((column-number-mode
,(concat before "%l" sep "%c" after) (column-number-indicator-zero-based
,(concat before "%l" sep "%C" after)) ,(concat before "%l" sep "%c" after)
,(concat before "%l" sep "" after))) ,(concat before "%l" sep "%C" after))
((column-number-mode ,(concat before "%l" sep "" after)))
(column-number-indicator-zero-based ((column-number-mode
,(concat before sep "%c" after) (column-number-indicator-zero-based
,(concat before sep "%C" after))))) ,(concat before sep "%c" after)
font-lock-face font-lock-comment-face) ,(concat before sep "%C" after)))))
(if (region-active-p) font-lock-face font-lock-comment-face))))
(propertize (format "%s%-5d"
(if (and (mark) (< (point) (mark))) "-" "+") (defun +modeline-position (&optional _)
(apply '+ (mapcar "Display the current cursor position.
(lambda (pos) See `line-number-mode', `column-number-mode', `file-percentage-mode'"
(- (cdr pos) (append (+modeline-line-column)
(car pos))) (+modeline-region)
(region-bounds)))) (+modeline-file-percentage)))
'font-lock-face 'font-lock-variable-name-face))
'(:propertize (file-percentage-mode
(" " (-3 "%p") "%%"))
font-lock-face font-lock-comment-face))))
(defun +modeline-vc (&optional spacer) (defun +modeline-vc (&optional spacer)
"Display the version control branch of the current buffer in the modeline." "Display the version control branch of the current buffer in the modeline."

View File

@ -420,7 +420,8 @@ the deletion might narrow the column."
"Open thing at point, or if there isn't something, list things." "Open thing at point, or if there isn't something, list things."
(interactive "P") (interactive "P")
(save-excursion (save-excursion
(let* ((this-char-type (org-element-type (org-element-context))) (let* ((browse-url-browser-function #'browse-url-default-browser)
(this-char-type (org-element-type (org-element-context)))
(prev-char-type (ignore-errors (prev-char-type (ignore-errors
(save-excursion (save-excursion
(backward-char) (backward-char)

View File

@ -21,6 +21,26 @@
(defvar +tab-bar-show-original nil (defvar +tab-bar-show-original nil
"Original value of `tab-bar-show'.") "Original value of `tab-bar-show'.")
(defun +tab-bar-tab-name-truncated-left ()
"Generate the tab name from the buffer of the selected window.
This is just like `tab-bar-tab-name-truncated', but truncates the
name to the left."
(let* ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
(ellipsis (cond
(tab-bar-tab-name-ellipsis)
((char-displayable-p ?…) "")
("...")))
(l-ell (length ellipsis))
(l-name (length tab-name)))
(if (< (length tab-name) tab-bar-tab-name-truncated-max)
tab-name
(propertize (concat
(when (> (+ l-name l-ell) tab-bar-tab-name-truncated-max)
ellipsis)
(truncate-string-to-width tab-name l-name
(max 0 (- l-name tab-bar-tab-name-truncated-max l-ell))))
'help-echo tab-name))))
;; Emacs 27 ;; Emacs 27

View File

@ -145,7 +145,10 @@ within a `with-current-buffer' form."
(let ((pred (or predicate t))) (let ((pred (or predicate t)))
(dolist (buf (buffer-list)) (dolist (buf (buffer-list))
(with-current-buffer buf (with-current-buffer buf
(when (if (fboundp pred) (funcall pred buf) pred) (when (if (or (eq (car-safe pred) 'closure)
(fboundp pred))
(funcall pred buf)
pred)
(funcall func)))))) (funcall func))))))
;; https://github.com/cstby/emacs.d/blob/main/init.el#L67 ;; https://github.com/cstby/emacs.d/blob/main/init.el#L67