From aff40b3368324bf23bd9ef77586ca967f24788bf Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Tue, 9 Apr 2024 01:38:08 +0300 Subject: [PATCH] emacs: I probably won't run notmuch on termux, but... --- .emacs.d/init.el | 4 +++- .emacs.d/mail.el | 5 +++++ Emacs.org | 4 +++- Mail.org | 22 ++++++++++++++++++---- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 21740ba..23fdfd2 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1387,6 +1387,8 @@ Obeys `widen-automatically', which see." (setq doom-modeline-persp-icon nil) (setq doom-modeline-persp-name nil) (setq doom-modeline-display-misc-in-all-mode-lines nil) + (when my/is-termux + (setopt doom-modeline-icon nil)) :config (setq doom-modeline-minor-modes nil) (setq doom-modeline-irc nil) @@ -6588,7 +6590,7 @@ ENTRY is an instance of `elfeed-entry'." (lambda (&key error-thrown &allow-other-keys) (message "Error!: %S" error-thrown)))))) -(unless (or my/is-termux my/remote-server) +(unless (or my/remote-server) (let ((mail-file (expand-file-name "mail.el" user-emacs-directory))) (if (file-exists-p mail-file) (load-file mail-file) diff --git a/.emacs.d/mail.el b/.emacs.d/mail.el index fa21bf8..3850e00 100644 --- a/.emacs.d/mail.el +++ b/.emacs.d/mail.el @@ -6,6 +6,10 @@ (let ((default-directory dir)) (normal-top-level-add-subdirs-to-load-path)))) +(use-package notmuch + :straight t + :if my/is-termux) + (defun my/notmuch-toggle-trash () (interactive) (evil-collection-notmuch-toggle-tag "trash" "search" #'ignore)) @@ -69,6 +73,7 @@ (:name "pvkorytov (unread)" :query "tag:pvkorytov AND tag:unread" :key "vu") (:name "pvkorytov (sent)" :query "tag:pvkorytov AND tag:sent" :key "vs") (:name "pvkorytov (all mail)" :query "tag:pvkorytov" :key "va"))) +(setq notmuch-show-empty-saved-searches t) (general-define-key :states '(normal visual) diff --git a/Emacs.org b/Emacs.org index f7bdad7..6a36570 100644 --- a/Emacs.org +++ b/Emacs.org @@ -2192,6 +2192,8 @@ References: (setq doom-modeline-persp-icon nil) (setq doom-modeline-persp-name nil) (setq doom-modeline-display-misc-in-all-mode-lines nil) + (when my/is-termux + (setopt doom-modeline-icon nil)) :config (setq doom-modeline-minor-modes nil) (setq doom-modeline-irc nil) @@ -9156,7 +9158,7 @@ However, the quality of the output for Whisper is just so much better so I consi My notmuch config now resides in [[file:Mail.org][Mail.org]]. #+begin_src emacs-lisp -(unless (or my/is-termux my/remote-server) +(unless (or my/remote-server) (let ((mail-file (expand-file-name "mail.el" user-emacs-directory))) (if (file-exists-p mail-file) (load-file mail-file) diff --git a/Mail.org b/Mail.org index a874461..44ba55a 100644 --- a/Mail.org +++ b/Mail.org @@ -127,10 +127,15 @@ Notmuch is an email indexer program, which handles labels in a way somewhat simi Not much is going on here. -First, the database path. -#+begin_src conf-unix +First, the database path. It's different on desktop and termux. +#+NAME: get-maildir-path +#+begin_src emacs-lisp :tangle no +(expand-file-name "~/Mail") +#+end_src + +#+begin_src conf-unix :noweb yes [database] -path=/home/pavel/Mail +path=<> #+end_src My name and list of emails. It's not like it's a secret anyhow. @@ -146,7 +151,8 @@ A list of tags which will be added by =notmuch new= and directory names which wi #+begin_src conf-unix [new] tags=new; -ignore=.osync_workdir;.mbsyncstate;.uidvalidity;.lock;/.*gmailieer\.json.*/ +# ignore=.osync_workdir;.mbsyncstate;.uidvalidity;.lock;/.*gmailieer\.json.*/ +ignore=/.*[.](json|lock|bak|osync_workdir|mbsyncstate|uidvalidity)$/ #+end_src Exclude these tags from search by default. @@ -382,6 +388,13 @@ Then, the problem with my Guix setup is that Emacs by default doesn't see the el (normal-top-level-add-subdirs-to-load-path)))) #+end_src +On termux the above doesn't work so... +#+begin_src emacs-lisp +(use-package notmuch + :straight t + :if my/is-termux) +#+end_src + Some functions to toggle tags: #+begin_src emacs-lisp (defun my/notmuch-toggle-trash () @@ -486,6 +499,7 @@ The following formats the tables above to a proper syntax for =setq notmuch-save (setq notmuch-saved-searches '((:name "drafts" :query "tag:draft" :key "d") <>)) +(setq notmuch-show-empty-saved-searches t) #+end_src #+begin_src emacs-lisp