diff options
| -rwxr-xr-x | bin/notmuch-delete.sh | 6 | ||||
| -rwxr-xr-x | bin/notmuch-gnus-tags.sh | 20 | ||||
| -rwxr-xr-x | bin/notmuch-tags.sh | 109 | ||||
| -rw-r--r-- | custom/jao-custom-eww.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-gnus.el | 15 | ||||
| -rw-r--r-- | custom/jao-custom-notmuch.el | 50 | ||||
| -rw-r--r-- | custom/jao-custom-org.el | 1 | ||||
| -rw-r--r-- | init.el | 16 | ||||
| -rw-r--r-- | lib/doc/jao-mac.el | 3 | ||||
| -rw-r--r-- | lib/eos/jao-afio.el | 4 | ||||
| -rw-r--r-- | lib/net/jao-notmuch.el | 58 |
11 files changed, 88 insertions, 196 deletions
diff --git a/bin/notmuch-delete.sh b/bin/notmuch-delete.sh deleted file mode 100755 index fc230a5..0000000 --- a/bin/notmuch-delete.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# [[file:../mail.org::*delete shell script][delete shell script:1]] -echo "Deleting $(notmuch count tag:deleted) files" -notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm -notmuch new 2>&1 -# delete shell script:1 ends here diff --git a/bin/notmuch-gnus-tags.sh b/bin/notmuch-gnus-tags.sh deleted file mode 100755 index 23e1358..0000000 --- a/bin/notmuch-gnus-tags.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# [[file:../mail.org::*notmuch tags][notmuch tags:1]] -notmuch new -[[ $1 ]] && notmuch compact - -for b in ~/.emacs.d/gnus/Mail/*; do - b="${b##*/}" - e="${b##*.}" - b="${b%.*}" - if [[ $e != $b ]]; then - notmuch tag "+$b" "+$e" -- tag:new and "folder:\"/(gnus/)?$b.$e/\""; - else - notmuch tag "+$b" -- tag:new and "folder:\"/(gnus/)?$b/\""; - fi -done - -notmuch-tags.sh - -notmuch tag +trove folder:/trove/ and not tag:trove -# notmuch tags:1 ends here diff --git a/bin/notmuch-tags.sh b/bin/notmuch-tags.sh deleted file mode 100755 index 03afc82..0000000 --- a/bin/notmuch-tags.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -for f in local feeds bigml jao; do - notmuch tag +$f -- tag:new and folder:$f -done -function tag_list () { - x=${2:-$1} - notmuch tag "+$1" -prog -drivel +lists "$3" "$4" -- "tag:new AND (List:$x OR Xref:$x)" -} - -for l in clojure elixir idris haskell erlang pharo; do - tag_list $l -done - -tag_list idris idris2 -tag_list pharo 6f667565c2569234585a7be77mc - -for l in haskellweekly commercialhaskell agda xmonad caml; do - tag_list haskell $l -done - -for l in xmobar notmuch mailutils lobsters; do - tag_list $l -done - -for l in kawa chicken guile gambit scheme chez racket; do - tag_list scheme $l -done - -# emacsy lists -for l in emacs-orgmode ding bbdb info-gnus-english; do - tag_list emacs $l -done - -for l in emacs-devel emacs-diffs; do - tag_list $l $l -emacs - notmuch tag "+$l" -emacs -prog -- tag:new AND to:$l -done - -tag_list emacs-bugs bug-gnu-emacs -emacs -tag_list emacs-help help-gnu-emacs -emacs - -for l in consult embark vertico marginalia orderless corfu; do - tag_list emacs-github $l -emacs -done - -tag_list hacking info-gnu -tag_list mdk bug-mdk -hacking -tag_list geiser geiser -scheme -emacs -function tag_bigml { - query="(tag:bigml from:@bigml or to:@bigml) and tag:new and $1" - shift - notmuch tag -inbox $* -- $query -} - -function tag_drivel { - for f in $*; do - tag_bigml "from:\"/.*($f).*/\"" +drivel -lists -deploys; - done -} - -tag_bigml "tag:new" +bigml -jao -tag_bigml "from:/.*uk/" +alba -drivel -tag_bigml "from:mbmcommercial" +alba -drivel -tag_bigml "to:info@bigml or from:/info/" +drivel - -tag_bigml "List:bigmlcom" +lists -tag_bigml "List:whizzml" +lists -tag_bigml "List:github" +lists -tag_bigml "(List:bigmlcom/wintermute OR List:bigmlcom/universe)" +bugs -lists -drivel -tag_bigml "List:support OR List:education" +support -inbox -drivel -lists -tag_bigml "from:\"BigML Support Transcript\"" -new +deleted -tag_bigml "from:production_reports@bigml.com" +deploys - -tag_bigml "subject:\"/.*(Confirmation code|Sameroom).*/\"" +drivel -lists -tag_drivel "gotowebinar\\.com" "digit\\.fyi" "noreply" "no-reply" -tag_drivel "slack\\.com" "globalvia\\." "ai-forum\\.com" "gsuite" "google voice" -tag_drivel "techcrunch\\.com" "demos@" "cognitionx\\." "cogx" -tag_drivel "events@" "marketing@" "security@" "info@" -tag_drivel "getrevue.com" "calendar-notification" "ed\\.ac\\.uk" -function killfile () { - notmuch tag -new -unread $2 -- tag:new AND $1 -} - -killfile "(tag:spam OR tag:trash)" - -killfile "from:incal@dataswamp.org" -killfile "from:\"Planet Clojure: Eric Normand\"" -killfile "from:\"Planet Clojure: Ivan Grishaev\"" - -killfile "subject:prefclean from:apt-listbugs" -killfile "subject:open-thread AND Rss:astralcodexten" +1d -killfile "subject:hidden-thread AND Rss:astralcodexten" +deleted - -gfeeds="grep -o -e feeds.*@localhost $HOME/.config/rss2email.cfg" -for f in $($gfeeds | sort | uniq); do - ftag=$(echo $f | sed 's/feeds.\(.*\)@localhost/\1/'); - notmuch tag +rss +feeds +$ftag -- tag:new AND folder:feeds AND to:$f -done - -notmuch tag +write +jao -words -drivel -feeds \ - -- "tag:new AND from:/campusdee?scrip?tura/" - -notmuch tag +logwatch -- "tag:new AND subject:logwatch" - -notmuch tag +mdk -- subject:mdk - -notmuch tag -drivel -new -unread -inbox +sent +jao -- \ - "tag:new AND from:\"/mail@jao.io|jao@gnu.org|jaor@pm.me/\"" diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index 221f442..dda2de9 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -24,7 +24,7 @@ ;;; multipart html renderer (defun jao-shr-html-renderer (handle) - (let* ((w (min 120 (- (window-width) 10))) + (let* ((w (min 10ai0 (- (window-width) 10))) (fill-column nil) (shr-width w) (shr-max-width w)) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index b3e1cb6..409860c 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -3,7 +3,7 @@ ;;; features (defvar jao-gnus-use-local-imap nil) (defvar jao-gnus-use-leafnode nil) -(defvar jao-gnus-use-gandi-imap nil) +(defvar jao-gnus-use-mailbox-imap nil) (defvar jao-gnus-use-pm-imap nil) (defvar jao-gnus-use-gmane nil) (defvar jao-gnus-use-nnml nil) @@ -220,10 +220,11 @@ :mailbox ,(if b (concat "Folders/" b) "INBOX"))) (or folders '(nil "drivel" "hacking" "bills" "prog" "words")))) -(setq mail-sources - (let* ((pwd (auth-source-pick-first-password :host "proton-bridge")) - (ims (jao-pm-label-mail-sources pwd))) - (append jao-local-mail-sources ims))) +(setq mail-sources '((file :path "/var/mail/jao")) + ;; (let* ((pwd (auth-source-pick-first-password :host "proton-bridge")) + ;; (ims (jao-pm-label-mail-sources pwd))) + ;; (append jao-local-mail-sources ims)) + ) (when jao-gnus-use-nnml (let ((prefix (expand-file-name "gnus/" jao-maildir))) @@ -251,9 +252,9 @@ (nnimap-stream network) (nnimap-server-port 1143)))) -(when jao-gnus-use-gandi-imap +(when jao-gnus-use-mailbox-imap (add-to-list 'gnus-secondary-select-methods - '(nnimap "gandi" (nnimap-address "mail.gandi.net")))) + '(nnimap "mailbox" (nnimap-address "imap.mailbox.org")))) ;;; groups (setq gnus-group-line-format diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index 96631fb..ee8872c 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -4,14 +4,6 @@ (defvar jao-notmuch-minibuffer-queries `((:name "" :query "tag:new and not tag:draft" :face jao-themes-f00) - (:name "B" :query "tag:new and tag:bigml and tag:inbox" :face default) - (:name "A" :query "tag:new and tag:alba" :face default) - (:name "b" :query "tag:new and tag:bigml and tag:bugs" - :face jao-themes-error) - (:name "S" :query "tag:new and tag:bigml and tag:support" :face default) - (:name "W" - :query "tag:new and tag:bigml and not tag:\"/support|bugs|inbox/\"" - :face default) (:name "I" :query "tag:new and tag:jao and tag:inbox" :face jao-themes-warning) (:name "W" :query "tag:new and tag:jao and tag:write" @@ -26,17 +18,30 @@ (:name "l" :query "tag:new and tag:local") (:name "F" :query "tag:new and tag:feeds and not tag:\"/emacs/\""))) +(defvar jao-notmuch-xbar-queries + `((:name "" :query "tag:new and not tag:draft" :face jao-themes-f00) + (:name "i" :query "tag:new and tag:/inbox|write|drivel/" + :face jao-themes-warning))) + +(defsubst jao-notmuch--qstr (c) + (format "%s%s" (plist-get c :name) (plist-get c :count))) + +(defun jao-notmuch-xbar () + (let ((cnts (notmuch-hello-query-counts jao-notmuch-xbar-queries))) + (jao-shell-exec (format "echo '%s | color=#8b3626 | size=11' >/tmp/xbar" + (mapconcat 'jao-notmuch--qstr cnts " "))))) + (defun jao-notmuch-notify () + (interactive) (let ((cnts (notmuch-hello-query-counts jao-notmuch-minibuffer-queries))) (setq jao-notmuch-minibuffer-string (mapconcat (lambda (c) - (propertize (format "%s%s" - (plist-get c :name) - (plist-get c :count)) + (propertize (jao-notmuch--qstr c) 'face (or (plist-get c :face) 'jao-themes-dimm))) cnts " ")) + (jao-when-darwin (jao-notmuch-xbar)) (jao-minibuffer-refresh))) (when jao-notmuch-enabled @@ -87,13 +92,15 @@ (widget-insert (propertize title 'face 'jao-themes-f00)) (notmuch-hello-insert-buttons searches)))) -(defmacro jao-notmuch-def-searches (name searches) +(defmacro jao-notmuch-def-searches (name searches &optional no-save) (declare (indent 1)) (let ((name (and name (format "%s" name))) (id (intern (format "jao-notmuch-%s-searches" (or name (gensym)))))) `(progn (defvar ,id ,searches) (defun ,id () (jao-notmuch-hello--insert-searches ,id ,name)) - (setq notmuch-saved-searches (append notmuch-saved-searches ,id)) + ,@(unless no-save + `((setq notmuch-saved-searches + (append notmuch-saved-searches ,id)))) (add-to-list 'notmuch-hello-sections ',id t)))) (setq notmuch-hello-sections nil notmuch-saved-searches nil) @@ -142,7 +149,8 @@ '("philosophy" "math" "physics" "sci" "gr-qc" "quant-ph"))) (jao-notmuch-def-searches flags - (jao-notmuch-widen-searches notmuch-saved-searches " AND tag:flagged")) + (jao-notmuch-widen-searches notmuch-saved-searches " AND tag:flagged") + t) (jao-notmuch-def-searches nil `(,(jao-notmuch--q "bml" "flagged" "rb" '("tag:flagged" "tag:bigml")) @@ -190,7 +198,8 @@ '("new" "unread" "flagged" "signed" "sent" "attachment" "forwarded" "inbox" "encrypted" "gmane" "gnus" "feeds" "rss" "mce" "trove" "prog" "emacs")) -(setq notmuch-archive-tags '("+trove" "-new" "-drivel" "-words" "-inbox") +(setq notmuch-archive-tags + '("+trove" "-hacking" "-new" "-drivel" "-words" "-inbox") notmuch-show-mark-read-tags '("-new" "-unread") notmuch-tag-formats (let (;; (d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) @@ -230,11 +239,7 @@ notmuch-always-prompt-for-sender t notmuch-draft-folder "drafts" notmuch-draft-quoted-tags '("part") - notmuch-fcc-dirs - '(("\\(support\\|education\\)@bigml.com" . nil) - ("mail@jao.io" . nil) - (".*@bigml.com" . "bigml -new -unread +sent +bigml") - (".*" . "jao -new -unread +sent +jao")) + notmuch-fcc-dirs '((".*" . "sent -new -unread +sent +jao")) notmuch-maildir-use-notmuch-insert t) :custom ((notmuch-address-internal-completion '(sent nil))) @@ -330,6 +335,7 @@ :bind (:map notmuch-hello-mode-map (("a" . jao-notmuch-refresh-agenda) + ("A" . jao-afio-open-mail) ("g" . jao-notmuch-refresh-hello) ("j" . jao-notmuch-jump-search) ("n" . jao-notmuch-hello-next) @@ -480,6 +486,7 @@ (defun jao-notmuch-before-tree (&rest _args) (when (string= (buffer-name) "*notmuch-hello*") (window-configuration-to-register ?G) + (when (< (frame-width) 230) (delete-other-windows)) (split-window-right 40) (other-window 1))) @@ -643,6 +650,9 @@ (with-eval-after-load "notmuch-hello" (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder))) +;;; org +(when jao-notmuch-enabled (jao-notmuch-org-links)) + ;;; recoll (jao-when-linux (defun jao-notmuch-open-file (fname &optional _page) diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el index 9dd6ab9..bf15f87 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -314,6 +314,7 @@ ;;; jao-org-focus (use-package jao-org-focus + :commands (jao-org-focus org-focus-mode) :after org :config (with-eval-after-load "jao-custom-completion" @@ -329,7 +329,7 @@ auth-sources '("~/.emacs.d/authinfo.gpg" "~/.netrc")) :config (add-to-list 'auth-source-protocols '(local "local")) - (jao-when-darwin (add-to-list 'auth-sources 'macos-keychain-generic))) + (jao-when-darwin (add-to-list 'auth-sources 'macos-keychain-generic t))) (use-package epa-file :demand t @@ -1115,10 +1115,11 @@ `((horizontal-scroll-bars . nil) (vertical-scroll-bars . nil) (scroll-bar-width . 0) - (menu-bar . nil) + ,@(jao-when-linux '((menu-bar . nil))) ,@(jao-when-darwin '((internal-border-width . 5) (width . 163) (height . 70) + (menu-bar . t) ;; (right-divider-width . 6) ;; (bottom-divider-width . 6) )))) @@ -1128,7 +1129,7 @@ (use-package fringe) (fringe-mode) -(menu-bar-mode -1) +(jao-when-linux (menu-bar-mode -1)) (setq ns-pop-up-frames nil) @@ -1803,6 +1804,10 @@ (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch)) (jao-def-exec-in-term "htop" "htop" (jao-afio-goto-scratch)) +(defun jao-sieve-manage () + (interactive) + (sieve-manage "imap.mailbox.org")) + (jao-d-l (progn (defun jao-open-firefox () (interactive) (jao-mac-open "-a Firefox")) @@ -1851,7 +1856,8 @@ ("f" "main" jao-afio-goto-main)] ["Network" ("s" "ssh" jao-ssh) - ("r" "r2e" jao-r2e)] + ("r" "r2e" jao-r2e) + ("S" "sieve" jao-sieve-manage)] ["Utilities" ("m" "mpc" jao-transient-media) ("l" "packages" jao-list-packages) @@ -1880,7 +1886,7 @@ ("s" "ssh" jao-ssh) ("b" "bluetooth" bluetooth-list-devices) ("c" "connect chats" jao-all-chats) - ("m" "proton bridge" run-proton-bridge)] + ("S" "sieve" jao-sieve-manage)] ["Chats" ("i" "irc" jao-chats-irc) ;; ("M" "mastodon" jao-mastodon) diff --git a/lib/doc/jao-mac.el b/lib/doc/jao-mac.el index cb16752..1f325c7 100644 --- a/lib/doc/jao-mac.el +++ b/lib/doc/jao-mac.el @@ -97,7 +97,8 @@ (defun jao-skim-current-doc () "Returns a list of path and page number for the current Skim doc." - (when-let* ((p (jao-mac-run-applescript jao-skim--current-file-script))) + (when-let* ((p (jao-mac-run-applescript jao-skim--current-file-script)) + (p (and (not (string-blank-p p)) p))) (let ((ps (split-string p "::"))) (list (car ps) (string-to-number (cadr ps)))))) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 162a1b7..235aa54 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -202,8 +202,8 @@ (setq reset (or reset (not (get-register next))))) (jao-afio--current-config next) (unless (eq current next) (setq jao-afio--previous-config current)) - (when reset (jao-afio-reset)) - (run-hooks 'jao-afio-switch-hook))))) + (when reset (jao-afio-reset))) + (run-hooks 'jao-afio-switch-hook)))) (defun jao-afio-goto-main (&optional reset) (interactive "P") diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 2471dc7..7ae9a4f 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -1,4 +1,4 @@ -;;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*- +;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*- ;; Copyright (C) 2021, 2022, 2023, 2024, 2025 jao @@ -167,7 +167,7 @@ (jao-notmuch-goto-tree-buffer t))) (defun jao-notmuch--view-html () - "Open the text/html part of the current message using `notmuch-show-view-part'." + "Open the text/html part of current message using `notmuch-show-view-part'." (interactive) (save-excursion (goto-char @@ -346,34 +346,21 @@ ;;; fcc -(defvar jao-notmuch-mua-reply-not-inherited - '("attachment" "sent" "new" "bigml" "jao" "trove")) - -(defun jao-notmuch-mua--fcc-dirs () - (let* ((otags (notmuch-show-get-tags)) - (trove (or (seq-some (lambda (x) (and (member x otags) x)) - '("hacking" "bills" "feeds" "jao")) - "jao")) - (tags (seq-difference otags jao-notmuch-mua-reply-not-inherited)) - (tagstr (mapconcat (lambda (s) (concat "+" s)) tags " ")) - (fcc (concat "trove/" trove " " tagstr " -new +sent +trove")) - (fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs)))) - (append fcc-dirs `((".*" . ,fcc))))) +(defvar jao-notmuch-tags-not-inherited + '("attachment" "sent" "new" "trove" "flagged" "drivel")) + +(defvar jao-notmuch-sent-dir "sent") (defun jao-notmuch-mua--inherited-fcc () - (let* ((fn (notmuch-show-get-filename)) - (dest (and (string-match ".*/\\(var/mail\\|Mail\\)/\\(.+?\\)/.+" fn) - (match-string 2 fn))) - (tags (seq-difference (notmuch-show-get-tags) - '("attachment" "sent" "new" "flagged"))) + (let* ((tags (seq-difference (notmuch-show-get-tags) + jao-notmuch-tags-not-inherited)) (tagstr (mapconcat (lambda (s) (concat "+" s)) tags " ")) - (fcc (concat dest " " tagstr " -new +sent +trove")) + (fcc (concat jao-notmuch-sent-dir " " tagstr " -new +sent")) (fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs)))) (append fcc-dirs `((".*" . ,fcc))))) (defun jao-notmuch-mua-new-reply (fun &rest args) - (let ((notmuch-fcc-dirs (and (not (notmuch-show-get-header :List-Id)) - (jao-notmuch-mua--inherited-fcc)))) + (let ((notmuch-fcc-dirs (jao-notmuch-mua--inherited-fcc))) (apply fun args))) (advice-add 'notmuch-mua-new-reply :around #'jao-notmuch-mua-new-reply) @@ -390,9 +377,10 @@ (seq-sort #'jao-notmuch-cmp-tags)))) (format-spec fmt `((?s . ,(mapconcat #'identity ts " ")))))) -(defun jao-notmuch-format-tree-and-subject (fmt msg) +(defun jao-notmuch-format-tree-and-subject (_fmt msg) (let ((tr (notmuch-tree-format-field "tree" " %s" msg)) - (sb (notmuch-tree-format-field "subject" " %s" msg))) + (sb (notmuch-tree-format-field "subject" " %s" msg)) + (fmt (format "%%>-%ds" (- (window-width) 60)))) (format-spec fmt `((?s . ,(concat tr sb)))))) (defun jao-notmuch-format-msg-ticks (mails-rx msg) @@ -404,4 +392,24 @@ (t " ")))) (provide 'jao-notmuch) +;;; org links +(defun jao-notmuch-id-file-name (id) + (let ((cmd (format "notmuch search --output=files id:%s" id))) + (car (split-string (shell-command-to-string cmd))))) + +(defun jao-notmuch-org-store () + (when-let* ((d (and (derived-mode-p '(notmuch-show-mode notmuch-tree-mode)) + (cons (notmuch-show-get-message-id) + (notmuch-show-get-subject))))) + (org-link-store-props :type "mail" + :link (concat "mail:" (car d)) + :description (concat "Mail: " (cdr d))))) + +(defun jao-notmuch-org-links () + (org-link-set-parameters "mail" + :follow #'notmuch-show + :store #'jao-notmuch-org-store) + (org-link-set-parameters "gnus" :store #'ignore) + (org-link-set-parameters "notmuch" :store #'ignore)) + ;;; jao-notmuch.el ends here |
