summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--attic/elisp/jao-maildir.el2
-rw-r--r--attic/elisp/jao-notmuch-move.el8
-rw-r--r--attic/elisp/misc.el6
-rw-r--r--attic/elisp/nnnm.el16
-rw-r--r--custom/jao-custom-blog.el2
-rw-r--r--custom/jao-custom-completion.el17
-rw-r--r--custom/jao-custom-email.el6
-rw-r--r--custom/jao-custom-eww.el15
-rw-r--r--custom/jao-custom-exwm.el29
-rw-r--r--custom/jao-custom-gnus.el51
-rw-r--r--custom/jao-custom-notmuch.el12
-rw-r--r--custom/jao-custom-org.el2
-rw-r--r--custom/jao-custom-w3m.el2
-rw-r--r--init.el146
-rw-r--r--lib/doc/jao-doc-session.el2
-rw-r--r--lib/doc/jao-doc-view.el13
-rw-r--r--lib/doc/jao-org-links.el2
-rw-r--r--lib/doc/jao-org-notes.el17
-rw-r--r--lib/eos/jao-afio.el8
-rw-r--r--lib/eos/jao-dirmon.el11
-rw-r--r--lib/eos/jao-eshell-here.el6
-rw-r--r--lib/eos/jao-minibuffer.el10
-rw-r--r--lib/eos/jao-tracking.el2
-rw-r--r--lib/media/jao-mpc.el6
-rw-r--r--lib/media/jao-mpris.el37
-rw-r--r--lib/net/jao-eww-session.el8
-rw-r--r--lib/net/jao-notmuch-gnus.el42
-rw-r--r--lib/net/jao-notmuch.el16
-rw-r--r--lib/net/jao-proton-utils.el2
-rw-r--r--lib/net/randomsig.el9
-rw-r--r--lib/prog/jao-compilation.el6
-rw-r--r--lib/themes/jao-themes.el5
32 files changed, 313 insertions, 203 deletions
diff --git a/attic/elisp/jao-maildir.el b/attic/elisp/jao-maildir.el
index 90cf0b4..18a1725 100644
--- a/attic/elisp/jao-maildir.el
+++ b/attic/elisp/jao-maildir.el
@@ -90,7 +90,7 @@
0))
(defun jao-maildir--update-track-string (mbox)
- (when-let* ((track (seq-find (lambda (td) (string-match-p (car td) mbox))
+ (when-let ((track (seq-find (lambda (td) (string-match-p (car td) mbox))
jao-maildir--trackers)))
(let* ((label (cadr track))
(other (assoc-delete-all label jao-maildir--track-strings))
diff --git a/attic/elisp/jao-notmuch-move.el b/attic/elisp/jao-notmuch-move.el
index d4626bf..eb7ea4c 100644
--- a/attic/elisp/jao-notmuch-move.el
+++ b/attic/elisp/jao-notmuch-move.el
@@ -1,6 +1,6 @@
;;; jao-notmuch-move.el --- Move messages around in notmuch -*- lexical-binding: t; -*-
-;; Copyright (C) 2021, 2024 jao
+;; Copyright (C) 2021 jao
;; Author: jao <mail@jao.io>
;; Keywords: mail
@@ -37,9 +37,9 @@
(user-error "Message not in any registered mailbox!")))
(defun jao-notmuch--msg-props ()
- (if-let* ((p (save-excursion
- (beginning-of-line)
- (text-property-search-forward :notmuch-message-properties))))
+ (if-let ((p (save-excursion
+ (beginning-of-line)
+ (text-property-search-forward :notmuch-message-properties))))
(prop-match-value p)
(user-error "No message at point")))
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 4cae427..2f1bcb0 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -25,7 +25,7 @@
;; (defun jao-erlang-compile (arg)
;; (interactive "P")
;; (save-some-buffers)
- ;; (when-let* ((mname (jao-erlang-current-module)))
+ ;; (when-let ((mname (jao-erlang-current-module)))
;; (with-current-buffer (jao-vterm-repl)
;; (vterm-send-string (format "c(%s).\n" mname))
;; (sit-for 0)
@@ -600,7 +600,7 @@
;;; eldoc for magit status/log buffers
(defun jao-magit-eldoc-for-commit (_callback)
- (when-let* ((commit (magit-commit-at-point)))
+ (when-let ((commit (magit-commit-at-point)))
(with-temp-buffer
(magit-git-insert "show"
"--format=format:%an <%ae>, %ar"
@@ -908,7 +908,7 @@
(res (funcall fn)))
(while (and res tags) (setq res (seq-intersection res (funcall fn))))
(unless res (user-error "No notes found"))
- (when-let* ((f (completing-read "Select file: " (mapcar #'car res))))
+ (when-let (f (completing-read "Select file: " (mapcar #'car res)))
(find-file (cadr (assoc f res))))))
(defun jao-sway-run-or-focus-tidal ()
diff --git a/attic/elisp/nnnm.el b/attic/elisp/nnnm.el
index 8a4185f..552e95c 100644
--- a/attic/elisp/nnnm.el
+++ b/attic/elisp/nnnm.el
@@ -1,6 +1,6 @@
;;; nnnm.el --- Gnus backend for notmuch -*- lexical-binding: t; -*-
-;; Copyright (C) 2021, 2024 jao
+;; Copyright (C) 2021 jao
;; Author: jao <mail@jao.io>
;; Keywords: mail
@@ -47,8 +47,8 @@
(defun nnnm--find-query (name)
- (when-let* ((s (seq-find (lambda (s) (string= (plist-get s :name) name))
- nnnm-saved-searches)))
+ (when-let (s (seq-find (lambda (s) (string= (plist-get s :name) name))
+ nnnm-saved-searches))
(plist-get s :query)))
(defun nnnm--find-message-file (id)
@@ -60,11 +60,11 @@
(defun nnnm--article-data (article group)
(cond ((stringp article) (list article))
((numberp article)
- (when-let* ((data (nnnm--group-data group)))
+ (when-let (data (nnnm--group-data group))
(elt data (1- article))))))
(defun nnnm-article-to-file (article group)
- (when-let* ((d (nnnm--article-data article group)))
+ (when-let (d (nnnm--article-data article group))
(or (cadr d) (nnnm--find-message-file (car d)))))
(defun nnnm--count (query &optional context)
@@ -117,7 +117,7 @@
(gnus-set-active (nnnm--prefixed group server) (cons 1 n)))
(defun nnnm--update-group-data (group &optional server)
- (when-let* ((query (nnnm--find-query group)))
+ (when-let (query (nnnm--find-query group))
(let* ((data (or (nnnm--group-data group)
(mapcar #'list (nnnm--search query "NOT tag:new"))))
(ids (nnnm--search query "tag:new"))
@@ -158,7 +158,7 @@
(with-current-buffer nntp-server-buffer
(erase-buffer)
(dolist (s nnnm-saved-searches)
- (when-let* ((query (plist-get s :query)))
+ (when-let (query (plist-get s :query))
(let ((name (plist-get s :name))
(total (nnnm--count query)))
(insert (format "%s %d 1 y\n" name total))))))
@@ -173,7 +173,7 @@
(if (stringp (car sequence))
'headers
(dolist (article sequence)
- (when-let* ((file (nnnm-article-to-file article group)))
+ (when-let (file (nnnm-article-to-file article group))
(insert (format "221 %d Article retrieved.\n" article))
(save-excursion (nnheader-insert-head file))
(if (re-search-forward "\n\r?\n" nil t)
diff --git a/custom/jao-custom-blog.el b/custom/jao-custom-blog.el
index 4b74601..a11c5c0 100644
--- a/custom/jao-custom-blog.el
+++ b/custom/jao-custom-blog.el
@@ -171,7 +171,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 cdffcdc..490fd65 100644
--- a/custom/jao-custom-completion.el
+++ b/custom/jao-custom-completion.el
@@ -87,7 +87,7 @@
(funcall fun lines)
(move-overlay vertico--candidates-ov (point-min) (point-min))
(overlay-put vertico--candidates-ov 'after-string (apply #'concat lines))
- (vertico--resize-window (length lines))))
+ (vertico--resize)))
(advice-add 'vertico--display-candidates :around #'jao-vertico--display))
@@ -126,8 +126,7 @@
("M-g e" . consult-error)
("M-s m" . consult-multi-occur)
("M-y" . consult-yank-pop)
- ("C-s" . isearch-forward)
- ("<help> a" . consult-apropos))
+ ("C-s" . isearch-forward))
:custom ((consult-preview-key (kbd "`")))
@@ -175,9 +174,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)
@@ -290,7 +289,7 @@
(defun jao-embark-targets--w3m-anchor ()
(when (not (region-active-p))
- (when-let* ((url (or (jao-url-around-point)
+ (when-let ((url (or (jao-url-around-point)
(thing-at-point 'url)
(and (derived-mode-p 'w3m-mode)
(or (w3m-anchor) w3m-current-url))
@@ -396,12 +395,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 dd898ad..a3d1a92 100644
--- a/custom/jao-custom-email.el
+++ b/custom/jao-custom-email.el
@@ -69,8 +69,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
@@ -170,7 +170,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 726f682..1b766c9 100644
--- a/custom/jao-custom-eww.el
+++ b/custom/jao-custom-eww.el
@@ -32,7 +32,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)))
@@ -83,7 +83,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
@@ -91,7 +91,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)
@@ -116,10 +116,11 @@
;;; eww to org
(defun jao-eww-to-org (&optional dest)
- (interactive)
- (unless (org-region-active-p)
+ (interactive "P")
+ (unless (or (and (interactive-p) dest) (org-region-active-p))
(let ((shr-width 80)) (eww-readable)))
- (let* ((start (if (org-region-active-p) (region-beginning) (point-min)))
+ (let* ((dest (unless (interactive-p) dest))
+ (start (if (org-region-active-p) (region-beginning) (point-min)))
(end (if (org-region-active-p) (region-end) (point-max)))
(link (eww-current-url))
(title (plist-get eww-data :title))
@@ -220,7 +221,7 @@ It should be the title of the web page as returned by `rdrview'"
(with-eval-after-load "org" (require 'ol-eww nil t))
(defun jao-eww-buffer-name ()
- (when-let* ((s (or (plist-get eww-data :title)
+ (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 2135935..3cb3fc9 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 ()
@@ -194,7 +194,9 @@
(defun jao-exwm-switch-to-next-x ()
(interactive)
- (let ((bfs (seq-filter (lambda (b) (buffer-local-value 'exwm-class-name b))
+ (let ((bfs (seq-filter (lambda (b)
+ (with-current-buffer b
+ (derived-mode-p 'exwm-mode)))
(buffer-list (window-frame)))))
(when (car bfs) (switch-to-buffer (car (reverse bfs))))))
@@ -341,21 +343,21 @@
(defun jao-exwm-zathura-goto-org (&optional arg)
(interactive "P")
- (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)))))
+ (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))))))
(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)))
@@ -385,7 +387,7 @@
(interactive)
(if jao-browse-doc-use-emacs-p
(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"
@@ -422,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")
@@ -530,6 +532,7 @@
([f9] . jao-bright-show)))
;; (customize-set-variable 'exwm-input-global-keys exwm-input-global-keys)
+(exwm-wm-mode)
;;; .
(provide 'jao-custom-exwm)
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index c56599e..ce77285 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -212,8 +212,10 @@
(when jao-gnus-use-nnml
(add-to-list
'gnus-secondary-select-methods
- `(nnml "" (gnus-search-engine gnus-search-recoll
- (remove-prefix ,(jao-gnus-dir "Mail/"))))))
+ ;; `(nnml "" (gnus-search-engine gnus-search-recoll
+ ;; (remove-prefix ,(jao-gnus-dir "Mail/"))))
+ `(nnml "" (gnus-search-engine gnus-search-notmuch
+ (remove-prefix "/home/jao/var/mail/gnus")))))
(when jao-gnus-use-nnml
(dolist (p jao-gnus-nnml-group-params)
@@ -447,13 +449,19 @@
(use-package org-capture
:config
(add-to-list 'org-capture-templates
+ '("x" "arXiv" entry (file "notes/physics/arxiv.org")
+ "* %(jao-gnus-subject)\n\n %i\n\n %(jao-gnus-org-url)"
+ :immediate-finish t)
+ t)
+ (add-to-list 'org-capture-templates
'("X" "arXiv" entry (file "notes/physics/arxiv.org")
- "* %:subject\n\n(jao-gnus-org-paragraph \"%i\")"
+ "* %(jao-gnus-subject)\n\n%(jao-gnus-org-paragraph \"%i\")"
:immediate-finish t)
t)
(org-capture-upgrade-templates org-capture-templates))
(defvar jao-gnus-org-url nil)
+(defun jao-gnus-org-url () jao-gnus-org-url)
(defun jao-gnus-org-paragraph (x)
(with-temp-buffer
(insert " " (string-trim (or x "")) "\n ")
@@ -462,22 +470,27 @@
(goto-char (point-max))
(open-rectangle 0 (point))
(concat (buffer-string) "\n " (or jao-gnus-org-url ""))))
+(defvar jao-gnus-subject nil)
+(defun jao-gnus-subject () jao-gnus-subject)
(defun jao-gnus-arXiv-capture ()
(interactive)
(unless (derived-mode-p '(gnus-summary-mode)) (gnus-article-show-summary))
- (setq jao-subject (gnus-summary-article-subject))
+ (setq jao-gnus-subject (gnus-summary-article-subject))
(gnus-summary-select-article-buffer)
(gnus-article-goto-part 0)
- (setq-local transient-mark-mode 'lambda)
- (set-mark (point))
- (forward-paragraph)
- (save-excursion
- (when (re-search-forward "^Link" nil t)
- (beginning-of-line)
- (setq jao-gnus-org-url (org-eww-url-below-point))))
- (org-capture nil "X")
- (set-mark (point))
+ (let ((transient-mark-mode t))
+ (set-mark (point))
+ (forward-paragraph)
+ (or (and (save-excursion
+ (when (re-search-forward "^Link" nil t)
+ (beginning-of-line)
+ (setq jao-gnus-org-url (org-eww-url-below-point))))
+ (org-capture nil "X"))
+ (and (save-excursion
+ (when (re-search-forward "^URL: " nil t)
+ (setq jao-gnus-org-url (thing-at-point-url-at-point))))
+ (org-capture nil "x"))))
(gnus-article-show-summary))
;;; article
@@ -558,7 +571,7 @@
(save-excursion
(goto-char (point-min))
(when (or (search-forward-regexp "^Via: h" nil t)
- (search-forward-regexp "^URL: h" nil t)
+ (search-forward-regexp "^URL:[\n ]h" nil t)
(and (search-forward-regexp "^Link$" nil t)
(not (beginning-of-line))))
(cond (external (jao-browse-with-external-browser))
@@ -580,10 +593,10 @@
(gnus-summary-select-article-buffer)
(save-excursion
(goto-char (point-min))
- (let ((offset (or (and (search-forward-regexp "^Enclosure: " nil t) 2)
+ (let ((offset (or (and (search-forward-regexp "^Enclosure: ?" nil t) 2)
(and (search-forward-regexp "^Enclosure$" nil t) -2))))
(when offset (forward-char offset))
- (if-let* ((url (jao-url-around-point)))
+ (if-let ((url (jao-url-around-point)))
(jao-mpc-add-or-play-url url)
(error "No enclosure found"))))))
@@ -633,13 +646,14 @@
(seq-difference '("feeds.trove")))))
`(("nnml:bigml\\.inbox" "B" jao-themes-f00)
("nnml:bigml\\.alba" "A" jao-themes-f00)
+ ("nnml:bigml\\.ryou" "R" jao-themes-f00)
("nnml:bigml\\.bugs" "b" jao-themes-error)
("nnml:bigml\\.support" "S" default)
+ ("nnml:bigml\\.[^aibsr]" "W" jao-themes-dimm)
("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01)
- ("nnml:bigml\\.[^aibs]" "W" jao-themes-dimm)
("nnml:jao.hacking" "H" jao-themes-dimm)
("nnml:jao.write" "W" jao-themes-warning)
- ("nnml:jao.[^isthw]" "J" jao-themes-dimm)
+ ("nnml:jao.[^ithw]" "J" jao-themes-dimm)
(,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm)
("feeds\\.e" "E" jao-themes-dimm)
("nnml:local" "l" jao-themes-dimm)
@@ -689,6 +703,7 @@
(jao-gnus--notify)))
(add-hook 'gnus-summary-exit-hook #'jao-gnus--on-summary-exit)
+(add-hook 'gnus-exit-group-hook #'jao-gnus--notify)
;;;; open mail file in gnus
(defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server)
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 7b1540f..42d9e12 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -60,7 +60,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)))))
@@ -73,7 +73,7 @@
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)))
@@ -348,7 +348,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))
@@ -363,7 +363,7 @@
"quant-ph updates on arXiv.org: ")))
(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 " " ", ")))))
@@ -430,8 +430,8 @@
(defun jao-notmuch-browse-url (ext)
(interactive "P")
- (when-let* ((url (or (jao-notmuch--via-url)
- (car (last (jao-notmuch-message-urls))))))
+ (when-let (url (or (jao-notmuch--via-url)
+ (car (last (jao-notmuch-message-urls)))))
(funcall (if ext browse-url-secondary-browser-function #'browse-url)
url)))
diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el
index 1b15e72..4d2e622 100644
--- a/custom/jao-custom-org.el
+++ b/custom/jao-custom-org.el
@@ -254,7 +254,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-w3m.el b/custom/jao-custom-w3m.el
index 57d0c4a..43b9e2d 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/init.el b/init.el
index e3c56f9..c83a3b1 100644
--- a/init.el
+++ b/init.el
@@ -279,7 +279,9 @@
(setq auth-sources '("~/.emacs.d/authinfo.gpg" "~/.netrc"))
(use-package epa-file
- :init (setq epa-file-cache-passphrase-for-symmetric-encryption t)
+ :init (setq epa-file-cache-passphrase-for-symmetric-encryption t
+ epa-file-encrypt-to "A247C4780736A6156BC8DA748C081D34D321D881"
+ plstore-encrypt-to epa-file-encrypt-to)
:config (epa-file-enable))
(require 'epa-file)
@@ -411,7 +413,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))))
@@ -641,7 +643,7 @@
(jao-shell-string "curl -s"
"https://wttr.in/?format=%l++%m++%C+%c+%t+%w++%p"))
(jao-afio-goto-scratch)
- (if-let* ((b (get-buffer "*wttr*")))
+ (if-let ((b (get-buffer "*wttr*")))
(progn (pop-to-buffer b)
(term-send-string (get-buffer-process nil) "clear;curl wttr.in\n"))
(jao-exec-in-term "curl wttr.in" "*wttr*"))))
@@ -910,6 +912,7 @@
;;;; projects
(use-package project :demand t)
(global-set-key "\C-xp" 'jao-prev-window)
+(use-package list-projects :ensure t)
;;;; buffer quit function (the triple ESC)
(setq buffer-quit-function (lambda () t))
@@ -930,6 +933,42 @@
scroll-step 1
redisplay-skip-fontification-on-input nil))
+(use-package ultra-scroll
+ ;:load-path "~/code/emacs/ultra-scroll" ; if you git clone'd instead of using vc
+ :vc (:url "https://github.com/jdtsmith/ultra-scroll") ; For Emacs>=30
+ :init
+ (setq scroll-conservatively 3 ; or whatever value you prefer, since v0.4
+ scroll-margin 0) ; important: scroll-margin>0 not yet supported
+ :config
+ (ultra-scroll-mode 1))
+
+;;;; show diffs when running C-x s
+(add-to-list 'save-some-buffers-action-alist
+ `("d"
+ ,(lambda (buffer)
+ (diff-buffer-with-file (buffer-file-name buffer)))
+ "show diff between the buffer and its file"))
+
+;;;; copy buffer file name
+;; https://stackoverflow.com/questions/18812938/copy-full-file-path-into-copy-paste-clipboard
+(defun copy-buffer-file-name-as-kill (choice)
+ "Copy the buffer-file-name to the kill-ring"
+ (interactive "cCopy Buffer Name (F) Full, (D) Directory, (N) Name")
+ (let ((new-kill-string)
+ (name (if (eq major-mode 'dired-mode)
+ (dired-get-filename)
+ (or (buffer-file-name) ""))))
+ (cond ((eq choice ?f)
+ (setq new-kill-string name))
+ ((eq choice ?d)
+ (setq new-kill-string (file-name-directory name)))
+ ((eq choice ?n)
+ (setq new-kill-string (file-name-nondirectory name)))
+ (t (message "Quit")))
+ (when new-kill-string
+ (message "%s copied" new-kill-string)
+ (kill-new new-kill-string))))
+
;;; Windows
;;;; splitting and switch
(setq split-height-threshold 80
@@ -1286,9 +1325,10 @@
(defun jao-maybe-view-video (url &rest _ignored)
(interactive)
- (if (y-or-n-p "View video (y) or web page (n)? ")
- (jao-view-video url)
- (funcall jao-browse-url-function url)))
+ (let ((w (read-char "View video (v) or web page (w)? ")))
+ (cond ((eq w ?v) (jao-view-video url))
+ ((eq w ?w) (funcall jao-browse-url-function url))
+ (t (message "Aborted")))))
;;;; web browsers
(defun jao-www--buffer-p (b)
@@ -1487,9 +1527,9 @@
(defun jao-open-doc (&optional file page height)
(interactive)
- (when-let* ((file (or file
- (read-file-name "Document: "
- (concat jao-org-dir "/doc/")))))
+ (when-let (file (or file
+ (read-file-name "Document: "
+ (concat jao-org-dir "/doc/"))))
(funcall jao-open-doc-fun file page height)))
(defun jao-select-pdf ()
@@ -1499,7 +1539,7 @@
(defun jao-open-with-zathura ()
(interactive)
- (when-let* ((f buffer-file-name))
+ (when-let (f buffer-file-name)
(let ((p (jao-doc-view-current-page)))
(cond (jao-river-enabled (jao-river-open-with-zathura f p))
(jao-sway-enabled (jao-sway-open-with-zathura f p))
@@ -1529,9 +1569,9 @@
:hook ((doc-view-mode . jao-doc-session-mark))
:bind (:map doc-view-mode-map
("j" . doc-view-next-line-or-next-page)
- ("J" . doc-view-scroll-up-or-next-page)
+ ("J" . doc-view-search-next-match)
("k" . doc-view-previous-line-or-previous-page)
- ("K" . doc-view-scroll-down-or-previous-page)
+ ("K" . doc-view-search-previous-match)
("z" . jao-open-with-zathura)))
(use-package jao-doc-session :demand t)
@@ -1652,7 +1692,7 @@
(interactive "P")
,@prelude
(let ((jao-use-vterm (if term (not jao-use-vterm) jao-use-vterm)))
- (if-let* ((b (jao-term--find ,cmd)))
+ (if-let ((b (jao-term--find ,cmd)))
(pop-to-buffer b)
(jao-exec-in-term ,cmd ,(format "*%s*" name))))))
@@ -1870,10 +1910,10 @@
;;;; other git packages
(use-package git-timemachine :ensure t)
-(use-package consult-git-log-grep
- :ensure t
- :custom (consult-git-log-grep-open-function #'magit-show-commit)
- :bind (("C-c K" . consult-git-grep)))
+;; (use-package consult-git-log-grep
+;; :ensure t
+;; :custom (consult-git-log-grep-open-function #'magit-show-commit)
+;; :bind (("C-c K" . consult-git-grep)))
;; git config --local git-link.remote / git-link.branch
(use-package git-link :ensure t)
@@ -2078,7 +2118,7 @@
(add-hook 'emacs-lisp-mode-hook #'jao-outline-minor-mode)
(use-package edit-list :ensure t)
-(use-package package-lint :ensure t)
+;; (use-package package-lint :ensure t)
;; (use-package tree-inspector :ensure t)
(defun elisp-disassemble (function)
@@ -2197,7 +2237,9 @@
(add-hook 'org-mode-hook #'jao-org--set-geiser-impl)
(jao-load-path "geiser")
+;; (package-vc-install-from-checkout ...)
(use-package geiser
+ :demand t
:init
(setq geiser-repl-history-filename "~/.emacs.d/cache/geiser-history"
geiser-repl-startup-time 20000
@@ -2386,6 +2428,11 @@
:config
(venv-initialize-eshell)
(jao-compilation-env "VIRTUAL_ENV"))
+;;;; Javascript
+
+(use-package typescript-mode
+ :ensure t
+ :custom ((typescript-indent-level 2)))
;;; Text/data formats
;;;; json
@@ -2479,7 +2526,13 @@
lui-track-behavior 'before-tracking-next-buffer)
:config
- (defsubst jao-circe-nick-no () (length (circe-channel-nicks)))
+ (defsubst jao-circe-nick-no ()
+ (if (derived-mode-p 'circe-query-mode)
+ 2
+ (length (circe-channel-nicks))))
+
+ (defsubst jao-circe-netowrk ()
+ (or (plist-get lui-logging-format-arguments :network) ""))
(define-minor-mode jao-circe-user-number-mode ""
:lighter (:eval (format " [%s]" (jao-circe-nick-no))))
@@ -2487,10 +2540,13 @@
(defun jao-circe-channel-hook ()
(when jao-mode-line-in-minibuffer
(setq header-line-format
- '(" %b" (:eval (format " - %s nicks" (jao-circe-nick-no))))))
+ '(" %b" (:eval (format "@%s - %s nicks"
+ (jao-circe-netowrk)
+ (jao-circe-nick-no))))))
(jao-circe-user-number-mode 1))
(add-hook 'circe-channel-mode-hook #'jao-circe-channel-hook)
+ (add-hook 'circe-query-mode-hook #'jao-circe-channel-hook)
(defun circe-command-RECOVER (&rest _ignore)
"Recover nick"
@@ -2523,11 +2579,13 @@
(list "Bitlbee" :host "127.0.0.1" :nick u
:channels jao-bitlbee-channels :lagmon-disabled t
:nickserv-password u :user p))
- (list "localslack" :host "127.0.0.1" :nick "jao"
+ (list "bigml" :host "127.0.0.1" :nick "jao"
:channels jao-slack-channels :port 9007
:lagmon-disabled t)
(list "recoveryou" :host "127.0.0.1" :nick "jao"
- :port 9008 :lagmon-disabled t)))
+ :port 9008 :lagmon-disabled t)
+ (list "grio" :host "127.0.0.1" :nick "jao"
+ :port 9009 :lagmon-disabled t)))
(jao-shorten-modes 'circe-channel-mode
'circe-server-mode
@@ -2596,7 +2654,7 @@
:config
(defun jao-ement-track (event room session)
(when (ement-notify--room-unread-p event room session)
- (when-let* ((n (ement-room--buffer-name room))
+ (when-let ((n (ement-room--buffer-name room))
(b (get-buffer n)))
(tracking-add-buffer b))))
@@ -2610,8 +2668,11 @@
:init
(setq mastodon-instance-url "https://fosstodon.org"
mastodon-active-user "jao@gnu.org"
+ mastodon-group-notifications t
+ mastodon-images-in-notifs t
mastodon-tl-position-after-update nil
- mastodon-toot-display-orig-in-reply-buffer t)
+ mastodon-toot-display-orig-in-reply-buffer t
+ mastodon-media--hide-sensitive-media nil)
:config
;; (defun jao-mastodon--setup ()
;; (setq-local scroll-margin 12))
@@ -2622,7 +2683,7 @@
(defun jao-mastodon-toot-url ()
(interactive)
- (when-let* ((url (jao-url-around-point t)))
+ (when-let (url (jao-url-around-point t))
(jao-tracking-go-to-chats)
(mastodon-toot--compose-buffer nil nil nil url)))
@@ -2684,9 +2745,10 @@
("M" "mute user" mastodon-tl--mute-user)
("B" "block user" mastodon-tl--block-user)
("m" "message user" mastodon-tl--dm-user)
- ""
- ("," "favouriters" mastodon-toot--list-toot-favouriters)
- ("." "boosters" mastodon-toot--list-toot-boosters)]
+ ;; ""
+ ;; ("," "favouriters" mastodon-toot--list-toot-favouriters)
+ ;; ("." "boosters" mastodon-toot--list-toot-boosters)
+ ]
;; S-RET mastodon-tl--unmute-user
;; C-S-b mastodon-tl--unblock-user
@@ -2712,15 +2774,13 @@
(jao-with-auth "matrix.org" u p (ement-connect :user-id u :password p))))
(when (and (fboundp 'mastodon) (or p (y-or-n-p "Connect to mastodon? ")))
(mastodon))
- (when (or p (y-or-n-p "Connect to libera? "))
- (unless (get-buffer "irc.libera.chat:6697")
- (circe "Libera Chat")))
- (when (or p (y-or-n-p "Connect to localslack? "))
- (unless (get-buffer "127.0.0.1:9007")
- (circe "localslack")))
- (when (or p (y-or-n-p "Connect to recoveryou? "))
- (unless (get-buffer "127.0.0.1:9008")
- (circe "recoveryou"))))
+ (dolist (c '(("Libera Chat" . "irc.libera.chat:6697")
+ ("bigml" . "127.0.0.1:9007")
+ ("recoveryou" . "127.0.0.1:9008")
+ ("grio" . "127.0.0.1:9009")))
+ (unless (get-buffer (cdr c))
+ (when (or p (y-or-n-p (format "Connect to %s? " (car c))))
+ (circe (car c))))))
(defun jao-all-chats ()
(interactive)
@@ -2971,7 +3031,8 @@
:demand t
:config
(defun jao--notify-album (album)
- (jao-notify album "Next album" jao-notify-audio-icon)
+ (unless jao-minibuffer-mode
+ (jao-notify album "Next album" jao-notify-audio-icon))
(jao-minibuffer-refresh))
(setq jao-random-album-notify #'jao--notify-album))
@@ -3136,7 +3197,7 @@
(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))
+ (when-let ((f (or (and path (expand-file-name path))
(read-file-name "Image: "
jao-wallpaper-dir
(file-symlink-p current)
@@ -3276,7 +3337,8 @@
("do" "open doc" jao-open-doc)
("dr" "search docs with recoll" jao-recoll-consult-docs)]
["Monitors"
- ("p" "htop" jao-term-htop)
+ ("p" "list projects" list-projects)
+ ;; ("p" "htop" jao-term-htop)
("P" "pasytray" jao-toggle-pasystray-applet)
("x" "restart i3bar" jao-river-restart-i3bar :if jao-river-enabled-p)
("x" "restart xmobar" jao-xmobar-restart :if jao-exwm-enabled-p)
@@ -3304,7 +3366,9 @@
["Helpers"
("a" "aptitude" jao-term-aptitude)
("l" "packages" jao-list-packages)
- ("r" "reveal" jao-reveal)
+ ;; ("r" "reveal" jao-reveal)
+ ("r" "translate" reverso)
+ ("f" "copy buffer file name" copy-buffer-file-name-as-kill)
("k" (lambda () (concat "keyboard" (when (jao-kb-toggled-p) "*")))
jao-kb-toggle :if jao-x11-p)]])
diff --git a/lib/doc/jao-doc-session.el b/lib/doc/jao-doc-session.el
index 928cf26..877a8cb 100644
--- a/lib/doc/jao-doc-session.el
+++ b/lib/doc/jao-doc-session.el
@@ -36,7 +36,7 @@
(let ((docs '())
(cb (and skip-current (current-buffer))))
(dolist (b (buffer-list))
- (when-let* ((fs (and (not (eq cb b)) (jao-doc-session-is-doc b))))
+ (when-let (fs (and (not (eq cb b)) (jao-doc-session-is-doc b)))
(dolist (f fs) (add-to-list 'docs f))))
(when (or force (> (length docs) 0))
(setq jao-doc-session docs))))
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el
index 75c2bae..fe26c1d 100644
--- a/lib/doc/jao-doc-view.el
+++ b/lib/doc/jao-doc-view.el
@@ -1,6 +1,6 @@
;;; jao-doc-view.el -- extensions for doc-view -*- lexical-binding: t; -*-
-;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021, 2022, 2024 Jose Antonio Ortega Ruiz
+;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021, 2022 Jose Antonio Ortega Ruiz
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -49,20 +49,20 @@
(defvar-local jao-doc-view--trail-fwd ())
(defun jao-doc-view--trail-push (dest-page)
- (when-let* ((page (jao-doc-view-current-page)))
+ (when-let (page (jao-doc-view-current-page))
(unless (eq (car jao-doc-view--trail-back) page)
(push page jao-doc-view--trail-back))))
(defun jao-doc-view-back ()
(interactive nil doc-view-mode)
- (if-let* ((p (pop jao-doc-view--trail-back)))
+ (if-let (p (pop jao-doc-view--trail-back))
(progn (push (jao-doc-view-current-page) jao-doc-view--trail-fwd)
(jao-doc-view-goto-page p))
(message "No more back marks.")))
(defun jao-doc-view-forward ()
(interactive nil doc-view-mode)
- (if-let* ((p (pop jao-doc-view--trail-fwd)))
+ (if-let (p (pop jao-doc-view--trail-fwd))
(progn (push (jao-doc-view-current-page) jao-doc-view--trail-back)
(jao-doc-view-goto-page p))
(message "No more forward marks.")))
@@ -115,9 +115,8 @@
(cond ((eq 'wait urls) (message "Extracting text, please wait and retry."))
((zerop (length urls))
(message "No URLs in this %s" (if all "document" "page")))
- (t (when-let* ((url (completing-read "URL: " urls nil nil
- (when (null (cdr urls))
- (car urls)))))
+ (t (when-let (url (completing-read "URL: " urls nil nil
+ (when (null (cdr urls)) (car urls))))
(browse-url url))))))
;;; .
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el
index 4fefedd..88c0561 100644
--- a/lib/doc/jao-org-links.el
+++ b/lib/doc/jao-org-links.el
@@ -119,7 +119,7 @@
;;;###autoload
(defun jao-org-goto-pdf ()
(interactive)
- (if-let* ((f (jao-org-org-to-pdf-file)))
+ (if-let (f (jao-org-org-to-pdf-file))
(jao-org--pdf-open f nil)
(user-error "No PDF file associated with this buffer")))
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index e47f845..d3f18b8 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -1,6 +1,6 @@
;;; jao-org-notes.el --- A simple system for org note taking -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: tools
@@ -74,11 +74,12 @@
(defun jao-org-notes--consult-rg (prompt &optional cat no-req cmd initial)
(let ((default-directory (expand-file-name (or cat "") jao-org-notes-dir)))
(consult--read
- (consult--async-command #'jao-org-notes--rg-title-or-tags
- (consult--async-transform jao-org-notes--matches))
+ (consult--async-pipeline
+ (consult--process-collection #'jao-org-notes--rg-title-or-tags)
+ (consult--async-transform #'jao-org-notes--matches))
:prompt prompt
- :initial (consult--async-split-initial (or initial ""))
- :add-history (concat (consult--async-split-initial (thing-at-point 'symbol)))
+ :initial (or initial "")
+ :add-history (thing-at-point 'symbol)
:require-match (not no-req)
:category 'jao-org-notes-lookup
:group 'jao-org-notes--consult-group
@@ -147,7 +148,7 @@
(defun jao-org-notes-open ()
"Search for a note file, matching tags and titles with completion."
(interactive)
- (when-let* ((f (jao-org-notes--consult-rg "Search notes: ")))
+ (when-let (f (jao-org-notes--consult-rg "Search notes: "))
(find-file f)))
(defun jao-org-notes-consult-tags ()
@@ -180,7 +181,7 @@
(file (completing-read "File: " res nil t nil))
(entry (assoc file res)))
(progn (find-file (cadr entry))
- (when-let* ((line (caddr entry))) (goto-line line)))
+ (when-let (line (caddr entry)) (goto-line line)))
(message "Nobody links here!")))
(defun jao-org-notes-insert-tags ()
@@ -191,7 +192,7 @@
(defun jao-org-notes-insert-link ()
"Select a note file (with completion) and insert a link to it."
(interactive)
- (when-let* ((f (jao-org-notes--consult-rg "Notes file: ")))
+ (when-let (f (jao-org-notes--consult-rg "Notes file: "))
(let ((rel-path (file-relative-name f default-directory))
(title (with-current-buffer (find-file-noselect f)
(save-excursion
diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el
index a5d9b24..10e9115 100644
--- a/lib/eos/jao-afio.el
+++ b/lib/eos/jao-afio.el
@@ -1,6 +1,6 @@
;;; jao-afio.el --- workspaces in just one frame -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: frames
@@ -86,7 +86,7 @@
(if (car docs)
(progn (switch-to-buffer (car docs))
(switch-to-buffer-other-window (or (cadr docs) (car docs))))
- (when-let* ((docs (jao-doc-session)))
+ (when-let (docs (jao-doc-session))
(when (y-or-n-p (format "Load saved session? (%d docs)" (length docs)))
(jao-afio-open-pdf-session docs))))))
@@ -96,7 +96,7 @@
(declare-function jao-eww-session-load "jao-eww-session")
(defun jao-afio--open-eww-session ()
- (if-let* ((b (jao-eww-session-eww-buffers)))
+ (if-let (b (jao-eww-session-eww-buffers))
(switch-to-buffer (car b))
(jao-eww-session-load)))
@@ -228,7 +228,7 @@
(defun jao-afio-goto-scratch (&optional one-win)
(interactive "P")
- (jao-afio--goto-frame ?s nil)
+ (jao-afio--goto-frame ?s one-win)
(when one-win (delete-other-windows)))
(defun jao-afio-goto-chats (&optional reset)
diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el
index 9d748d1..117da85 100644
--- a/lib/eos/jao-dirmon.el
+++ b/lib/eos/jao-dirmon.el
@@ -1,6 +1,6 @@
;;; jao-dirmon.el --- little utility to monitor disk usage -*- lexical-binding: t; -*-
-;; Copyright (C) 2022 jao
+;; Copyright (C) 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: tools
@@ -25,6 +25,7 @@
;;; Code:
(require 'multisession)
+(require 'view)
(require 'jao-shell)
(define-multisession-variable jao-dirmon-last '())
@@ -40,9 +41,12 @@
(defvar jao-dirmon-threshold 100)
(defvar jao-dirmon-last-delta nil)
+(defvar jao-dirmon-buffer "*jao-dirmon")
(defun jao-dirmon--show-deltas (old current deltas)
- (with-temp-buffer
+ (with-current-buffer (get-buffer-create jao-dirmon-buffer)
+ (view-mode-disable)
+ (delete-region (point-min) (point-max))
(insert "High deltas since " (car old) "\n\n")
(dolist (d (seq-sort-by #'cdr #'> deltas))
(insert (format "- %s: %s Mb\n" (car d) (cdr d))))
@@ -52,6 +56,7 @@
(seq-sort-by #'cdr #'> current)))
(insert (format "- %s: %s Mb\n" (car c) (cdr c)))))
(beginning-of-buffer)
+ (view-mode-enable)
(pop-to-buffer (current-buffer) nil t)
(when (y-or-n-p "Save current state?")
(setf (multisession-value jao-dirmon-last)
@@ -66,7 +71,7 @@
(dolist (c current)
(let ((d (- (cdr c) (alist-get (car c) old 0 nil #'string=))))
(when (> (abs d) jao-dirmon-threshold)
- (push c high))))
+ (push (cons (car c) d) high))))
(setq jao-dirmon-last-delta high)
(jao-dirmon--show-deltas old current jao-dirmon-last-delta)
jao-dirmon-last-delta))
diff --git a/lib/eos/jao-eshell-here.el b/lib/eos/jao-eshell-here.el
index ad7805f..54d58f0 100644
--- a/lib/eos/jao-eshell-here.el
+++ b/lib/eos/jao-eshell-here.el
@@ -1,6 +1,6 @@
;;; jao-eshell-here.el --- Easy opening of eshell buffers -*- lexical-binding: t; -*-
-;; Copyright (C) 2021, 2023, 2024 jao
+;; Copyright (C) 2021, 2023 jao
;; Author: jao <mail@jao.io>
;; Keywords: eshell
@@ -33,8 +33,8 @@
"Value to use for `display-buffer-alist' when displaying the eshell buffer.")
(defun jao-eshell-here--find-window (b)
- (when-let* ((w (seq-find (lambda (w) (eq (window-buffer w) b))
- (window-list))))
+ (when-let (w (seq-find (lambda (w) (eq (window-buffer w) b))
+ (window-list)))
(select-window w)))
(defun jao-eshell-here--frame-buffer (&optional b)
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index d2bc70a..6cd5b24 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -1,6 +1,6 @@
;;; jao-minibuffer.el --- using the minibuffer to report status -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: extensions
@@ -40,7 +40,7 @@
(defun jao-minibuffer--trim (s w)
(if (< (string-width (or s "")) w)
(format (format "%%%ds" (if jao-minibuffer-align-right w (- w))) s)
- (substring s 0 w)))
+ (substring s 0 (min w (string-width s)))))
(defun jao-minibuffer--width ()
(cond ((numberp jao-minibuffer-frame-width) jao-minibuffer-frame-width)
@@ -69,12 +69,12 @@
(insert msg)))
(defun jao-minibuffer--strip-prev (msg)
- (if-let* ((n (text-property-any 0 (length msg) 'minibuffer-message t msg)))
+ (if-let ((n (text-property-any 0 (length msg) 'minibuffer-message t msg)))
(string-trim (substring msg 0 n))
msg))
(defun jao-minibuffer--prefix (msgs)
- (when-let* ((p (string-join (butlast msgs) "\n")))
+ (when-let (p (string-join (butlast msgs) "\n"))
(unless (string-blank-p p) (concat p "\n"))))
(defun jao-minibuffer--format-msg (msg)
@@ -97,7 +97,7 @@
info))
(sep (if msg " - " ""))
(pref (when info
- (let ((len (+ (length info) (length sep))))
+ (let ((len (+ (string-width info) (string-width sep))))
(format (format "\n%%%ds" len) ""))))
(msg (if (and msg pref)
(replace-regexp-in-string "\n" pref msg)
diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el
index a1fff73..2af868c 100644
--- a/lib/eos/jao-tracking.el
+++ b/lib/eos/jao-tracking.el
@@ -105,7 +105,7 @@
`(:propertize ,(plist-get s :propertize)
face
(jao-tracking-minibuffer
- ,@(when-let* ((f (plist-get s 'face)))
+ ,@(when-let ((f (plist-get s 'face)))
(jao-tracking-set-log " * ")
(list f))))
`(:propertize "|" face jao-tracking-minibuffer-sep)))
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el
index ab8823f..4f5081c 100644
--- a/lib/media/jao-mpc.el
+++ b/lib/media/jao-mpc.el
@@ -125,7 +125,7 @@
(defvar jao-mpc--idle-procs nil)
(defun jao-mpc--idle-loop (&optional port)
- (when-let* ((proc (alist-get port jao-mpc--idle-procs)))
+ (when-let (proc (alist-get port jao-mpc--idle-procs))
(ignore-errors (kill-process proc)))
(setf (alist-get port jao-mpc--idle-procs nil t)
(make-process :name (format "jao-mpc-idleloop (%s)" port)
@@ -146,7 +146,7 @@
(read-only-mode 1))
(defun jao-mpc--album-buffer ()
- (if-let* ((b (get-buffer jao-mpc--albums)))
+ (if-let (b (get-buffer jao-mpc--albums))
b
(with-current-buffer (get-buffer-create jao-mpc--albums)
(jao-mpc-albums-mode)
@@ -331,7 +331,7 @@
(jao-mpc--cmd jao-mpc--simple-albums-cmd port)
albums-str))
(albums (split-string albums-str "\n" t)))
- (when-let* ((album (completing-read "Play album: " albums nil t)))
+ (when-let (album (completing-read "Play album: " albums nil t))
(jao-mpc--add-and-play (car (split-string album "-" t " ")) port))))
(provide 'jao-mpc)
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index f2974ab..80d0675 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -1,6 +1,6 @@
;;; jao-mpris.el --- mpris players control -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021, 2022, 2024 jao
+;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: multimedia
@@ -97,7 +97,7 @@
jao-mpris--current nil))
(defun jao-mpris--get (k &optional l)
- (when-let* ((v (alist-get k (or l jao-mpris--current))))
+ (when-let (v (alist-get k (or l jao-mpris--current)))
(if (consp v) (car v) v)))
(defun jao-mpris--set-current (k v)
@@ -146,7 +146,7 @@
(interactive "P")
(when refresh (jao-mpris--track))
(when jao-mpris--current
- (jao-notify (format "%s%s" (if-let* ((s (jao-mpris--get 'status)))
+ (jao-notify (format "%s%s" (if-let (s (jao-mpris--get 'status))
(format "%s: " s)
"")
(jao-mpris--format)))))
@@ -158,26 +158,25 @@
(defun jao-mpris--handler (iname properties &rest _args)
(let ((inhibit-message t))
- (message "Received properties: %S from %s" properties iname))
- (when-let* ((md (caadr (assoc "Metadata" properties))))
- (let ((tno (caadr (assoc "xesam:trackNumber" md)))
- (tlt (caadr (assoc "xesam:title" md)))
- (art (caadr (assoc "xesam:artist" md)))
- (alb (caadr (assoc "xesam:album" md)))
- (len (caadr (assoc "mpris:length" md))))
- (if (string= (or tlt "") "TIDAL")
- (jao-mpris-reset)
+ (message "Received properties: %S from %s" properties iname)
+ (when-let (md (caadr (assoc "Metadata" properties)))
+ (let ((tno (caadr (assoc "xesam:trackNumber" md)))
+ (tlt (caadr (assoc "xesam:title" md)))
+ (art (caadr (assoc "xesam:artist" md)))
+ (alb (caadr (assoc "xesam:album" md)))
+ (len (caadr (assoc "mpris:length" md))))
(jao-mpris--set-current 'track tno)
(jao-mpris--set-current 'title tlt)
(jao-mpris--set-current 'artist art)
(jao-mpris--set-current 'album alb)
- (jao-mpris--set-current 'length len))))
- (when-let* ((st (or (caadr (assoc "PlaybackStatus" properties))
- (jao-mpris--get 'status))))
- (jao-mpris--set-current 'status st)
- (when (string= st "Stopped")
- (dolist (k '(track title artist album length))
- (jao-mpris--del-current k))))
+ (jao-mpris--set-current 'length len)))
+ (when-let (st (caadr (assoc "PlaybackStatus" properties)))
+ (jao-mpris--set-current 'status st)
+ (when (string= st "Stopped")
+ (dolist (k '(track title artist album length))
+ (jao-mpris--del-current k))))
+ ;; (message "Current is: %S" jao-mpris--current)
+ )
(jao-mpris--track jao-mpris--current))
;;;###autoload
diff --git a/lib/net/jao-eww-session.el b/lib/net/jao-eww-session.el
index 3c60cf8..4ac5447 100644
--- a/lib/net/jao-eww-session.el
+++ b/lib/net/jao-eww-session.el
@@ -97,7 +97,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(jao-eww-session-eww-buffers (current-buffer))))
(defun jao-eww--current-url ()
- (when-let* ((url (eww-current-url))) (url-encode-url url)))
+ (when-let (url (eww-current-url)) (url-encode-url url)))
(defun jao-eww-session--current-urls (&optional skip-current)
(let ((urls)
@@ -107,7 +107,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(dolist (b (jao-eww-session-eww-buffers (when skip-current cb))
(list pos (reverse urls)))
(set-buffer b)
- (when-let* ((url (jao-eww--current-url)))
+ (when-let (url (jao-eww--current-url))
(when (eq b cb) (setq pos count))
(setq count (1+ count))
(push (cons url (jao-eww-buffer-title)) urls)))))
@@ -133,7 +133,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(seq-filter
(lambda (b)
(with-current-buffer b
- (when-let* ((url (jao-eww--current-url)))
+ (when-let (url (jao-eww--current-url))
(when (member url urls)
(when (y-or-n-p "Already open session, abort? ")
(switch-to-buffer b)
@@ -218,7 +218,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(defun jao-eww-session-load ()
"Load last stored session into eww."
(interactive)
- (when-let* ((s (jao-eww-session-load-aux)))
+ (when-let ((s (jao-eww-session-load-aux)))
(let* ((urls (jao-eww-session-urls s))
(offset (jao-eww-session-offset s))
(buffers (unless (equal jao-eww-session-duplicate-tabs 'always)
diff --git a/lib/net/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el
index 1a03613..5cd42fa 100644
--- a/lib/net/jao-notmuch-gnus.el
+++ b/lib/net/jao-notmuch-gnus.el
@@ -1,6 +1,6 @@
;;; jao-notmuch-gnus.el --- notmuch-gnus interoperability -*- lexical-binding: t; -*-
-;; Copyright (C) 2022, 2024 jao
+;; Copyright (C) 2022, 2024, 2025 jao
;; Author: jao <mail@jao.io>
;; Keywords: mail
@@ -52,7 +52,7 @@
"Interactively add or remove tags to the current message."
(interactive)
(let* ((id (or id (jao-notmuch-gnus-message-id)))
- (current (unless tags (jao-notmuch-gnus-message-tags id)))
+ (current (or tags (jao-notmuch-gnus-message-tags id)))
(prompt (format "Change tags %s" (string-join current "/")))
(tags (or tags (notmuch-read-tag-changes current prompt))))
(notmuch-tag (concat "id:" id) tags)
@@ -62,9 +62,14 @@
(defun jao-notmuch-gnus-show-tags ()
"Display in the echo area the tags of the current message."
(interactive)
- (when-let* ((id (jao-notmuch-gnus-message-id)))
+ (when-let (id (jao-notmuch-gnus-message-id))
(message "%s" (string-join (jao-notmuch-gnus-message-tags id) " "))))
+(jao-transient-major-mode+ gnus-summary
+ ["Tags"
+ ("s" "show message tags" jao-notmuch-gnus-show-tags)
+ ("t" "tag message" jao-notmuch-gnus-tag-message)])
+
(defun jao-notmuch-gnus-toggle-tags (tags &optional id current)
"Toggle the given TAGS list for the current Gnus message."
(let* ((id (or id (jao-notmuch-gnus-message-id)))
@@ -76,9 +81,9 @@
(message "New tags: %s" (jao-notmuch-gnus-message-tags id))))
(defun jao-notmuch-gnus-tag-mark ()
- "Remove the new tag for an article when it's marked as seen by Gnus."
- (when-let* ((id (jao-notmuch-gnus-message-id t)))
- (jao-notmuch-gnus-tag-message id '("-new") t)))
+ "Remove the new and unread tags for an article when it's marked as seen by Gnus."
+ (when-let (id (jao-notmuch-gnus-message-id t))
+ (jao-notmuch-gnus-tag-message id '("-new" "-unread") t)))
(add-hook 'gnus-mark-article-hook #'jao-notmuch-gnus-tag-mark)
@@ -191,12 +196,12 @@ Example:
(org-gnus-follow-link group id)))
(defun jao-notmuch-gnus-org-store ()
- (when-let* ((d (or (when (derived-mode-p 'notmuch-show-mode 'notmuch-tree-mode)
- (cons (notmuch-show-get-message-id)
- (notmuch-show-get-subject)))
- (when (derived-mode-p 'gnus-summary-mode 'gnus-article-mode)
- (cons (jao-notmuch-gnus-message-id)
- (gnus-summary-article-subject))))))
+ (when-let (d (or (when (derived-mode-p 'notmuch-show-mode 'notmuch-tree-mode)
+ (cons (notmuch-show-get-message-id)
+ (notmuch-show-get-subject)))
+ (when (derived-mode-p 'gnus-summary-mode 'gnus-article-mode)
+ (cons (jao-notmuch-gnus-message-id)
+ (gnus-summary-article-subject)))))
(org-link-store-props :type "mail"
:link (concat "mail:" (car d))
:description (concat "Mail: " (cdr d)))))
@@ -223,6 +228,19 @@ Example:
(consult-customize jao-gnus-consult-notmuch :preview-key 'any))
+;;; tags and flags
+
+(defun jao-notmuch-gnus-flag-current (&rest _)
+ (jao-notmuch-gnus-tag-message nil '("+flagged") t))
+
+(defun jao-notmuch-gnus-unflag-current (&rest _)
+ (jao-notmuch-gnus-tag-message nil '("-flagged") t))
+
+(advice-add 'gnus-summary-tick-article-forward
+ :before #'jao-notmuch-gnus-flag-current)
+(advice-add 'gnus-summary-mark-as-read-forward
+ :before #'jao-notmuch-gnus-unflag-current)
+
;;; .
(provide 'jao-notmuch-gnus)
;;; jao-notmuch-gnus.el ends here
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 2dc4b70..aef9757 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -69,7 +69,7 @@
(user-error "No tree view for this buffer")))
(defun jao-notmuch-tree--looking-at-message ()
- (when-let* ((id (plist-get (notmuch-tree-get-message-properties) :id)))
+ (when-let (id (plist-get (notmuch-tree-get-message-properties) :id))
(equal (concat "*notmuch-id:" id "*")
(buffer-name (window-buffer notmuch-tree-message-window)))))
@@ -105,7 +105,7 @@
(goto-char (point-min))
(let ((pos (point)))
(while (setq pos (next-single-property-change pos 'w3m-href-anchor))
- (when-let* ((url (get-text-property pos 'w3m-href-anchor)))
+ (when-let ((url (get-text-property pos 'w3m-href-anchor)))
(when (stringp url) (cl-pushnew url res :test #'string=))))
(seq-uniq res #'string=))))
@@ -117,7 +117,7 @@
(defun jao-notmuch-browse-urls (&optional external)
(interactive "P")
- (if-let* ((urls (jao-notmuch-message-urls)))
+ (if-let ((urls (jao-notmuch-message-urls)))
(funcall (if external browse-url-secondary-browser-function #'browse-url)
(completing-read "Browse URL: " urls))
(message "No URLs in this message")))
@@ -131,22 +131,22 @@
(interactive)
(when (get-text-property (point) 'w3m-href-anchor)
(goto-char (next-single-property-change (point) 'w3m-href-anchor)))
- (if-let* ((pos (next-single-property-change (point) 'w3m-href-anchor)))
+ (if-let (pos (next-single-property-change (point) 'w3m-href-anchor))
(goto-char pos)
(or (forward-button 1 nil t t)
(ffap-next-guess))))
(defun jao-notmuch-show-previous-button ()
(interactive)
- (if-let* ((pos (previous-single-property-change (point) 'w3m-href-anchor)))
+ (if-let (pos (previous-single-property-change (point) 'w3m-href-anchor))
(goto-char (previous-single-property-change pos 'w3m-href-anchor))
(or (backward-button 1 nil t t)
(ffap-next-guess t))))
(defun jao-notmuch-show-ret ()
(interactive)
- (when-let* ((url (or (get-text-property (point) 'w3m-href-anchor)
- (thing-at-point-url-at-point))))
+ (when-let (url (or (get-text-property (point) 'w3m-href-anchor)
+ (thing-at-point-url-at-point)))
(browse-url url)))
@@ -215,7 +215,7 @@
;;; header line with thread message counts
(defun jao-notmuch--looking-at-new-p (&optional p)
- (when-let* ((ts (if p (plist-get p :tags) (notmuch-show-get-tags))))
+ (when-let (ts (if p (plist-get p :tags) (notmuch-show-get-tags)))
(or (member "unread" ts) (member "new" ts))))
(defsubst jao-notmuch-tree--first-p (&optional msg)
diff --git a/lib/net/jao-proton-utils.el b/lib/net/jao-proton-utils.el
index 0c9ccd7..62b97b3 100644
--- a/lib/net/jao-proton-utils.el
+++ b/lib/net/jao-proton-utils.el
@@ -86,7 +86,7 @@
(jao-proton-vpn--do "s"))
(defun proton-vpn--get-status ()
- (or (when-let* ((b (get-buffer jao-proton-vpn--buffer)))
+ (or (when-let ((b (get-buffer jao-proton-vpn--buffer)))
(with-current-buffer b
(goto-char (point-min))
(if (re-search-forward "^Status: *\\(.+\\)$" nil t)
diff --git a/lib/net/randomsig.el b/lib/net/randomsig.el
index cb37694..05b95ab 100644
--- a/lib/net/randomsig.el
+++ b/lib/net/randomsig.el
@@ -1,6 +1,6 @@
;;; randomsig.el --- insert a randomly selected signature
-;; Copyright (C) 2001, 2002, 2013, 2020, 2021 Hans-Jürgen Ficker
+;; Copyright (C) 2001, 2002, 2013, 2020, 2021, 2024 Hans-Jürgen Ficker
;; Emacs Lisp Archive Entry
;; Author: Hans-Juergen Ficker <hj@backmes.de>
@@ -277,8 +277,11 @@ You probably want to have a newline at the end of it."
(defun randomsig-prompt (&optional prompt)
;; Prompt for a signature file.
(let ((files (randomsig-files-to-list randomsig-files)))
- (completing-read (if prompt prompt "signature: ")
- (mapcar 'list files) nil t nil randomsig-history (car files))))
+ (if (cdr files)
+ (completing-read (if prompt prompt "signature: ")
+ (mapcar 'list files) nil t nil
+ randomsig-history (car files))
+ (car files))))
(defun randomsig-read-signatures-to-buffer (buffer-name &optional files)
;; read the signatures into the signature buffer
diff --git a/lib/prog/jao-compilation.el b/lib/prog/jao-compilation.el
index 5bea68e..c099701 100644
--- a/lib/prog/jao-compilation.el
+++ b/lib/prog/jao-compilation.el
@@ -67,7 +67,7 @@
;;;###autoload
(defun jao-compilation-root (&optional dir)
- (when-let* ((rfn (jao-compilation-find-root (or dir (buffer-file-name))
+ (when-let ((rfn (jao-compilation-find-root (or dir (buffer-file-name))
jao-compilation-dominating-rx)))
(let* ((default-directory (expand-file-name rfn))
(dir (file-name-directory rfn))
@@ -80,13 +80,13 @@
;;;###autoload
(defun jao-compilation-root-file ()
- (when-let* ((dir (jao-compilation-root)))
+ (when-let ((dir (jao-compilation-root)))
(car (directory-files dir nil jao-compilation-dominating-rx))))
;;;###autoload
(defun jao-find-compilation-root (dir)
(when (and (stringp dir) (file-exists-p dir))
- (when-let* ((root (jao-compilation-root dir)))
+ (when-let ((root (jao-compilation-root dir)))
(cons 'transient root))))
;;;###autoload
diff --git a/lib/themes/jao-themes.el b/lib/themes/jao-themes.el
index 706427b..f529842 100644
--- a/lib/themes/jao-themes.el
+++ b/lib/themes/jao-themes.el
@@ -597,7 +597,10 @@
(font-lock-type-face (p type))
(font-lock-variable-name-face (p variable-name))
(font-lock-warning-face (p warning))
+ (forge-pullreq-merged (p dimm))
(forge-pullreq-open (c nil nil))
+ (forge-pullreq-rejected (~ forge-pullreq-merged) st)
+ (forge-topic-pending (c nil nil))
(forge-topic-label bx)
(fringe (p dimm))
(fuel-font-lock-debug-error (p error) nul)
@@ -1189,7 +1192,7 @@
(push df fs)))))
(defun jao-themes--adjust-palette (p s)
- (if-let* ((v (alist-get s p))) (cons (cons s (car v)) (assoc-delete-all s p)) p))
+ (if-let (v (alist-get s p)) (cons (cons s (car v)) (assoc-delete-all s p)) p))
(defun jao-themes--let-palette (palette)
(let ((palette (seq-reduce #'jao-themes--adjust-palette '(fg bg box) palette)))