summaryrefslogtreecommitdiff
path: root/.config/emacs/init.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/init.el')
-rw-r--r--.config/emacs/init.el99
1 files changed, 36 insertions, 63 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 6a079ab..417859e 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -49,15 +49,6 @@
(global-set-key (kbd "C-x C-b") 'ibuffer)
-(when (< emacs-major-version 28)
- (defun my/other-window (count &optional all-frames)
- (interactive "p")
- (let ((repeat-map (make-sparse-keymap)))
- (define-key repeat-map [?o] #'other-window)
- (set-transient-map repeat-map t)
- (other-window count all-frames)))
- (global-set-key (kbd "C-x o") #'my/other-window))
-
;; Hopefully these will be easier to remember than TeX commands:
(quail-define-package
@@ -359,17 +350,10 @@ list and require no escaping."
;;; Lighters.
-(defun my/symbol-as-icon (c)
- ;; By default, Emacs 28 uses color fonts for characters from (1) the
+(defun my/symbol-as-emoji (c)
+ ;; By default, Emacs uses color fonts for characters from (1) the
;; 'emoji script (2) the 'symbol script, when followed by VS-16.
- ;; Meanwhile, Emacs 27 knows how to display color fonts, but (1) it
- ;; has no 'emoji script (2) it doesn't know what to do with VS-16.
- ;; Bottomline: on Emacs 28, explicitly ask for the emoji
- ;; presentation with VS-16; on older emacsen, just use the
- ;; character, and rely on a blanket fontset rule to prefer color
- ;; fonts for the whole 'symbol script.
- (apply 'string `(,c ,@(when (>= emacs-major-version 28)
- '(?\N{VARIATION SELECTOR-16})))))
+ (string c ?\N{VARIATION SELECTOR-16}))
;; So long, Will Mengarini.
(delight 'abbrev-mode nil 'abbrev)
@@ -377,7 +361,7 @@ list and require no escaping."
(delight 'auto-revert-mode "⟳" 'autorevert)
(delight 'auto-revert-tail-mode "–" 'autorevert)
(delight 'footnote-mode "ΒΉ" 'footnote)
-(delight 'flyspell-mode (propertize (my/symbol-as-icon ?πŸ–‹)
+(delight 'flyspell-mode (propertize (my/symbol-as-emoji ?πŸ–‹)
'face 'flyspell-incorrect)
'flyspell)
(delight 'hi-lock-mode nil 'hi-lock)
@@ -392,21 +376,17 @@ list and require no escaping."
(delight 'with-editor-mode "⸎" 'with-editor)
;; TODO: Narrow (βŒ–, β›Ά)
-(if (< emacs-major-version 27)
- (delight 'compilation-in-progress
- (propertize "βš™" 'face 'compilation-mode-line-run)
- 'compile)
- (let* ((indicator (alist-get 'compilation-in-progress mode-line-modes))
- (old-props (text-properties-at 0 (car indicator)))
- (face '(:inverse-video t :inherit compilation-mode-line-run))
- (new-props (append `(face ,face) old-props))
- (icon (my/symbol-as-icon ?βš™)))
- (setcar indicator (concat (apply #'propertize icon new-props) " "))))
+(let* ((indicator (alist-get 'compilation-in-progress mode-line-modes))
+ (old-props (text-properties-at 0 (car indicator)))
+ (face '(:inverse-video t :inherit compilation-mode-line-run))
+ (new-props (append `(face ,face) old-props))
+ (icon (my/symbol-as-emoji ?βš™)))
+ (setcar indicator (concat (apply #'propertize icon new-props) " ")))
(setq eglot-menu-string "🦻")
(with-eval-after-load 'flymake
- (let ((indicator (propertize (my/symbol-as-icon ?βš’) 'face 'flymake-error)))
+ (let ((indicator (propertize (my/symbol-as-emoji ?βš’) 'face 'flymake-error)))
;; Prefer customizing the string instead delight'ing, as flymake
;; slaps a bunch of helpful properties on top of the lighter,
;; which delight would strip.
@@ -551,25 +531,27 @@ UPSTREAMS is a list of fetch URLs."
;;;; French quick toggle.
(defun my/froggify ()
(ispell-change-dictionary "fr")
- (setq-local colon-double-space nil)
- (setq-local sentence-end-double-space nil)
- (setq-local fill-nobreak-predicate
- (cons 'fill-french-nobreak-p fill-nobreak-predicate))
- (setq-local my/froggified t))
+ (setq-local
+ colon-double-space nil
+ sentence-end-double-space nil
+ fill-nobreak-predicate (cons 'fill-french-nobreak-p fill-nobreak-predicate)))
(defun my/unfroggify ()
(ispell-change-dictionary "default")
- (setq-local colon-double-space t)
- (setq-local sentence-end-double-space t)
- (setq-local fill-nobreak-predicate
- (remq 'fill-french-nobreak-p fill-nobreak-predicate))
- (setq-local my/froggified nil))
+ (setq-local
+ colon-double-space t
+ sentence-end-double-space t
+ fill-nobreak-predicate (remq 'fill-french-nobreak-p fill-nobreak-predicate)))
-(defun my/croak ()
- (interactive)
- (if (and (boundp 'my/froggified) my/froggified)
- (my/unfroggify)
- (my/froggify)))
+(define-minor-mode my/frog-mode
+ "Croak like a froggy."
+ :init-value nil
+ :lighter "🐸"
+ (if my/frog-mode
+ (my/froggify)
+ (my/unfroggify)))
+
+(defalias 'my/croak 'my/frog-mode)
;;;; Mailing lists utilities.
(defun my/kill-message-id ()
@@ -588,10 +570,9 @@ UPSTREAMS is a list of fetch URLs."
(interactive
(list
(read-string "List: ") ; TODO: default to current list.
- (let ((default-id
- (mail-header-message-id (gnus-summary-article-header))))
- (read-string (format-prompt "Message-ID" default-id)
- nil nil default-id))))
+ (let ((default-id (mail-header-message-id
+ (gnus-summary-article-header))))
+ (my/read "Message-ID" default-id))))
(with-current-buffer
(url-retrieve-synchronously
(concat
@@ -623,16 +604,8 @@ UPSTREAMS is a list of fetch URLs."
(let ((id (xml-substitute-numeric-entities (match-string 1))))
(my/describe-message id url))))
-;;;; Font stuff 🀷🀦.
-(when (= emacs-major-version 27)
- ;; Emacs 27 added support for color fonts, but the default fontset
- ;; did not use any such font for emoji.
- (set-fontset-font t 'symbol "Noto Color Emoji" nil 'prepend)
- ;; Make sure the default font does not get overzealous: βš βš™.
- ;; For Emacs 28, prefer VS-16: βš οΈβš™οΈ.
- (setq use-default-font-for-symbols nil))
-
;;;; Frame title.
+
(defun my/project-root ()
(and-let* ((project (project-current)))
(project-root project)))
@@ -756,10 +729,10 @@ UPSTREAMS is a list of fetch URLs."
rg
rust-mode
wgrep)
- (when (< emacs-major-version 29)
- '(eglot use-package))
- (when (< emacs-major-version 30)
- '(which-key))))
+ (and (< emacs-major-version 29)
+ '(eglot use-package))
+ (and (< emacs-major-version 30)
+ '(which-key))))
:config
(my/setopt-update-list
package-archives '(("melpa" . "https://melpa.org/packages/"))))