- ;; dired - reuse current buffer by pressing 'a'
- (put 'dired-find-alternate-file 'disabled nil)
-
-;;; mu4e
-
- ;; alsot tried notmuch, it had some glitches, and it's config has a list
- ;; of folders which i'd rather not publish, so it's config is archived.
-
- ;;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
- ;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
- ;; (require 'mu4e)
-
- ;; (setq mu4e-headers-results-limit 2000)
-
-
- (defun my-mu4e-init ()
- (setq mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields))
- ;; it's implemented in mu4e, but not in the actions list for
- ;; some reason.
- (add-to-list 'mu4e-view-actions
- '("browser view" . mu4e-action-view-in-browser) t)
-
- (add-to-list 'mu4e-headers-actions
- '("from this sender" . mu4e-action-msgs-by-this-sender) t)
- (add-to-list 'mu4e-view-actions
- '("from this sender" . mu4e-action-msgs-by-this-sender) t)
- ;; normally, you would add to this, but we want to
- ;; modify unread messages. the first 4 are defined by default.
- (setq mu4e-bookmarks
- `( ,(make-mu4e-bookmark
- :name "Unread messages"
- ;; old less restrictive unread, for adapting in the future:
- ;; flag:unread AND NOT flag:trashed AND NOT maildir:/Junk AND NOT maildir:/fwfw AND NOT maildir:/log
- :query "flag:unread maildir:/INBOX"
- :key ?u)
- ,(make-mu4e-bookmark
- :name "Today's messages"
- :query "date:today..now"
- :key ?t)
- ,(make-mu4e-bookmark
- :name "Last 7 days"
- :query "date:7d..now"
- :key ?w)
- ,(make-mu4e-bookmark
- :name "Messages with images"
- :query "mime:image/*"
- :key ?p))
- )
- )
-
- (eval-after-load "mu4e" '(my-mu4e-init))
-
- (setq
- ;; common to gnus. default sendmail-query-once asks us, then sets this via customize.
- send-mail-function (quote sendmail-send-it)
- ;; use the standard imap folders
- mu4e-sent-folder "/Sent"
- mu4e-drafts-folder "/Drafts"
- mu4e-trash-folder "/Trash"
- ;; reindex new mail this often in seconds
- ;; show addresses instead of just names
- mu4e-view-show-addresses t
- mu4e-use-fancy-chars t
- mu4e-confirm-quit nil
- mu4e-headers-leave-behavior 'apply ;; dont ask, do whatever was marked
- ;; default 500.
- mu4e-headers-results-limit 1000
- ;; tell exim to use from: as envelope from.
- ;; exim's default is use outgoing_msg_localpart@hostname.
- mail-specify-envelope-from t
-
- ;; looking up the list of maildirs when doing jo from summary
- ;; can take a few seconds if we have a ton of messages.
- ;; Only take that time for the first lookup.
- ;; if we add a new maildir, just restart mu4e for it to be in that list.
- mu4e-cache-maildir-list t
- ;; default is 8, way too small for my big monitors
- mu4e-headers-visible-lines 50
- )
-
- ;; fucks up reading unread bookmark. when that is fixed, enable it
- ;; (setq mu4e-update-interval 60)
-
-
- ;; this file includes setting up my email addresses, which are not public,
- ;; including
- ;; mu4e-user-mail-address-list
- ;; and a function
- ;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
- (load "/p/c/mymu4e.el")
-
- (defun my-decrypt ()
- ;; use for decrypting in mu4e
- (interactive)
- (beginning-of-buffer)
- (when (search-forward "-----BEGIN PGP MESSAGE-----" nil t)
- (read-only-mode 0)
- (let ((start (match-beginning 0))
- (end (search-forward "-----END PGP MESSAGE-----" nil t)))
- (shell-command-on-region start end "gpg2 -dq" nil t shell-command-default-error-buffer t)
- )))
- (add-hook 'mu4e-view-mode-hook 'my-decrypt)
-
- (defun mu-set-from-name (regexes)
- "If we find an address matching regex, then set that address as the to,
-and whatever was used"
- (when mu4e-compose-parent-message
- (let ((found nil))
- (while (and regexes (not found))
- (setq re (car regexes)
- regexes (cdr regexes)
- found (mu4e-message-contact-field-matches
- mu4e-compose-parent-message :to re)))
- (when found (setq user-mail-address (cdr found)
- user-full-name (car found)))
- found)))
- (defun mu-set-from (regexes)
- "If we find an address matching regex, then set that address as the to,
-and Ian Kelling as the name"
- (when mu4e-compose-parent-message
- (let ((found nil))
- (while (and regexes (not found))
- (setq re (car regexes)
- regexes (cdr regexes)
- found (cdr (mu4e-message-contact-field-matches
- mu4e-compose-parent-message :to re))))
- (when found (setq user-mail-address found
- user-full-name "Ian Kelling"))
- found)))
-
-
- (defun my-mu4e-to-fsf ()
- "inspired by mu4e info manual, search for mu4e-compose-pre-hook."
- (cond
- ((mu-set-from '("iank@fsf.org"
- "iank@gnu.org")))
- ((setq user-mail-address "iank@fsf.org"
- user-full-name "Ian Kelling"))))
-
-
- ;; on first run mkdir -p /nocow/user/.mufsf; mu index --maildir=/nocow/user/fsfmd
- (defun mu-exit-wait ()
- (interactive)
- ;; taken from the mu source
- (let* ((buf (get-buffer mu4e~proc-name))
- (proc (and (buffer-live-p buf) (get-buffer-process buf))))
- (mu4e-quit)
- ;; without sleep, we get database locked by another process error when hitting u
- ;; if another mu was running.
- (if proc (sleep-for 0 1000))))
-
- (defun fsf-mu4e ()
- (interactive)
- (require 'mu4e)
- (unless (equal mu4e-maildir "/nocow/user/fsfmd") (mu-exit-wait))
- (setq
- ;; fsf monitor is smaller
- mu4e-headers-visible-lines 15
- mu4e-maildir "/nocow/user/fsfmd"
- mu4e-refile-folder "/Spam"
- mu4e-index-lazy-check nil
- mu4e-get-mail-command "true"
- user-mail-address "iank@fsf.org"
- ;; WARNING: be careful editing this, there needs to be a space after --, and my editor
- ;; and git will automatically remove it unless i manually disable it.
- mail-signature "
-
---
-Ian Kelling | Senior Systems Administrator, Free Software Foundation
-GPG Key: B125 F60B 7B28 7FF6 A2B7 DF8F 170A F0E2 9542 95DF
-https://fsf.org | https://gnu.org
-"
-
- mu4e-user-mail-address-list '("iank@fsf.org"
- "iank@gnu.org")
- mu4e-maildir-shortcuts
- '( ("/INBOX" . ?i)
- ("/sysadmin" . ?a)
- ("/sec" . ?x)
- ("/rtcc" . ?c)
- ("/Drafts" . ?d)
- ("/Sent" . ?s)
- )
- ) ;; end setq
- (call-process "/a/exe/lnf" nil nil nil "-T" "/nocow/user/.mufsf" (concat (getenv "HOME") "/.mu"))
- (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to-fsf)
- (remove-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
- (mu4e)) ;; end defun fsf-mu4e
-
-
-
-
- (defun mu4e-action-msgs-by-this-sender (msg)
- "In header view, view messages by the sender of the message under point."
- (let ((from (mu4e-message-field msg :from)))
- (unless from
- (mu4e-error "No from header for this message"))
- ;; from is structured like: (("Anacron" . "root@x2.lan"))
- (mu4e-headers-search (concat "f:" (cdar from)))))
-