From 00751f164818438a4abd155af6e625aea4101e8b Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 23 Apr 2021 23:44:37 +0100 Subject: more little notmuch improvements (scroll, fcc) --- email.org | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/email.org b/email.org index 279c62e..48f62e5 100644 --- a/email.org +++ b/email.org @@ -120,29 +120,19 @@ "No attachment. Send the message? " nil nil)) (error "No message sent"))))) #+END_SRC -*** Check Gcc - #+BEGIN_SRC emacs-lisp +*** Check Fcc/Gcc + #+begin_src emacs-lisp (defun jao-message-check-gcc () "Ask whether to keep a copy of message." (save-excursion (save-restriction (message-narrow-to-headers) - (when (and (message-fetch-field "Gcc") + (when (and (or (message-fetch-field "Gcc") + (message-fetch-field "Fcc")) (not (y-or-n-p "Archive? "))) - (message-remove-header "Gcc"))))) - - (defun jao-message-toggle-gcc () - "Insert or remove the \"Gcc\" header." - (interactive) - (save-excursion - (save-restriction - (message-narrow-to-headers) - (if (message-fetch-field "Gcc") - (message-remove-header "Gcc") - (gnus-inews-insert-gcc))))) - - ;; (define-key message-mode-map [(f6)] 'jao-message-toggle-gcc) - #+END_SRC + (message-remove-header "Gcc") + (message-remove-header "Fcc"))))) + #+end_src *** Check recipient #+begin_src emacs-lisp (defun jao-message-check-recipient () @@ -329,9 +319,10 @@ (setq smtpmail-queue-dir (jao-gnus-dir "Mail/queued-mail/")) - (setq mail-source-directory (jao-gnus-dir "Mail/") - message-auto-save-directory (jao-gnus-dir "Mail/drafts/") - message-directory (jao-gnus-dir "Mail/")) + (with-eval-after-load "gnus" + (setq mail-source-directory (jao-gnus-dir "Mail/") + message-auto-save-directory (jao-gnus-dir "Mail/drafts/") + message-directory (jao-gnus-dir "Mail/"))) (setq gnus-default-directory (expand-file-name "~") gnus-startup-file (jao-gnus-dir "newsrc") @@ -577,9 +568,17 @@ (when (not (window-live-p notmuch-tree-message-window)) (notmuch-tree-show-message nil)))) + (defun jao-notmuch-tree-show-or-scroll () + "Show current message, or scroll it if visible." + (interactive) + (if (window-live-p notmuch-tree-message-window) + (scroll-other-window 1) + (notmuch-tree-show-message nil))) + (dolist (f '(notmuch-tree-match-tree-face notmuch-tree-no-match-tree-face)) - (set-face-attribute f :family "Source Code Pro" :foreground "grey60")) + (set-face-attribute f nil + :family "Source Code Pro" :foreground "grey60")) (defun jao-notmuch--format-field (fun field &rest args) (let ((rs (apply fun field args))) @@ -596,13 +595,19 @@ ("h" . jao-notmuch-goto-message-buffer) ("k" . jao-notmuch-tag-jump) ("n" . jao-notmuch-tree-next) + ("RET" . jao-notmuch-tree-show-or-scroll) ("SPC" . jao-notmuch-tree-scroll-or-next)))) #+end_src *** message #+begin_src emacs-lisp (use-package notmuch-message - :init (setq notmuch-fcc-dirs '(("jao@bigml.com" . "bigml/sent") - (".*" . "jao/sent"))) + :init (setq notmuch-fcc-dirs + '((".*@bigml.com" . "bigml/sent +bigml +sent -new") + (".*" . "jao/sent +jao +sent -new")) + notmuch-maildir-use-notmuch-insert t) + :config (setq message-directory "~/var/mail/" + message-auto-save-directory + (expand-file-name "drafts" message-directory)) :bind (:map notmuch-message-mode-map (("C-c C-d" . notmuch-draft-postpone)))) -- cgit v1.2.3