diff options
| author | jao <jao@gnu.org> | 2026-08-25 21:11:27 +0100 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-08-25 21:11:27 +0100 |
| commit | ca31697cc95491c19ff257c29bdab3b88d043b09 (patch) | |
| tree | bc14b9744c783dd1121b36ffadf21e3d7dc0bb7a /custom | |
| parent | dba7a443d0edb88869c4df70622543a465cf9304 (diff) | |
| download | elibs-ca31697cc95491c19ff257c29bdab3b88d043b09.tar.gz elibs-ca31697cc95491c19ff257c29bdab3b88d043b09.tar.bz2 | |
emacs 31main
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/jao-custom-blog.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-completion.el | 22 | ||||
| -rw-r--r-- | custom/jao-custom-email.el | 6 | ||||
| -rw-r--r-- | custom/jao-custom-eww.el | 10 | ||||
| -rw-r--r-- | custom/jao-custom-exwm.el | 24 | ||||
| -rw-r--r-- | custom/jao-custom-notmuch.el | 30 | ||||
| -rw-r--r-- | custom/jao-custom-org.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-programming.el | 3 | ||||
| -rw-r--r-- | custom/jao-custom-w3m.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-x11.el | 10 |
10 files changed, 53 insertions, 58 deletions
diff --git a/custom/jao-custom-blog.el b/custom/jao-custom-blog.el index 7515440..c404d79 100644 --- a/custom/jao-custom-blog.el +++ b/custom/jao-custom-blog.el @@ -169,7 +169,7 @@ (to (expand-file-name (file-name-nondirectory from) org-static-blog-posts-directory))) (rename-file from to) - (when-let ((b (get-buffer from))) + (when-let* ((b (get-buffer from))) (kill-buffer b)) (find-file to) (jao-org-static-blog-update-date) diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 629ed53..6317165 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -186,9 +186,9 @@ (defvar jao-consult-narrow nil) (defun jao-consult-initial-narrow () - (when-let (c (cond ((eq this-command #'consult-buffer) - (cdr (assoc (jao-afio-frame-name) jao-consult-narrow))) - ((eq this-command #'consult-mode-command) ?m))) + (when-let* ((c (cond ((eq this-command #'consult-buffer) + (cdr (assoc (jao-afio-frame-name) jao-consult-narrow))) + ((eq this-command #'consult-mode-command) ?m)))) (setq unread-command-events (append unread-command-events `(,c 32))))) (add-hook 'minibuffer-setup-hook #'jao-consult-initial-narrow) @@ -301,12 +301,12 @@ (defun jao-embark-targets--w3m-anchor () (when (not (region-active-p)) - (when-let ((url (or (jao-url-around-point) - (thing-at-point 'url) - (and (derived-mode-p 'w3m-mode) - (or (w3m-anchor) w3m-current-url)) - (and (derived-mode-p 'eww-mode) - (eww-current-url))))) + (when-let* ((url (or (jao-url-around-point) + (thing-at-point 'url) + (and (derived-mode-p 'w3m-mode) + (or (w3m-anchor) w3m-current-url)) + (and (derived-mode-p 'eww-mode) + (eww-current-url))))) (when (string-match-p "^https?.*" url) (cons 'url url))))) @@ -406,12 +406,12 @@ (with-eval-after-load "notmuch" (defun jao-link-hint--notmuch-next-part (&optional bound) - (when-let (p (next-single-property-change (point) :notmuch-part nil bound)) + (when-let* ((p (next-single-property-change (point) :notmuch-part nil bound))) (and (< p (or bound (point-max))) p))) (defun jao-link-hint--notmuch-part-p () (and (get-text-property (point) :notmuch-part) - (when-let (b (button-at (point))) (button-label b)))) + (when-let* ((b (button-at (point)))) (button-label b)))) (link-hint-define-type 'notmuch-part :next #'jao-link-hint--notmuch-next-part diff --git a/custom/jao-custom-email.el b/custom/jao-custom-email.el index d7dfafb..e92a17b 100644 --- a/custom/jao-custom-email.el +++ b/custom/jao-custom-email.el @@ -65,8 +65,8 @@ (defun jao-message-insert-bcc () (when jao-notmuch-enabled (let ((f (or (message-fetch-field "From") ""))) - (when-let (b (seq-some (lambda (x) (when (string-match-p (car x) f) (cdr x))) - jao-message--bcc-alist)) + (when-let* ((b (seq-some (lambda (x) (when (string-match-p (car x) f) (cdr x))) + jao-message--bcc-alist))) (insert "Bcc: " b "\n"))))) ;; (when jao-notmuch-enabled @@ -166,7 +166,7 @@ (save-excursion (save-restriction (message-narrow-to-headers) - (when-let ((to (message-fetch-field "To"))) + (when-let* ((to (message-fetch-field "To"))) (when (string-match-p jao-mails-regexp to) (unless (y-or-n-p "Message is addressed to yourself. Continue?") (error "Message not sent"))))))) diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index 6f64cd3..a71d704 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -37,7 +37,7 @@ ;;; opening URLs (defun jao-eww-copy-link () (interactive) - (when-let (lnk (or (car (eww-links-at-point)) (eww-current-url))) + (when-let* ((lnk (or (car (eww-links-at-point)) (eww-current-url)))) (message "%s" lnk) (kill-new lnk))) @@ -88,7 +88,7 @@ ;;; images (defun jao-eww-next-image () (interactive nil eww-mode) - (when-let (p (text-property-search-forward 'image-displayer nil nil t)) + (when-let* ((p (text-property-search-forward 'image-displayer nil nil t))) (goto-char (prop-match-beginning p)))) ;;; close page and reopen @@ -96,7 +96,7 @@ (defun jao-eww-close () (interactive nil eww-mode) - (when-let (current (eww-current-url)) + (when-let* ((current (eww-current-url))) (add-to-list 'jao-eww--closed-urls current)) (let ((nxt (car (jao-eww-session-invisible-buffers)))) (kill-current-buffer) @@ -198,8 +198,8 @@ (with-eval-after-load "org" (require 'ol-eww nil t)) (defun jao-eww-buffer-name () - (when-let ((s (or (plist-get eww-data :title) - (plist-get eww-data :url)))) + (when-let* ((s (or (plist-get eww-data :title) + (plist-get eww-data :url)))) (when (not (string-blank-p s)) (format "%s" s)))) (setq eww-auto-rename-buffer #'jao-eww-buffer-name) diff --git a/custom/jao-custom-exwm.el b/custom/jao-custom-exwm.el index 5e4a354..3494044 100644 --- a/custom/jao-custom-exwm.el +++ b/custom/jao-custom-exwm.el @@ -185,7 +185,7 @@ (when cln (if (jao-exwm--check-name cln) (current-buffer) - (when-let ((b (jao-exwm-find-class-buffer cln))) + (when-let* ((b (jao-exwm-find-class-buffer cln))) (pop-to-buffer b))))) (defun jao-exwm-switch-to-next-class () @@ -343,21 +343,21 @@ (defun jao-exwm-zathura-goto-org (&optional arg) (interactive "P") - (when-let ((info (jao-zathura--file-info (current-buffer)))) - (when-let ((file (jao-org-find-for-pdf (car info)))) - (let ((newp (not (file-exists-p file)))) - (when (or arg newp) (org-store-link nil t)) - (find-file-other-window file) - (when newp - (jao-org-insert-doc-skeleton) - (org-insert-link)))))) + (when-let* ((info (jao-zathura--file-info (current-buffer))) + (file (jao-org-find-for-pdf (car info)))) + (let ((newp (not (file-exists-p file)))) + (when (or arg newp) (org-store-link nil t)) + (find-file-other-window file) + (when newp + (jao-org-insert-doc-skeleton) + (org-insert-link))))) (defun jao-exwm-zathura-goto-org* () (interactive) (jao-exwm-zathura-goto-org t)) (defun jao-exwm-org-store-zathura-link () - (when-let ((info (jao-zathura--file-info (current-buffer)))) + (when-let* ((info (jao-zathura--file-info (current-buffer)))) (let* ((file-name (car info)) (page (cadr info)) (desc (jao-pdf-section-title page file-name))) @@ -387,7 +387,7 @@ (interactive) (if jao-pdf-open-in-emacs (jao-org-goto-pdf) - (when-let (pdf (jao-exwm-org-to-pdf-file)) + (when-let* ((pdf (jao-exwm-org-to-pdf-file))) (jao-zathura-open-doc pdf)))) (with-eval-after-load "org" @@ -424,7 +424,7 @@ (defun jao-exwm-kill-firefox-url () (interactive) - (when-let (b (jao-exwm-find-class-buffer "Firefox")) + (when-let* ((b (jao-exwm-find-class-buffer "Firefox"))) (let ((cb (current-buffer))) (switch-to-buffer b) (jao-exwm--send-str "yy") diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index f7996ac..c2f6a85 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -16,18 +16,18 @@ (:name "l" :query "tag:new and tag:local") (:name "f" :query "tag:new and tag:feeds and not tag:\"/emacs/\""))) -(defsubst jao-notmuch--qstr (c) - (format "%s%s" (plist-get c :name) (plist-get c :count))) - (defvar jao-notmuch-mac-mail-badge nil "Name of Mac mail app showing, besides emacs") (defvar jao-notmuch-mac-hammerspoon (jao-is-darwin)) (defun jao-notmuch-hammerspoon () (jao-when-darwin - (let* ((s (substring-no-properties jao-notmuch-minibuffer-string)) - (s (string-replace " " "%20" s))) - (jao-mac-open "-g hammerspoon://menu?message=%s" s)))) + (let ((s (substring-no-properties jao-notmuch-minibuffer-string))) + (jao-mac-open "-g hammerspoon://menu?message=%s" (url-hexify-string s))))) + +(defun jao-notmuch--qstr (c) + (propertize (format "%s%s" (plist-get c :name) (plist-get c :count)) + 'face (or (plist-get c :face) 'jao-themes-dimm))) (defun jao-notmuch-notify () (interactive) @@ -36,14 +36,8 @@ (when jao-notmuch-mac-mail-badge (jao-mac-app-badge jao-notmuch-mac-mail-badge)) 0)) - (cnts (if (> (or mc 0) 0) (cons `(:name "" :count ,mc) cnts) cnts))) - (setq jao-notmuch-minibuffer-string - (mapconcat (lambda (c) - (propertize (jao-notmuch--qstr c) - 'face - (or (plist-get c :face) 'jao-themes-dimm))) - cnts - " ")) + (cnts (if mc (cons `(:name "" :count ,(format "[%s]" mc)) cnts) cnts))) + (setq jao-notmuch-minibuffer-string (mapconcat #'jao-notmuch--qstr cnts " ")) (when jao-notmuch-mac-hammerspoon (jao-notmuch-hammerspoon)) (jao-minibuffer-refresh))) @@ -91,7 +85,7 @@ (defun jao-notmuch-tree-widen-search () (interactive) - (when-let ((query (notmuch-tree-get-query))) + (when-let* ((query (notmuch-tree-get-query))) (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto))) (notmuch-tree-close-message-window) (notmuch-tree (string-replace jao-notmuch--newa "" query))))) @@ -105,7 +99,7 @@ (mapcar (lambda (s) (jao-notmuch--widen s extra)) searches)) (defun jao-notmuch-hello--insert-searches (searches title) - (when-let (searches (notmuch-hello-query-counts searches)) + (when-let* ((searches (notmuch-hello-query-counts searches))) (let* ((cnt (when title (seq-reduce (lambda (c q) (+ c (or (plist-get q :count) 0))) @@ -414,7 +408,7 @@ (if (not (search-forward "Enclosure:" nil t)) (user-error "No enclosure in message body") (re-search-forward "https?://" nil t) - (if-let (url (thing-at-point-url-at-point)) + (if-let* ((url (thing-at-point-url-at-point))) (progn (message "%s %s ..." (if add "Adding" "Playing") url) (unless add (jao-mpc-clear)) @@ -433,7 +427,7 @@ "Planet Scheme: "))) (defun jao-mail-clean-address (args) - (when-let ((address (car args))) + (when-let* ((address (car args))) (list (thread-last (replace-regexp-in-string jao-mail-clean-rx "" address) (replace-regexp-in-string " " ", "))))) diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el index 98d49f0..582ade3 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -317,7 +317,7 @@ (defun jao-insert-eww-link () "Look for last eww buffer and insert an org link to it." (interactive) - (when-let (b (car (jao-eww-session-eww-buffers))) + (when-let* ((b (car (jao-eww-session-eww-buffers)))) (let ((lnk (with-current-buffer b (format "[[%s][%s]]" (eww-current-url) diff --git a/custom/jao-custom-programming.el b/custom/jao-custom-programming.el index aed4d29..7677177 100644 --- a/custom/jao-custom-programming.el +++ b/custom/jao-custom-programming.el @@ -15,7 +15,7 @@ "Toggle eldoc's documentation buffer." (interactive) (let ((buffer (eldoc-doc-buffer))) - (if-let (w (and buffer (get-buffer-window buffer))) + (if-let* ((w (and buffer (get-buffer-window buffer)))) (delete-window w) (eldoc-doc-buffer t)))) @@ -59,6 +59,7 @@ :init ;; (setq eglot-ignored-server-capabilites '(:inlayHintProvider)) (defun jao-eglot-managed-mode-hook () (eglot-inlay-hints-mode -1) + (eglot-semantic-tokens-mode -1) (setq-local eldoc-display-functions '(eldoc-display-in-buffer))) (setq eglot-events-buffer-config '(:size 1000 :format full) eglot-autoshutdown t) diff --git a/custom/jao-custom-w3m.el b/custom/jao-custom-w3m.el index f532e8b..82246e9 100644 --- a/custom/jao-custom-w3m.el +++ b/custom/jao-custom-w3m.el @@ -6,7 +6,7 @@ (fn `(lambda (b) (with-current-buffer b (string= ,url (w3m-canonicalize-url w3m-current-url)))))) - (when-let (b (seq-find fn (w3m-list-buffers))) + (when-let* ((b (seq-find fn (w3m-list-buffers)))) (pop-to-buffer b)))) (defun jao-w3m-browse-url (url &rest r) diff --git a/custom/jao-custom-x11.el b/custom/jao-custom-x11.el index 3311668..6f0a607 100644 --- a/custom/jao-custom-x11.el +++ b/custom/jao-custom-x11.el @@ -79,11 +79,11 @@ (defun jao-set-wallpaper (&optional path) (interactive) (let ((current (format "~/.wallpaper.%s" (jao-colors-scheme)))) - (when-let ((f (or (and path (expand-file-name path)) - (read-file-name "Image: " - jao-wallpaper-dir - (file-symlink-p current) - t)))) + (when-let* ((f (or (and path (expand-file-name path)) + (read-file-name "Image: " + jao-wallpaper-dir + (file-symlink-p current) + t)))) (make-symbolic-link f current t) (cond (jao-river-enabled (jao-river-set-wallpaper f)) (jao-sway-enabled (jao-sway-set-wallpaper f)) |
