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 | 4 | ||||
| -rw-r--r-- | custom/jao-custom-notmuch.el | 56 | ||||
| -rw-r--r-- | custom/jao-custom-org.el | 5 | ||||
| -rw-r--r-- | lib/doc/jao-mac.el | 21 | ||||
| -rw-r--r-- | lib/doc/jao-org-links.el | 3 | ||||
| -rw-r--r-- | lib/eos/jao-afio.el | 2 | ||||
| -rw-r--r-- | lib/net/jao-notmuch.el | 6 |
10 files changed, 68 insertions, 164 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 dda2de9..30dbdf9 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -23,8 +23,10 @@ (setq eww-use-browse-url "^\\(gemini\\|gopher\\):") ;;; multipart html renderer +(defvar jao-shr-max-width 110) + (defun jao-shr-html-renderer (handle) - (let* ((w (min 10ai0 (- (window-width) 10))) + (let* ((w (min jao-shr-max-width (- (window-width) 10))) (fill-column nil) (shr-width w) (shr-max-width w)) diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index ee8872c..68a7d99 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -73,12 +73,13 @@ (notmuch-tree-close-message-window) (notmuch-tree (string-replace jao-notmuch--newa "" query))))) +(defun jao-notmuch--widen (s &optional extra) + (let* ((q (plist-get s :query)) + (qs (string-replace jao-notmuch--newa "" q))) + (plist-put (copy-sequence s) :query (concat qs extra)))) + (defun jao-notmuch-widen-searches (searches &optional extra) - (mapcar (lambda (s) - (let* ((q (plist-get s :query)) - (qs (string-replace jao-notmuch--newa "" q))) - (plist-put (copy-sequence s) :query (concat qs extra)))) - searches)) + (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)) @@ -92,26 +93,29 @@ (widget-insert (propertize title 'face 'jao-themes-f00)) (notmuch-hello-insert-buttons searches)))) +(defun jao-notmuch--replace (lst s) + (let ((n (plist-get s :name))) + (set lst (seq-remove (lambda (s0) (string= name (plist-get s0 :name))) + (symbol-value lst))) + (add-to-list lst s t))) + +(defun jao-notmuch-add-saved-searches (searches) + (dolist (s searches) + (jao-notmuch--replace 'notmuch-saved-searches s) + (jao-notmuch--replace 'jao-notmuch-widened-searches s))) + (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)) - ,@(unless no-save - `((setq notmuch-saved-searches - (append notmuch-saved-searches ,id)))) + ,@(unless no-save `((jao-notmuch-add-saved-searches ,id))) (add-to-list 'notmuch-hello-sections ',id t)))) -(setq notmuch-hello-sections nil notmuch-saved-searches nil) +(defvar jao-notmuch-widened-searches nil) -;; (jao-notmuch-def-searches bigml -;; `(,(jao-notmuch--q "bigml" "inbox" "bi") -;; ,(jao-notmuch--q "bigml" "alba" "ba") -;; ,(jao-notmuch--q "bigml" "support" "bs") -;; ,(jao-notmuch--q "bigml" "bugs" "bb") -;; ,(jao-notmuch--q "bigml" "drivel" "bd") -;; ,(jao-notmuch--q "bigml" "lists" "bl"))) +(setq notmuch-hello-sections nil notmuch-saved-searches nil) (jao-notmuch-def-searches inbox `(,(jao-notmuch--q "jao" "inbox" "ji") @@ -124,20 +128,21 @@ ,(jao-notmuch--qn "jao" "local" "jl" '("tag:local")))) (jao-notmuch-def-searches news - (mapcar #'jao-notmuch--sq '("news" "noticias" "fun" "words" "computers"))) + (mapcar #'jao-notmuch--sq + '("news" "noticias" "fun" "words" "computers" "pens"))) (jao-notmuch-def-searches hacking (mapcar #'jao-notmuch--sq '("xmobar" "geiser" "mdk" "mailutils" "notmuch"))) (jao-notmuch-def-searches prog (append (mapcar #'jao-notmuch--sq - '("lobsters" "clojure" "lisp" "scheme" + '("emacs" "lobsters" "clojure" "lisp" "scheme" "haskell" "idris" "erlang" "pharo" "rust")) `(,(jao-notmuch--qn "feeds" "prog" "fp" '("tag:prog" "not tag:\"/emacs/\""))))) (jao-notmuch-def-searches emacs - `(,(jao-notmuch--sq "emacs" "ee" "emacs" "feeds") + `(;; ,(jao-notmuch--sq "emacs" "ee" "emacs" "feeds") ,(jao-notmuch--sq "emacs-help" "eh" "emacs" "help") ,(jao-notmuch--sq "emacs-github" "eg" "emacs" "github") ,(jao-notmuch--sq "emacs-devel" "ed" "emacs" "devel") @@ -178,15 +183,11 @@ '("jao" "hacking" "feeds" "bills"))) (jao-notmuch-def-searches nil - '((:query "not tag:trove and not tag:bigml" :name "jao/untroved" + '((:query "not tag:trove and not tag:hacking" :name "jao/untroved" :search-type tree) - (:query "tag:sent and tag:bigml" :name "bigml/sent" :search-type tree) - (:query "tag:sent and not tag:bigml" :name "jao/sent" :search-type tree) + (:query "tag:sent" :name "jao/sent" :search-type tree) (:query "*" :name "messages" :search-type tree))) -(defvar jao-notmuch-widened-searches - (jao-notmuch-widen-searches notmuch-saved-searches)) - (defun jao-notmuch-jump-search (&optional widen) (interactive "P") (let ((notmuch-saved-searches @@ -522,6 +523,7 @@ ("h" . jao-notmuch-goto-message-buffer) ("i" . jao-notmuch-toggle-images) ("k" . jao-notmuch-tree-read-thread) + ("K" . jao-notmuch-tree-mark-all-read) ("N" . jao-notmuch-tree--forward) ("O" . notmuch-tree-toggle-order) ("o" . jao-notmuch-tree-widen-search) @@ -621,7 +623,9 @@ (org-capture nil "X")))) ;;; html renderer -(when jao-notmuch-enabled (setq mm-text-html-renderer 'shr)) + +;; we can use the default defined in jao-custom-ewww +;; (when jao-notmuch-enabled (setq mm-text-html-renderer 'shr)) ;;; consult (jao-when-linux diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el index bf15f87..4021955 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -108,6 +108,11 @@ (window-parameters (mode-line-format . none)) (body-function . jao-org-agenda-hook))) +(add-to-list 'display-buffer-alist + '("inbox\\.org" + (display-buffer-reuse-window) + (window-parameters (mode-line-format . none)))) + ;;; Capture templates (setq org-capture-templates '(("t" "TODO" entry diff --git a/lib/doc/jao-mac.el b/lib/doc/jao-mac.el index 1f325c7..ad11ea2 100644 --- a/lib/doc/jao-mac.el +++ b/lib/doc/jao-mac.el @@ -107,6 +107,27 @@ (when-let* ((ps (jao-skim-current-doc))) (apply 'jao-open-doc ps))) +(defvar jao-skim--current-page-text + (jao-mac-applescript-prepare + "tell application \"Skim\"" + "return the text of the current page of the front document" + "end tell")) + +(defun jao-skim-page-text () + (jao-mac-run-applescript jao-skim--current-page-text)) + +(defun jao-skim-view-page-text () + (interactive) + (when-let* ((ps (jao-skim-current-doc)) + (p (car ps)) + (n (cadr ps)) + (txt (jao-skim-page-text)) + (bn (format "*%s - %s - txt*" p n))) + (with-current-buffer (get-buffer-create bn) + (delete-region (point-min) (point-max)) + (insert txt) + (pop-to-buffer (current-buffer))))) + ;;; NetNewsWire (defvar jao-nnw--current-article-script diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el index 5547c9b..95f2d67 100644 --- a/lib/doc/jao-org-links.el +++ b/lib/doc/jao-org-links.el @@ -18,7 +18,8 @@ (defun jao-org-links--open-pdf (link) "Open LINK using `jaor-org-open-pdf-fn'." - (cond ((string-match "\\(.*\\)::\\([0-9]*\\)\\+\\+\\([[0-9]\\.*[0-9]*\\)" link) + (cond ((string-match "\\(.*\\)::\\([0-9]*\\)\\+\\+\\([[0-9]\\.*[0-9]*\\)" + link) (let* ((path (match-string 1 link)) (page (string-to-number (match-string 2 link))) (height (string-to-number (match-string 3 link)))) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 235aa54..99152b0 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -72,7 +72,7 @@ (defun jao-afio-open-pdf-session (&optional docs) (interactive) (dolist (doc (or docs (jao-doc-session))) - (when (and doc (file-exists-p doc)) + (when (and (stringp doc) (file-exists-p doc)) (if (jao-pdf-is-pdf-file doc) (jao-open-doc doc) (find-file doc)) (other-window 1))) (other-window 1)) diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 7ae9a4f..73f6420 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -316,6 +316,12 @@ (let ((undo (jao-notmuch--has-tag "deleted"))) (jao-notmuch-tree-tag-thread '("+deleted" "-new" "-unread") undo full))) +(defun jao-notmuch-tree-mark-all-read () + (interactive) + (when-let* ((q notmuch-tree-basic-query)) + (when (yes-or-no-p "Mark all messages as read? ") + (notmuch-tag q '("-new" "-unread"))))) + (defun jao-notmuch-tree-read-thread (full) (interactive "P") (jao-notmuch-tree-tag-thread '("-unread" "-new") nil full)) |
