(Emacs/config)~generate mail signatures using fortune

Append a fortune to the end of my mail signature to make them more
interesting.
This commit is contained in:
2024-06-12 02:03:51 +01:00
parent 42a91ff120
commit 740a8eda15

View File

@@ -1472,7 +1472,6 @@ integrate it into my workflow just a bit better.
:keymaps 'notmuch-search-mode-map :keymaps 'notmuch-search-mode-map
"f" #'+mail/flag-thread) "f" #'+mail/flag-thread)
:init :init
(defconst +mail/signature "---------------\nAryadev Chavali")
(defconst +mail/local-dir (no-littering-expand-var-file-name "mail/")) (defconst +mail/local-dir (no-littering-expand-var-file-name "mail/"))
(setq notmuch-show-logo nil (setq notmuch-show-logo nil
notmuch-search-oldest-first nil notmuch-search-oldest-first nil
@@ -1480,21 +1479,8 @@ integrate it into my workflow just a bit better.
notmuch-hello-insert-alltags notmuch-hello-insert-alltags
notmuch-hello-insert-recent-searches) notmuch-hello-insert-recent-searches)
notmuch-archive-tags '("-inbox" "-unread" "+archive") notmuch-archive-tags '("-inbox" "-unread" "+archive")
mail-signature +mail/signature
mail-default-directory +mail/local-dir
mail-source-directory +mail/local-dir
message-signature +mail/signature
message-auto-save-directory +mail/local-dir message-auto-save-directory +mail/local-dir
message-directory +mail/local-dir) message-directory +mail/local-dir)
(defun +mail/sync-mail ()
"Sync mail via mbsync."
(interactive)
(start-process-shell-command "" nil "mbsync -a"))
(defun +mail/trash-junk ()
"Delete any mail in junk"
(interactive)
(start-process-shell-command "" nil "notmuch search --output=files --format=text0 tag:deleted tag:spam tag:trash tag:junk | xargs -r0 rm"))
:config :config
(defun +mail/flag-thread (&optional unflag beg end) (defun +mail/flag-thread (&optional unflag beg end)
(interactive (cons current-prefix-arg (notmuch-interactive-region))) (interactive (cons current-prefix-arg (notmuch-interactive-region)))
@@ -1502,9 +1488,6 @@ integrate it into my workflow just a bit better.
(notmuch-tag-change-list '("-inbox" "+flagged") unflag) beg end) (notmuch-tag-change-list '("-inbox" "+flagged") unflag) beg end)
(when (eq beg end) (when (eq beg end)
(notmuch-search-next-thread))) (notmuch-search-next-thread)))
(advice-add #'notmuch-poll-and-refresh-this-buffer :after
#'+mail/trash-junk)
(with-eval-after-load "evil-collection" (with-eval-after-load "evil-collection"
(evil-collection-notmuch-setup))) (evil-collection-notmuch-setup)))
#+end_src #+end_src
@@ -1522,6 +1505,25 @@ integrate it into my workflow just a bit better.
send-mail-function #'smtpmail-send-it send-mail-function #'smtpmail-send-it
message-send-mail-function #'smtpmail-send-it)) message-send-mail-function #'smtpmail-send-it))
#+end_src #+end_src
*** Mail signature using fortune
#+begin_src emacs-lisp
(use-package fortune
:init
(setq fortune-dir "/usr/share/fortune"
fortune-file "/usr/share/fortune/cookie")
:config
(defvar +mail/signature "---------------\nAryadev Chavali\n---------------\n%s")
(defun +mail/make-signature ()
(interactive)
(format +mail/signature
(with-temp-buffer
(let ((fortune-buffer-name (current-buffer)))
(fortune-in-buffer t)
(if (bolp) (delete-char -1))
(buffer-string)))))
(add-hook 'message-setup-hook
(lambda nil (setq message-signature (+mail/make-signature)))))
#+end_src
** Dired ** Dired
Dired: Directory editor for Emacs. An incredibly nifty piece of Dired: Directory editor for Emacs. An incredibly nifty piece of
software which deeply integrates with Emacs as a whole. Probably the software which deeply integrates with Emacs as a whole. Probably the