From 465e949bbba6c44c5eb40f6c53cdfa5f47d7ba0c Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 Aug 2021 02:23:35 +0100 Subject: notmuch.org: whitespace (sectioning) --- attic/misc.org | 13 ++ notmuch.org | 411 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 217 insertions(+), 207 deletions(-) diff --git a/attic/misc.org b/attic/misc.org index aedec78..c93b458 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -420,6 +420,19 @@ (global-company-mode 1) #+end_src +* notmuch-addr + #+begin_src emacs-lisp + (when (jao-load-path "notmuch-addr") + (with-eval-after-load 'notmuch-address + (jao-corfu-no-auto notmuch-message) + (defun jao-notmuch-message-corfu-setup () + (setq-local corfu-quit-no-match nil + corfu-commit-predicate t + orderless-component-separator " +")) + (add-hook 'notmuch-message-mode-hook #'jao-notmuch-message-corfu-setup) + (require 'notmuch-addr) + (notmuch-addr-setup))) + #+end_src * rcirc #+begin_src emacs-lisp :load no (use-package rcirc diff --git a/notmuch.org b/notmuch.org index ff6553e..830721a 100644 --- a/notmuch.org +++ b/notmuch.org @@ -33,8 +33,7 @@ " ")) (jao-minibuffer-refresh))) - (when (eq jao-afio-mail-function 'notmuch) - (jao-minibuffer-add-variable 'jao-notmuch-minibuffer-string -20)) + (jao-minibuffer-add-variable 'jao-notmuch-minibuffer-string -20) #+end_src * searches #+begin_src emacs-lisp @@ -120,29 +119,29 @@ (if widen jao-notmuch-widened-searches notmuch-saved-searches))) (notmuch-jump-search))) - (setq nnnm-saved-searches - (mapcar (lambda (s) - (list :query (plist-get s :query) :name (plist-get s :name))) - jao-notmuch-widened-searches)) - - #+end_src -* enclosures +#+end_src +* tags #+begin_src emacs-lisp - (with-eval-after-load "notmuch-show" - (defun jao-notmuch-open-enclosure (add) - (interactive "P") - (with-current-notmuch-show-message - (goto-char (point-min)) - (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)) - (progn - (message "%s %s ..." (if add "Adding" "Playing") url) - (unless add (jao-mpc-clear)) - (jao-mpc-add-url url) - (unless add (jao-mpc-play))) - (error "Found an enclosure, but not a link!")))))) + (setq notmuch-archive-tags '("+trove" "-new") + notmuch-show-mark-read-tags '("-new" "-unread") + notmuch-tag-formats + (let ((d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) + (e `(:foreground ,(face-attribute 'jao-themes-error :foreground)))) + `(("unread") + ("signed") + ("new" "N") + ("replied" "R") + ("sent" "S") + ("attachment" "📎") + ("deleted" "×××" (propertize tag 'face '(:underline nil ,@e))) + ("flagged" "*" (propertize tag 'face ',e)) + ("jao" "j") + ("bigml" "b") + ("feeds" "f"))) + notmuch-tag-deleted-formats + '(("unread") + ("new") + (".*" (notmuch-apply-face tag 'notmuch-tag-deleted)))) #+end_src * package #+begin_src emacs-lisp @@ -154,105 +153,73 @@ :init (setq notmuch-draft-folder "jao/drafts" notmuch-draft-quoted-tags '("part") - notmuch-column-control t - notmuch-hello-sections '(jao-notmuch-hello-insert-searches - notmuch-hello-insert-alltags - notmuch-hello-insert-header) - notmuch-hello-thousands-separator "," - notmuch-hello-auto-refresh t - notmuch-show-all-tags-list t - notmuch-show-logo nil - notmuch-show-empty-saved-searches nil - notmuch-show-only-matching-messages t - notmuch-show-part-button-default-action 'notmuch-show-view-part - notmuch-show-mark-read-tags '("-new" "-unread") - notmuch-archive-tags '("+trove" "-new") notmuch-address-internal-completion '(received nil) notmuch-fcc-dirs '(("\\(support\\|education\\)@bigml.com" . nil) (".*@bigml.com" . "bigml/sent +bigml +sent -new") (".*" . "jao/trove +jao +sent +trove -new")) notmuch-maildir-use-notmuch-insert t - notmuch-message-headers '("Subject" "To" "Cc" "Date" "List-Id") - notmuch-wash-signature-lines-max 0 - notmuch-wash-wrap-lines-length 80 - notmuch-wash-citation-lines-prefix 10 - notmuch-wash-citation-lines-suffix 20 - notmuch-tag-formats - (let ((d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) - (e `(:foreground ,(face-attribute 'jao-themes-error :foreground)))) - `(("unread") - ("signed") - ("new" "N") - ("replied" "R") - ("sent" "S") - ("attachment" "📎") - ("deleted" "×××" (propertize tag 'face '(:underline nil ,@e))) - ("flagged" "*" (propertize tag 'face ',e)) - ("jao" "j") - ("bigml" "b") - ("feeds" "f"))) - notmuch-tag-deleted-formats - '(("unread") - ("new") - (".*" (notmuch-apply-face tag 'notmuch-tag-deleted)))) - - (setq gnus-blocked-images ".") - (setq notmuch-show-text/html-blocked-images ".") + notmuch-message-headers '("Subject" "To" "Cc" "Date" "List-Id")) :config - (defun jao-notmuch-hello-insert-searches () - (when-let (searches (notmuch-hello-query-counts notmuch-saved-searches)) - (widget-insert "Saved searches:\n\n") - (let ((start (point))) - (let ((notmuch-column-control t)) - (notmuch-hello-insert-buttons searches)) - (indent-rigidly start (point) notmuch-hello-indent)))) - (when (eq 'notmuch jao-afio-mail-function) (setq message-directory "~/var/mail/" - message-auto-save-directory "/tmp") - (with-eval-after-load "notmuch-message" - (define-key message-mode-map (kbd "C-c C-d") - #'notmuch-draft-postpone))) - - (defconst jao-mail-clean-rx - (regexp-opt '("ElDiario.es - ElDiario.es: " "The Guardian: " - "The Conversation – Articles (UK): "))) - - (defun jao-mail-clean-address (fun address) - (let ((address - (if (string-match ".+ updates on arXiv.org: \\(.+\\)" address) - (with-temp-buffer - (insert (match-string 1 address)) - (let ((shr-width 1000)) - (shr-render-region (point-min) (point-max))) - (replace-regexp-in-string "\"" "" (buffer-string))) - (replace-regexp-in-string jao-mail-clean-rx "" address)))) - (funcall fun address))) + message-auto-save-directory "/tmp")) - (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address) + :bind (:map notmuch-common-keymap + (("E" . jao-notmuch-open-enclosure) + ("B" . jao-notmuch-browse-urls)) + :filter (eq 'notmuch jao-afio-mail-function) + :map message-mode-map + (("C-c C-d" . notmuch-draft-postpone)))) - (defun jao-notmuch-refresh-agenda () - (interactive) - (save-window-excursion (org-agenda-list)) - (with-current-buffer "*Calendar*" (calendar-goto-today))) - - (defun jao-notmuch-hello-first () - (interactive) - (let ((inhibit-message t)) - (beginning-of-buffer) - (widget-forward 1))) - - (defun jao-notmuch-refresh-hello () - (interactive) - (ignore-errors - (when (and (string= "Mail" (jao-afio-current-frame)) - (derived-mode-p 'notmuch-hello-mode)) - (when (not (string-blank-p jao-notmuch-minibuffer-string)) - (let ((notmuch-hello-auto-refresh nil)) (notmuch-hello))) - (jao-notmuch-hello-first)))) + (use-package jao-notmuch + :demand t + :config (setq jao-notmuch-mailboxes (jao-mailbox-folders))) + + #+end_src +* hello + #+begin_src emacs-lisp + (defun jao-notmuch-hello-insert-searches () + (when-let (searches (notmuch-hello-query-counts notmuch-saved-searches)) + (widget-insert "Saved searches:\n\n") + (let ((start (point))) + (let ((notmuch-column-control t)) + (notmuch-hello-insert-buttons searches)) + (indent-rigidly start (point) notmuch-hello-indent)))) + + (defun jao-notmuch-refresh-agenda () + (interactive) + (save-window-excursion (org-agenda-list)) + (with-current-buffer "*Calendar*" (calendar-goto-today))) + + (defun jao-notmuch-hello-first () + (interactive) + (let ((inhibit-message t)) + (beginning-of-buffer) + (widget-forward 1))) + + (defun jao-notmuch-refresh-hello () + (interactive) + (ignore-errors + (when (and (string= "Mail" (jao-afio-current-frame)) + (derived-mode-p 'notmuch-hello-mode)) + (when (not (string-blank-p jao-notmuch-minibuffer-string)) + (let ((notmuch-hello-auto-refresh nil)) (notmuch-hello))) + (jao-notmuch-hello-first)))) + + (use-package notmuch-hello + :init + (setq notmuch-column-control t + notmuch-hello-sections '(jao-notmuch-hello-insert-searches + notmuch-hello-insert-alltags + notmuch-hello-insert-header) + notmuch-hello-thousands-separator "," + notmuch-hello-auto-refresh t + notmuch-show-all-tags-list t + notmuch-show-logo nil + notmuch-show-empty-saved-searches nil) :hook ((notmuch-hello-refresh . jao-notmuch-notify) (jao-afio-switch . jao-notmuch-refresh-hello)) @@ -265,20 +232,80 @@ ("S" . consult-notmuch) ("g" . jao-notmuch-refresh-hello) ("." . jao-notmuch-hello-first) - ("SPC" . widget-button-press)) - :map notmuch-common-keymap - (("E" . jao-notmuch-open-enclosure)))) + ("SPC" . widget-button-press)))) - (use-package jao-notmuch - :demand t - :config (setq jao-notmuch-mailboxes (jao-mailbox-folders))) + #+end_src +* show + #+begin_src emacs-lisp + (defun jao-notmuch-open-enclosure (add) + (interactive "P") + (with-current-notmuch-show-message + (goto-char (point-min)) + (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)) + (progn + (message "%s %s ..." (if add "Adding" "Playing") url) + (unless add (jao-mpc-clear)) + (jao-mpc-add-url url) + (unless add (jao-mpc-play))) + (error "Found an enclosure, but not a link!"))))) + + (defconst jao-mail-clean-rx + (regexp-opt '("ElDiario.es - ElDiario.es: " "The Guardian: " + "The Conversation – Articles (UK): "))) + + (defun jao-mail-clean-address (fun address) + (let ((address + (if (string-match ".+ updates on arXiv.org: \\(.+\\)" address) + (with-temp-buffer + (insert (match-string 1 address)) + (let ((shr-width 1000)) + (shr-render-region (point-min) (point-max))) + (replace-regexp-in-string "\"" "" (buffer-string))) + (replace-regexp-in-string jao-mail-clean-rx "" address)))) + (funcall fun address))) + + (defun jao-notmuch-show-setup () (setq header-line-format nil)) + + (use-package notmuch-show + :init + (setq gnus-blocked-images "." + notmuch-show-only-matching-messages t + notmuch-show-part-button-default-action 'notmuch-show-view-part + notmuch-wash-signature-lines-max 0 + notmuch-wash-wrap-lines-length 80 + notmuch-wash-citation-lines-prefix 10 + notmuch-wash-citation-lines-suffix 20 + notmuch-show-text/html-blocked-images ".") + + :config + + (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address) + (add-hook 'notmuch-show-hook #'jao-notmuch-show-setup) + (jao-notmuch-show-prefer-html) + + :bind + (:map notmuch-show-mode-map + (("h" . jao-notmuch-goto-tree-buffer) + ("TAB" . jao-notmuch-show-next-button) + ("S-TAB" . jao-notmuch-show-previous-button) + ("RET" . jao-notmuch-show-ret)))) + + #+end_src +* search + #+begin_src emacs-lisp + (use-package notmuch-search + :bind (:map notmuch-search-mode-map + (("RET" . notmuch-tree-from-search-thread) + ("M-RET" . notmuch-search-show-thread)))) #+end_src -* search/tree view +* tree #+begin_src emacs-lisp (use-package notmuch-tree :config - (let ((fg (face-attribute 'jao-themes-dimm :foreground))) (dolist (f '(notmuch-tree-match-tree-face notmuch-tree-no-match-tree-face)) @@ -290,99 +317,35 @@ (replace-regexp-in-string "►" "" rs)) ;; "→" (t (truncate-string-to-width rs 102 nil nil t))))) - (advice-add 'notmuch-tree-format-field - :around #'jao-notmuch--format-field) - - (defun jao-notmuch-show-setup () - (setq header-line-format nil)) - - (add-hook 'notmuch-show-hook #'jao-notmuch-show-setup) - (jao-notmuch-show-prefer-html) + (advice-add 'notmuch-tree-format-field :around #'jao-notmuch--format-field) (jao-notmuch-tree-setup "T") :bind (:map notmuch-tree-mode-map - (("C" . jao-notmuch-echo-count) - ("d" . jao-notmuch-tree-delete-message) - ("D" . jao-notmuch-tree-delete-thread) - ("h" . jao-notmuch-goto-message-buffer) - ("H" . jao-notmuch-click-message-buffer) - ("i" . jao-notmuch-show-images) - ("K" . jao-notmuch-tag-jump-and-next) - ("k" . jao-notmuch-tree-read-thread) - ("M" . jao-notmuch-move-message) - ("n" . jao-notmuch-tree-next) - ("O" . notmuch-tree-toggle-order) - ("o" . jao-notmuch-tree-widen-search) - ("p" . jao-notmuch-tree-previous) - ("s" . jao-notmuch-tree-spam) - ("u" . jao-notmuch-tree-flag) - ("v" . notmuch-tree-scroll-message-window) - ("V" . notmuch-tree-scroll-message-window-back) - ("<" . jao-notmuch-tree-beginning-of-buffer) - (">" . jao-notmuch-tree-end-of-buffer) - ("/" . notmuch-tree-view-raw-message) - ("." . jao-notmuch-toggle-mime-parts) - ("=" . jao-notmuch-tree-toggle-message) - ("RET" . jao-notmuch-tree-show-or-scroll) - ("SPC" . jao-notmuch-tree-scroll-or-next)) - :map notmuch-search-mode-map - (("RET" . notmuch-tree-from-search-thread) - ("M-RET" . notmuch-search-show-thread)) - :map notmuch-show-mode-map - (("h" . jao-notmuch-goto-tree-buffer) - ("TAB" . jao-notmuch-show-next-button) - ("S-TAB" . jao-notmuch-show-previous-button) - ("RET" . jao-notmuch-show-ret)) - :map notmuch-common-keymap - (("B" . jao-notmuch-browse-urls)))) - #+end_src -* notmuch-addr - #+begin_src emacs-lisp - (when (jao-load-path "notmuch-addr") - (with-eval-after-load 'notmuch-address - (jao-corfu-no-auto notmuch-message) - (defun jao-notmuch-message-corfu-setup () - (setq-local corfu-quit-no-match nil - corfu-commit-predicate t - orderless-component-separator " +")) - (add-hook 'notmuch-message-mode-hook #'jao-notmuch-message-corfu-setup) - (require 'notmuch-addr) - (notmuch-addr-setup))) - #+end_src -* hydras - #+begin_src emacs-lisp - (major-mode-hydra-define notmuch-search-mode nil - ("Tagging" - (("*" notmuch-search-tag-all "tag all") - ("+" notmuch-search-add-tag "add tag") - ("-" notmuch-search-remove-tag "add tag") - ("k" notmuch-tag-jump "jump to tag")) - "Search" - (("l" notmuch-search-filter "filter with additional query") - ("t" notmuch-search-filter-by-tag "filter by tag") - ("y" notmuch-stash-query "stash current query")) - "Moving around" - (("b" notmuch-search-scroll-down "scroll down") - ("<" notmuch-search-first-thread "first thread") - (">" notmuch-search-last-thread "last thread")))) - - (major-mode-hydra-define notmuch-tree-mode nil - ("View" - (("." jao-notmuch-toggle-mime-parts "toggle mime parts") - ("i" jao-notmuch-show-images "toggle images") - ("a" notmuch-tree-archive-thread-then-next "archive thread") - ("C" jao-notmuch-echo-count "echo unread count")) - "Mark" - (("d" jao-notmuch-tree-delete-message "delete message") - ("D" jao-notmuch-tree-delete-thread "delete thread") - ("u" (jao-notmuch-tree-delete-message t) "undelete message") - ("k" jao-notmuch-tree-read-thread "kill thread")) - "Edit/send" - (("r" notmuch-tree-reply-sender "reply sender") - ("R" notmuch-tree-reply "reply all") - ("f" notmuch-tree-forward-message "forward") - ("e" notmuch-tree-resume-message "edit draft")))) + (("C" . jao-notmuch-echo-count) + ("d" . jao-notmuch-tree-delete-message) + ("D" . jao-notmuch-tree-delete-thread) + ("h" . jao-notmuch-goto-message-buffer) + ("H" . jao-notmuch-click-message-buffer) + ("i" . jao-notmuch-show-images) + ("K" . jao-notmuch-tag-jump-and-next) + ("k" . jao-notmuch-tree-read-thread) + ("M" . jao-notmuch-move-message) + ("n" . jao-notmuch-tree-next) + ("O" . notmuch-tree-toggle-order) + ("o" . jao-notmuch-tree-widen-search) + ("p" . jao-notmuch-tree-previous) + ("s" . jao-notmuch-tree-spam) + ("u" . jao-notmuch-tree-flag) + ("v" . notmuch-tree-scroll-message-window) + ("V" . notmuch-tree-scroll-message-window-back) + ("<" . jao-notmuch-tree-beginning-of-buffer) + (">" . jao-notmuch-tree-end-of-buffer) + ("/" . notmuch-tree-view-raw-message) + ("." . jao-notmuch-toggle-mime-parts) + ("=" . jao-notmuch-tree-toggle-message) + ("RET" . jao-notmuch-tree-show-or-scroll) + ("SPC" . jao-notmuch-tree-scroll-or-next)))) #+end_src * consult #+begin_src emacs-lisp @@ -448,3 +411,37 @@ :link link :description description))))))) #+end_src +* hydras + #+begin_src emacs-lisp + (major-mode-hydra-define notmuch-search-mode nil + ("Tagging" + (("*" notmuch-search-tag-all "tag all") + ("+" notmuch-search-add-tag "add tag") + ("-" notmuch-search-remove-tag "add tag") + ("k" notmuch-tag-jump "jump to tag")) + "Search" + (("l" notmuch-search-filter "filter with additional query") + ("t" notmuch-search-filter-by-tag "filter by tag") + ("y" notmuch-stash-query "stash current query")) + "Moving around" + (("b" notmuch-search-scroll-down "scroll down") + ("<" notmuch-search-first-thread "first thread") + (">" notmuch-search-last-thread "last thread")))) + + (major-mode-hydra-define notmuch-tree-mode nil + ("View" + (("." jao-notmuch-toggle-mime-parts "toggle mime parts") + ("i" jao-notmuch-show-images "toggle images") + ("a" notmuch-tree-archive-thread-then-next "archive thread") + ("C" jao-notmuch-echo-count "echo unread count")) + "Mark" + (("d" jao-notmuch-tree-delete-message "delete message") + ("D" jao-notmuch-tree-delete-thread "delete thread") + ("u" (jao-notmuch-tree-delete-message t) "undelete message") + ("k" jao-notmuch-tree-read-thread "kill thread")) + "Edit/send" + (("r" notmuch-tree-reply-sender "reply sender") + ("R" notmuch-tree-reply "reply all") + ("f" notmuch-tree-forward-message "forward") + ("e" notmuch-tree-resume-message "edit draft")))) + #+end_src -- cgit v1.2.3