mu4e: Split libraries into outline sections

This commit is contained in:
Jonas Bernoulli 2020-02-11 15:10:35 +01:00 committed by Dirk-Jan C. Binnema
parent 040c6578be
commit 74332947a0
15 changed files with 239 additions and 203 deletions

View File

@ -26,6 +26,7 @@
;; manual)
;;; Code:
(require 'cl-lib)
(require 'ido)
@ -42,19 +43,17 @@
(defvar mu4e-view-date-format)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e-action-count-lines (msg)
"Count the number of lines in the e-mail MSG.
Works for headers view and message-view."
(message "Number of lines: %s"
(shell-command-to-string
(concat "wc -l < " (shell-quote-argument (mu4e-message-field msg :path))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-msg2pdf
(let ((exec-path (cons (concat mu4e-builddir "/toys/msg2pdf/") exec-path)))
(locate-file "msg2pdf" exec-path exec-suffixes))
@ -75,8 +74,8 @@ Works for the message view."
(unless (and pdf (file-exists-p pdf))
(mu4e-warn "Failed to create PDF file"))
(find-file pdf)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~action-header-to-html (msg field)
"Convert the FIELD of MSG to an HTML string."
@ -156,12 +155,9 @@ privacy aspects in `(mu4e) Displaying rich-text messages'."
(mu4e-error "No xwidget support available"))
(xwidget-webkit-browse-url
(concat "file://" (mu4e~write-body-to-html msg)) t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst mu4e-text2speech-command "festival --tts"
"Program that speaks out text it receives on standard input.")
@ -173,11 +169,9 @@ privacy aspects in `(mu4e) Displaying rich-text messages'."
(insert (mu4e-message-field msg :body-txt))
(shell-command-on-region (point-min) (point-max)
mu4e-text2speech-command)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-captured-message nil
"The most recently captured message.")
@ -187,18 +181,15 @@ Later, we can create an attachment based on this message with
`mu4e-compose-attach-captured-message'."
(setq mu4e-captured-message msg)
(message "Message has been captured"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-action-copy-message-file-path (msg)
"Save the full path for the current MSG to the kill ring."
(kill-new (mu4e-message-field msg :path)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e-org-contacts-file nil
"File to store contact information for org-contacts.
Needed by `mu4e-action-add-org-contact'.")
@ -236,11 +227,8 @@ file where you store your org-contacts."
(message "%S" org-capture-templates)
(when (fboundp 'org-capture)
(org-capture nil key))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e~patch-directory-history nil
"History of directories we have applied patches to.")
@ -280,11 +268,8 @@ bother asking for the git tree again (useful for bulk actions)."
(if signoff "--signoff" "")
(shell-quote-argument (mu4e-message-field msg :path)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-action-tags-header "X-Keywords"
"Header where tags are stored.
Used by `mu4e-action-retag-message'. Make sure it is one of the

View File

@ -63,9 +63,9 @@
;;
;; c) this is handled in our handler for the `sent'-message from the backend
;; (`mu4e-sent-handler')
;;
;;; Code:
(require 'cl-lib)
(require 'message)
(require 'mail-parse)
@ -80,8 +80,8 @@
(require 'mu4e-draft)
(require 'mu4e-context)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Composing / Sending messages
;;; Composing / Sending messages
(defgroup mu4e-compose nil
"Customizations for composing/sending messages."
:group 'mu4e)
@ -203,7 +203,7 @@ place to do that."
"The compose-type for this buffer.
This is a symbol, `new', `forward', `reply' or `edit'.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e-compose-attach-message (msg)
"Insert message MSG as an attachment."
@ -224,7 +224,7 @@ Messages are captured with `mu4e-action-capture-message'."
(mu4e-warn "No message has been captured"))
(mu4e-compose-attach-message mu4e-captured-message))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;; 'fcc' refers to saving a copy of a sent message to a certain folder. that's
;; what these 'Sent mail' folders are for!
@ -321,9 +321,11 @@ Message-ID."
;; update the file on disk -- ie., without the separator
(mu4e~proc-add (buffer-file-name)))) nil t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; address completion; inspired by org-contacts.el and
;;; address completion
;; inspired by org-contacts.el and
;; https://github.com/nordlow/elisp/blob/master/mine/completion-styles-cycle.el
(defun mu4e~compose-complete-handler (str pred action)
"Complete address STR with predication PRED for ACTION."
(cond
@ -374,7 +376,8 @@ removing the In-Reply-To header."
(unless (message-fetch-field "in-reply-to")
(message-remove-header "References")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e-compose-mode-map nil
"Keymap for \"*mu4e-compose*\" buffers.")
(unless mu4e-compose-mode-map
@ -815,7 +818,7 @@ draft message."
(mu4e-compose 'new))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
;; mu4e-compose-func and mu4e-send-func are wrappers so we can set ourselves
;; as default emacs mailer (define-mail-user-agent etc.)
@ -901,7 +904,7 @@ buffer buried."
"Return the `mu4e-user-agent' symbol."
'mu4e-user-agent)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e-compose-goto-top (&optional arg)
"Go to the beginning of the message or buffer.

View File

@ -31,6 +31,8 @@
;; Contributed by sabof
(defvar bookmark-make-record-function)
;;; Various simple commands
(defun mu4e-headers-mark-all-unread-read ()
"Put a ! \(read) mark on all visible unread messages."
(interactive)
@ -45,8 +47,6 @@
(mu4e-headers-mark-all-unread-read)
(mu4e-mark-execute-all t))
;;;
(defun mu4e-headers-mark-all ()
"Mark all messages within current query results and ask user to execute which action."
(interactive)
@ -55,8 +55,6 @@
(lambda (_msg _param) t))
(mu4e-mark-execute-all))
;;;
;;; Bookmark handlers
;;
;; Allow bookmarking a mu4e buffer in regular emacs bookmarks.
@ -109,13 +107,13 @@ BOOKMARK is a bookmark name or a bookmark record."
,(bookmark-get-bookmark-record bmk))))
bookmark))))
;;; handling spam with Bogofilter with possibility to define it for SpamAssassin
;;; contributed by Gour
;; to add the actions to the menu, you can use something like:
;;; Bogofilter/SpamAssassin
;;
;; Support for handling spam with Bogofilter with the possibility
;; to define it for SpamAssassin, contributed by Gour.
;;
;; To add the actions to the menu, you can use something like:
;;
;; (add-to-list 'mu4e-headers-actions
;; '("sMark as spam" . mu4e-register-msg-as-spam) t)
;; (add-to-list 'mu4e-headers-actions
@ -166,11 +164,12 @@ For example for bogofile, use \"/usr/bin/bogofilter -Sn < %s\"")
(shell-command command))
(mu4e-view-mark-for-something))
;;; end of spam-filtering functions
;;; Eshell functions
;;
;; Code for `gnus-dired-attached' modified to run from eshell,
;; allowing files to be attached to an email via mu4e using the
;; eshell. Does not depend on gnus.
;;; eshell functions
;; Code for 'gnus-dired-attached' modified to run from eshell, allowing files to
;; be attached to an email via mu4e using the eshell. Does not depend on gnus.
(defun eshell/mu4e-attach (&rest args)
"Attach files to a mu4e message using eshell. If no mu4e
buffers found, compose a new message and then attach the file."

View File

@ -31,10 +31,8 @@
(require 'mu4e-utils)
(require 'mu4e-message)
(require 'message) ;; mail-header-separator
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Options
(defcustom mu4e-compose-dont-reply-to-self nil
"If non-nil, don't include self.
@ -75,6 +73,8 @@ mu4e-specific version of `message-signature'."
:type 'boolean
:group 'mu4e-compose)
;;; UNNAMED
(defvar mu4e-user-agent-string
(format "mu4e %s; emacs %s" mu4e-mu-version emacs-version)
"The User-Agent string for mu4e, or nil.")
@ -145,8 +145,7 @@ References. If both are empty, return nil."
(mapconcat (lambda (id) (format "<%s>" id)) refs " ")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; determine the recipient fields for new messages
;;; Determine the recipient fields for new messages
(defun mu4e~draft-recipients-list-to-string (lst)
"Convert a lst LST of address cells into a string.
@ -271,9 +270,10 @@ message. Return nil if there are no recipients for the particular field."
(mu4e-error "Unsupported field")))))
;;; RFC2822 handling of phrases in mail-addresses
;;; The optional display-name contains a phrase, it sits before the angle-addr
;;; as specified in RFC2822 for email-addresses in header fields.
;;; contributed by jhelberg
;;
;; The optional display-name contains a phrase, it sits before the
;; angle-addr as specified in RFC2822 for email-addresses in header
;; fields. Contributed by jhelberg.
(defun mu4e~rfc822-phrase-type (ph)
"Return an atom or quoted-string for the phrase PH.
@ -317,7 +317,8 @@ This is based on the variable `user-full-name' and
(format "%s" user-mail-address))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~draft-insert-mail-header-separator ()
"Insert `mail-header-separator' in the first empty line of the message.
`message-mode' needs this line to know where the headers end and

View File

@ -27,6 +27,7 @@
;; headers like 'To:' or 'Subject:')
;;; Code:
(require 'cl-lib)
(require 'fringe)
(require 'hl-line)
@ -44,7 +45,8 @@
(declare-function mu4e-view "mu4e-view")
(declare-function mu4e~main-view "mu4e-main")
;; the headers view
;;; Options
(defgroup mu4e-headers nil
"Settings for the headers view."
:group 'mu4e)
@ -217,6 +219,8 @@ but also manually invoked searches."
:type 'hook
:group 'mu4e-headers)
;;; Public variables
(defvar mu4e-headers-sort-field :date
"Field to sort the headers by. Must be a symbol,
one of: `:date', `:subject', `:size', `:prio', `:from', `:to.',
@ -226,6 +230,8 @@ one of: `:date', `:subject', `:size', `:prio', `:from', `:to.',
"Direction to sort by; a symbol either `descending' (sorting
Z->A) or `ascending' (sorting A->Z).")
;;;; Fancy marks
;; marks for headers of the form; each is a cons-cell (basic . fancy)
;; each of which is basic ascii char and something fancy, respectively
(defvar mu4e-headers-draft-mark '("D" . "") "Draft.")
@ -240,7 +246,8 @@ one of: `:date', `:subject', `:size', `:prio', `:from', `:to.',
(defvar mu4e-headers-signed-mark '("s" . "") "Signed.")
(defvar mu4e-headers-unread-mark '("u" . "") "Unread.")
;; thread prefix marks
;;;; Graph drawing
(defvar mu4e-headers-thread-child-prefix '("├>" . "┣▶ ")
"Prefix for messages in sub threads that do have a following sibling.")
@ -266,6 +273,8 @@ This prefix should have the same length as `mu4e-headers-thread-connection-prefi
(defvar mu4e-headers-thread-duplicate-prefix '("=" . "")
"Prefix for duplicate messages.")
;;;; Various
(defvar mu4e-headers-actions
'( ("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread))
@ -304,9 +313,7 @@ PREDICATE-FUNC as PARAM. This is useful for getting user-input.")
"Whether to show all results.
If this is nil show results up to `mu4e-headers-results-limit')")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; internal variables/constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Internal variables/constants
;; docid cookies
(defconst mu4e~headers-docid-pre "\376"
@ -330,7 +337,8 @@ followed by the docid, followed by `mu4e~headers-docid-post'.")
("to" . :to))
"List of cells describing the various sort-options.
In the format needed for `mu4e-read-option'.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~headers-clear (&optional msg)
"Clear the header buffer and related data structures."
@ -343,9 +351,8 @@ In the format needed for `mu4e-read-option'.")
(goto-char (point-min))
(insert (propertize msg 'face 'mu4e-system-face 'intangible t)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; handler functions
;;
;;; Handler functions
;; next are a bunch of handler functions; those will be called from mu4e~proc in
;; response to output from the server process
@ -428,8 +435,9 @@ If SKIP-HOOK is absent or nil, `mu4e-message-changed-hook' will be invoked."
(unless skip-hook
(run-hooks 'mu4e-message-changed-hook)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~headers-contact-str (contacts)
"Turn the list of contacts CONTACTS (with elements (NAME . EMAIL)
into a string."
@ -438,7 +446,8 @@ into a string."
(let ((name (car ct)) (email (cdr ct)))
(or name email "?"))) contacts ", "))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~headers-thread-prefix-map (type)
"Return the thread prefix based on the symbol TYPE."
(let ((get-prefix
@ -454,13 +463,11 @@ into a string."
('duplicate (funcall get-prefix mu4e-headers-thread-duplicate-prefix))
(t "?"))))
;;;; headers in the buffer are prefixed by an invisible string with the docid
;;;; followed by an EOT ('end-of-transmission', \004, ^D) non-printable ascii
;;;; character. this string also has a text-property with the docid. the former
;;;; is used for quickly finding a certain header, the latter for retrieving the
;;;; docid at point without string matching etc.
;; headers in the buffer are prefixed by an invisible string with the docid
;; followed by an EOT ('end-of-transmission', \004, ^D) non-printable ascii
;; character. this string also has a text-property with the docid. the former
;; is used for quickly finding a certain header, the latter for retrieving the
;; docid at point without string matching etc.
(defun mu4e~headers-docid-pos (docid)
"Return the pos of the beginning of the line with the header with
@ -596,7 +603,8 @@ while our display may be different)."
('signed (funcall get-prefix mu4e-headers-signed-mark))
('unread (funcall get-prefix mu4e-headers-unread-mark)))))))
str))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defconst mu4e-headers-from-or-to-prefix '("" . "To ")
"Prefix for the :from-or-to field.
@ -795,9 +803,10 @@ after the end of the search results."
;; run-hooks
(run-hooks 'mu4e-headers-found-hook)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defmacro mu4e~headers-defun-mark-for (mark)
"Define a function mu4e~headers-mark-MARK."
(let ((funcname (intern (format "mu4e-headers-mark-for-%s" mark)))
@ -821,7 +830,8 @@ after the end of the search results."
(mu4e~headers-defun-mark-for unread)
(mu4e~headers-defun-mark-for action)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e-move-to-trash-patterns '()
"List of regexps to match for moving to trash instead of flagging them.
This is particularly useful for mailboxes that don't use the
@ -844,7 +854,8 @@ Also see `mu4e-view-mark-or-move-to-trash'."
mu4e-trash-folder))
(mu4e-headers-next))))
;;; headers-mode and mode-map ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Headers-mode and mode-map
(defvar mu4e-headers-mode-map nil
"Keymap for *mu4e-headers* buffers.")
(unless mu4e-headers-mode-map
@ -930,7 +941,6 @@ Also see `mu4e-view-mark-or-move-to-trash'."
(define-key map "U" 'mu4e-mark-unmark-all)
(define-key map "x" 'mu4e-mark-execute-all)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-key map "a" 'mu4e-headers-action)
@ -1111,8 +1121,8 @@ no user-interaction ongoing."
(mu4e~mark-initialize) ;; initialize the marking subsystem
(hl-line-mode 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; highlighting
;;; Highlighting
(defvar mu4e~highlighted-docid nil
"The highlighted docid")
@ -1130,7 +1140,8 @@ Also, unhighlight any previously highlighted headers."
(hl-line-highlight)))
(setq mu4e~highlighted-docid docid)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~headers-select-window ()
"When there is a visible window for the headers buffer, make sure
to select it. This is needed when adding new headers, otherwise
@ -1147,7 +1158,8 @@ message plist, or nil if not found."
(when (and this-msgid (string= msgid this-msgid))
msg)))))
;;;; markers mark headers for
;;; UNNAMED markers mark headers for
(defun mu4e~headers-mark (docid mark)
"(Visually) mark the header for DOCID with character MARK."
(with-current-buffer (mu4e-get-headers-buffer)
@ -1198,7 +1210,8 @@ docid is not found."
(unless ignore-missing
(mu4e-error "Cannot find message with docid %S" docid)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defcustom mu4e-query-rewrite-function 'identity
"Function that takes a search expression string, and returns a
possibly changed search expression string.
@ -1296,8 +1309,7 @@ of `mu4e-split-view', and return a window for the message view."
(t ;; no splitting; just use the currently selected one
(selected-window)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; search-based marking
;;; Search-based marking
(defun mu4e-headers-for-each (func)
"Call FUNC for each header, moving point to the header.
@ -1459,10 +1471,10 @@ descendants."
(if markpair (mu4e-headers-mark-thread t markpair)
(let ((current-prefix-arg t))
(call-interactively 'mu4e-headers-mark-thread))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; the query past / present / future ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; The query past / present / future
(defvar mu4e~headers-query-past nil
"Stack of queries before the present one.")
(defvar mu4e~headers-query-future nil
@ -1505,10 +1517,10 @@ or `past'."
(unless mu4e~headers-query-future
(mu4e-warn "No more next queries"))
(pop mu4e~headers-query-future))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; interactive functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Interactive functions
(defvar mu4e~headers-search-hist nil
"History list of searches.")

View File

@ -23,13 +23,16 @@
;;; Commentary:
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'smtpmail) ;; the queueing stuff (silence elint)
(require 'mu4e-utils) ;; utility functions
(require 'mu4e-context) ;; the context
(require 'mu4e-vars) ;; the context
(require 'cl-lib)
;;; Mode
(defconst mu4e~main-buffer-name " *mu4e-main*"
"*internal* Name of the mu4e main view buffer.")
@ -152,8 +155,7 @@ clicked."
"")
"\n"))
;; NEW
;; This is the old `mu4e~main-view' function but without
;; NEW This is the old `mu4e~main-view' function but without
;; buffer switching at the end.
(defun mu4e~main-view-real (_ignore-auto _noconfirm)
(let ((buf (get-buffer-create mu4e~main-buffer-name))
@ -241,10 +243,9 @@ clicked."
(goto-char (point-min)))
(add-to-list 'global-mode-string '(:eval (mu4e-context-label))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Interactive functions
;; NEW
;; Toggle mail sending mode without switching
;;; Commands
;; NEW Toggle mail sending mode without switching
(defun mu4e~main-toggle-mail-sending-mode ()
"Toggle sending mail mode, either queued or direct."
(interactive)

View File

@ -26,6 +26,7 @@
;; currently in the headers buffer.
;;; Code:
(require 'cl-lib)
(require 'mu4e-proc)
(require 'mu4e-utils)
@ -36,6 +37,8 @@
(declare-function mu4e~headers-goto-docid "mu4e-headers")
(declare-function mu4e-headers-next "mu4e-headers")
;;; UNNAMED
(defcustom mu4e-headers-leave-behavior 'ask
"What to do when user leaves the headers view.
That is when he e.g. quits, refreshes or does a new search.
@ -63,7 +66,8 @@ message, showing the target makes this quite a bit slower (showing
the target uses an Emacs feature called 'overlays', which aren't
particularly fast).")
;;; insert stuff;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Insert stuff
(defvar mu4e~mark-map nil
"Contains a mapping of docid->markinfo.
When a message is marked, the information is added here. markinfo
@ -432,7 +436,8 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
(defun mu4e-mark-docid-marked-p (docid)
"Is the given DOCID marked?"
(when (gethash docid mu4e~mark-map) t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e-mark-marks-num ()
"Return the number of mark-instances in the current buffer."

View File

@ -25,6 +25,7 @@
;; Functions to get data from mu4e-message plist structure
;;; Code:
(require 'cl-lib)
(require 'mu4e-vars)
(require 'mu4e-utils)
@ -83,7 +84,8 @@ message-plist and the text, which is the plain-text version,
ossibly converted from html and/or transformed by earlier rewrite
functions.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defsubst mu4e-message-field-raw (msg field)
"Retrieve FIELD from message plist MSG.
FIELD is one of :from, :to, :cc, :bcc, :subject, :data,
@ -307,7 +309,8 @@ A part would look something like:
Eiter in the headers buffer or the view buffer. Field is a
symbol, see `mu4e-header-info'."
(plist-get (mu4e-message-at-point) field))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~html2text-wrapper (func msg)
"Apply FUNC on a temporary buffer with html from MSG.

View File

@ -24,9 +24,10 @@
;;; Commentary:
;; The expect version here is org 8.x.
;;; Code:
;; The expect version here is org 8.x
(require 'org)
(defgroup mu4e-org nil

View File

@ -23,12 +23,12 @@
;;; Commentary:
;;; Code:
(require 'mu4e-vars)
(require 'mu4e-utils)
(require 'mu4e-meta)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; internal vars
;;; Internal vars
(defvar mu4e~proc-buf nil
"Buffer (string) for data received from the backend.")
@ -49,6 +49,8 @@
"Regular expression matching the length cookie.
Match 1 will be the length (in hex).")
;;; Functions
(defun mu4e~proc-running-p ()
"Whether the mu process is running."
(and mu4e~proc-process

View File

@ -25,6 +25,7 @@
;; Utility functions used in the mu4e
;;; Code:
(eval-when-compile
(require 'org nil 'noerror))
(require 'cl-lib)
@ -49,8 +50,6 @@
(declare-function mu4e-context-vars "mu4e-context")
(declare-function show-all "org")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the following is taken from org.el; we copy it here since we don't want to
;; depend on org-mode directly (it causes byte-compilation errors) TODO: a
;; cleaner solution....
@ -80,6 +79,7 @@ NODEFAULT, hour and minute fields will be nil if not given."
nil nil nil)
(mu4e-error "Not a standard mu4e time string: %s" s)))
;;; Various
(defun mu4e-user-mail-address-p (addr)
"If ADDR is one of user's e-mail addresses return t, nil otherwise.
@ -90,7 +90,6 @@ insensitive comparison is used."
:test (lambda (s1 s2)
(eq t (compare-strings s1 nil nil s2 nil nil t)))))
t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro with~mu4e-context-vars (context &rest body)
"Evaluate BODY, with variables let-bound for CONTEXT (if any).
@ -102,7 +101,8 @@ insensitive comparison is used."
(mapcar (lambda(cell) (cdr cell)) vars)
(eval ,@body))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Folders (1/2)
;; the standard folders can be functions too
(defun mu4e~get-folder (foldervar msg)
"Within the mu-context of MSG, get message folder FOLDERVAR.
@ -138,16 +138,14 @@ return the result."
(defun mu4e-get-trash-folder (&optional msg)
"Get the sent folder. See `mu4e-trash-folder'."
(mu4e~get-folder 'mu4e-trash-folder msg))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Self-destructing files
(defun mu4e-remove-file-later (filename)
"Remove FILENAME in a few seconds."
(run-at-time "30 sec" nil
(lambda () (ignore-errors (delete-file filename)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-make-temp-file (ext)
"Create a temporary file with extension EXT. The file will
self-destruct in a few seconds, enough to open it in another
@ -155,12 +153,13 @@ program."
(let ((tmpfile (make-temp-file "mu4e-" nil (concat "." ext))))
(mu4e-remove-file-later tmpfile)
tmpfile))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Folders (2/2)
;;
;; mu4e-attachment-dir is either a string or a function that takes a
;; filename and the mime-type as argument, either (or both) which can
;; be nil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mu4e-attachment-dir is either a string or a function that takes a filename
;; and the mime-type as argument, either (or both) which can be nil
(defun mu4e~get-attachment-dir (&optional fname mimetype)
"Get the directory for saving attachments from
`mu4e-attachment-dir' (which can be either a string or a function,
@ -177,9 +176,9 @@ see its docstring)."
(if dir
(expand-file-name dir)
(mu4e-error (mu4e-error "mu4e-attachment-dir evaluates to nil")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Maildir (1/2)
(defun mu4e~guess-maildir (path)
"Guess the maildir for some path, or nil if cannot find it."
(let ((idx (string-match (mu4e-root-maildir) path)))
@ -189,10 +188,7 @@ see its docstring)."
""
(expand-file-name
(concat path "/../.."))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-create-maildir-maybe (dir)
"Offer to create maildir DIR if it does not exist yet.
Return t if the dir already existed, or an attempt has been made to
@ -207,6 +203,8 @@ an absolute path."
(mu4e~proc-mkdir dir) t)
(t nil)))
;;; Messages, warnings and errors
(defun mu4e-format (frm &rest args)
"Create [mu4e]-prefixed string based on format FRM and ARGS."
(concat
@ -245,6 +243,8 @@ Does a local-exit and does not return. In emacs versions below
(mu4e-log 'error (apply 'mu4e-format frm args))
(user-error "%s" (apply 'mu4e-format frm args)))
;;; Reading user input
(defun mu4e~read-char-choice (prompt choices)
"Read and return one of CHOICES, prompting for PROMPT.
Any input that is not one of CHOICES is ignored. This mu4e's
@ -311,6 +311,8 @@ Function will return the cdr of the list element."
(cdr chosen)
(mu4e-warn "Unknown shortcut '%c'" response))))
;;; Maildir (1/2)
(defun mu4e~get-maildirs-1 (path mdir)
"Get maildirs under path, recursively, as a list of relative paths."
(let ((dirs)
@ -395,6 +397,8 @@ and offer to create it if it does not exist yet."
(mu4e~proc-mkdir fullpath)))
mdir))
;;; Bookmarks
(defun mu4e-bookmarks ()
"Get `mu4e-bookmarks' in the (new) format, converting from the
old format if needed."
@ -456,7 +460,8 @@ replaces any existing bookmark with KEY."
mu4e-bookmarks :test 'equal))
;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Converting flags->string and vice-versa
(defun mu4e~flags-to-string-raw (flags)
"Convert a list of flags into a string as seen in Maildir
message files; flags are symbols draft, flagged, new, passed,
@ -517,8 +522,8 @@ letters than the ones listed here are ignored. Also see
http://cr.yp.to/proto/maildir.html "
;; "Remove duplicates from the output of `mu4e~string-to-flags-1'"
(cl-remove-duplicates (mu4e~string-to-flags-1 str)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Various
(defun mu4e-display-size (size)
"Get a string representation of SIZE (in bytes)."
@ -540,7 +545,8 @@ Or go to the top level if there is none."
('mu4e-view-mode "(mu4e)Message view")
(t "mu4e"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED Buffers and windows (1/2)
(defun mu4e-last-query ()
"Get the most recent query or nil if there is none."
(when (buffer-live-p (mu4e-get-headers-buffer))
@ -582,7 +588,8 @@ that has a live window), and vice versa."
(view-mode)))
(switch-to-buffer buf)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e~lists-hash nil
"Hashtable of mailing-list-id => shortname, based on
`mu4e~mailing-lists' and `mu4e-user-mailing-lists'.")
@ -611,7 +618,7 @@ on `mu4e~mailing-lists', `mu4e-user-mailing-lists', and
(match-string 1 list-id)
list-id)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e-index-updated-hook nil
"Hook run when the indexing process had one or more updated messages.
@ -631,8 +638,8 @@ changed.")
(defvar mu4e~contacts-tstamp "0"
"Timestamp for the most recent contacts update." )
;; some handler functions for server messages
;;
;;; Some handler functions for server messages
(defun mu4e-info-handler (info)
"Handler function for (:info ...) sexps received from the server
process."
@ -665,10 +672,9 @@ process."
(cl-case errcode
(4 (user-error "No matches for this search query."))
(t (error "Error %d: %s" errcode errmsg))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~update-contacts (contacts &optional tstamp)
"Receive a sorted list of CONTACTS.
@ -749,10 +755,8 @@ completion; for testing/debugging."
Checks whether the server process is live."
(mu4e~proc-running-p))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; starting / getting mail / updating the index
;;
;;
;;; Starting / getting mail / updating the index
(defvar mu4e~update-timer nil
"The mu4e update timer.")
(defconst mu4e~update-name " *mu4e-update*"
@ -847,6 +851,7 @@ When successful, call FUNC (if non-nil) afterwards."
(buffer-list)))
;;; UNNAMED
(defvar mu4e~progress-reporter nil
"Internal, the progress reporter object.")
@ -992,12 +997,10 @@ in the background; otherwise, pop up a window."
(define-obsolete-function-alias 'mu4e-interrupt-update-mail
'mu4e-kill-update-mail)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; logging / debugging
;;; Logging / debugging
(defvar mu4e~log-max-lines 1200
"*internal* Last <n> number of lines to keep around in the buffer.")
(defconst mu4e~log-buffer-name "*mu4e-log*"
@ -1094,8 +1097,7 @@ This includes expanding e.g. 3-5 into 3,4,5. If the letter
(mu4e-warn "Attachment number must be greater than 0 (%d)" x))))
list)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defvar mu4e-imagemagick-identify "identify"
"Name/path of the Imagemagick 'identify' program.")
@ -1152,8 +1154,10 @@ displaying it). Do _not_ bury the current buffer, though."
`parse-time-string'."
(let ((timestr (read-string (mu4e-format "%s" prompt))))
(apply 'encode-time (mu4e-parse-time-string timestr))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Mu4e-org-mode
(define-derived-mode mu4e-org-mode org-mode "mu4e:org"
"Major mode for mu4e documents, derived from
`org-mode'.")
@ -1182,7 +1186,8 @@ displaying it). Do _not_ bury the current buffer, though."
"Show the mu4e 'about' page."
(interactive)
(mu4e-info (concat mu4e-doc-dir "/NEWS.org")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e-refresh-message (path)
"Re-parse message at PATH; if this works, we will
@ -1190,7 +1195,8 @@ receive (:info add :path <path> :docid <docid>) as well as (:update
<msg-sexp>)."
(mu4e~proc-add path))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~fontify-cited ()
"Colorize message content based on the citation level. This is
used in the view and compose modes."
@ -1219,7 +1225,8 @@ the view and compose modes and will color each signature in digest messages adhe
(re-search-forward "\\(^-\\{30\\}.*$\\)" nil t) ;; 30 by RFC1153
(point-max))))
(add-text-properties p end '(face mu4e-footer-face)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED
(defun mu4e~quote-for-modeline (str)
"Quote a string to be used literally in the modeline. The
@ -1237,7 +1244,7 @@ string will be shortened to fit if its length exceeds
;; Escape the % character
(replace-regexp-in-string "%" "%%" str t t)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED Buffers and windows (1/2)
(defun mu4e~active-composition-buffers ()
"Return all active mu4e composition buffers"

View File

@ -24,13 +24,13 @@
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization
(require 'mu4e-meta)
(require 'message)
(declare-function mu4e-error "mu4e-utils")
;;; Customization
(defgroup mu4e nil
"mu4e - mu for emacs"
:group 'mail)
@ -314,7 +314,8 @@ Also see `mu4e-compose-context-policy'."
(const :tag "Don't change the context when none match" nil))
:group 'mu4e)
;; crypto
;;;; Crypto
(defgroup mu4e-crypto nil
"Crypto-related settings."
:group 'mu4e)
@ -335,14 +336,15 @@ The setting is a symbol:
(const :tag "Don't try to decrypt anything" nil))
:group 'mu4e-crypto)
;; completion; we put them here rather than in mu4e-compose, as mu4e-utils needs
;; the variables.
;;;; Address completion
;;
;; We put these options here rather than in mu4e-compose, because
;; mu4e-utils needs them.
(defgroup mu4e-compose nil
"Message-composition related settings."
:group 'mu4e)
;; address completion
(defcustom mu4e-compose-complete-addresses t
"Whether to do auto-completion of e-mail addresses."
:type 'boolean
@ -368,10 +370,10 @@ time-based restriction."
:type 'string
:group 'mu4e-compose)
;;; names and mail-addresses can be mapped onto their canonical
;;; counterpart. use the customizeable function
;;; mu4e-canonical-contact-function to do that. below the identity
;;; function for mapping a contact onto the canonical one.
;; names and mail-addresses can be mapped onto their canonical
;; counterpart. use the customizeable function
;; mu4e-canonical-contact-function to do that. below the identity
;; function for mapping a contact onto the canonical one.
(defun mu4e-contact-identity (contact)
"Return the name and the mail-address of a CONTACT.
It is used as the identity function for converting contacts to
@ -447,6 +449,8 @@ Useful when this is not equal to the From: address."
This is the message being replied to, forwarded or edited; used
in `mu4e-compose-pre-hook'. For new messages, it is nil.")
;;;; Calendar
(defgroup mu4e-icalendar nil
"Icalendar related settings."
:group 'mu4e)
@ -463,7 +467,8 @@ in `mu4e-compose-pre-hook'. For new messages, it is nil.")
:group 'mu4e-icalendar)
;; Folders
;;;; Folders
(defgroup mu4e-folders nil
"Special folders."
:group 'mu4e)
@ -543,7 +548,8 @@ be quoted, since mu4e does this automatically for you."
:group 'mu4e
:type 'boolean)
;; Faces
;;; Faces
(defgroup mu4e-faces nil
"Type faces (fonts) used in mu4e."
:group 'mu4e
@ -739,7 +745,8 @@ mu4e-compose-mode."
"Face for highlighting marked region in mu4e-view buffer."
:group 'mu4e-faces)
;; headers info
;;; Header information
(defconst mu4e-header-info
'((:attachments
. (:name "Attachments"
@ -888,22 +895,22 @@ should point to a function that takes a message p-list as
argument, and returns a string. See the default value of
`mu4e-header-info-custom for an example.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Run-time variables
;;;; Headers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; run-time vars used in multiple places
;; headers
(defconst mu4e~headers-buffer-name "*mu4e-headers*"
"Name of the buffer for message headers.")
;; view
;;;; View
(defconst mu4e~view-buffer-name "*mu4e-view*"
"Name for the message view buffer.")
(defconst mu4e~view-embedded-buffer-name " *mu4e-embedded-view*"
"Name for the embedded message view buffer.")
;;;; Other
(defvar mu4e~contacts nil
"Hash that maps contacts (ie. 'name <e-mail>') to an integer for sorting.
We need to keep this information around to quickly re-sort
@ -947,20 +954,20 @@ fall back to the obsolete `mu4e-user-mail-address-list'."
version))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; our handlers funcs these handler funcs define what happens when we receive a
;; certain message from the server
;;; Handler functions
;;
;; The handler funcions define what happens when we receive a certain
;; message from the server. Here we register our handler functions;
;; these connect server messages to functions to handle them.
;;
;; These bindings form mu4e's central nervous system so it's not
;; really recommended to override them (they reference various
;; internal bits, which could change).
(defun mu4e~default-handler (&rest args)
"Dummy handler function with arbitrary ARGS."
(error "Not handled: %S" args))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; register our handler functions; these connect server messages to functions
;; to handle them.
;;
;; these form mu4e's central nervous system so it's not really recommended
;; to override them (they reference various internal bits which could change)
(defvar mu4e-error-func 'mu4e-error-handler
"Function called for each error received.
The function is passed an error plist as argument. See

View File

@ -26,6 +26,7 @@
;; viewing e-mail messages
;;; Code:
(require 'cl-lib)
(require 'mu4e-utils) ;; utility functions
(require 'mu4e-vars)
@ -48,7 +49,8 @@
(defvar gnus-icalendar-additional-identities)
(defvar mu4e~headers-view-win)
;; the message view
;;; Options
(defgroup mu4e-view nil
"Settings for the message view."
:group 'mu4e)
@ -149,12 +151,16 @@ The first letter of NAME is used as a shortcut character."
:group 'mu4e-view
:type '(alist :key-type string :value-type function))
;;; Variables
(defvar-local mu4e~view-message nil
"The message being viewed in view mode.")
(defvar mu4e-view-fill-headers t
"If non-nil, automatically fill the headers when viewing them.")
;;; Keymaps
(defvar mu4e-view-header-field-keymap
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'mu4e~view-header-field-fold)
@ -193,7 +199,8 @@ off, for example when using a read-only file-system."
:type 'boolean
:group 'mu4e-view)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Variables
(defvar mu4e~view-cited-hidden nil "Whether cited lines are hidden.")
(put 'mu4e~view-cited-hidden 'permanent-local t)
@ -216,7 +223,8 @@ message extracted at some path.")
(defvar mu4e~view-html-text nil
"Should we prefer html or text just this once? A symbol `text'
or `html' or nil.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED Main
(defun mu4e-view-message-with-message-id (msgid)
"View message with message-id MSGID. This (re)creates a
@ -1082,9 +1090,8 @@ the new docid. Otherwise, return nil."
(interactive)
(mu4e~view-prev-or-next-unread nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Interactive functions
;;; Interactive functions
(defun mu4e-view-toggle-hide-cited ()
"Toggle hiding of cited lines in the message body."
@ -1180,8 +1187,8 @@ Add this function to `mu4e-view-mode-hook' to enable this feature."
(overlay-put ov 'face 'mu4e-region-code))
(setq beg nil end nil))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Wash functions
;;; Wash functions
(defun mu4e-view-fill-long-lines ()
"Fill lines that are wider than the window width or `fill-column'."
(interactive)
@ -1202,8 +1209,8 @@ Add this function to `mu4e-view-mode-hook' to enable this feature."
(widen))
(forward-line 1)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; attachment handling
;;; Attachment handling
(defun mu4e~view-get-attach-num (prompt _msg &optional multi)
"Ask the user with PROMPT for an attachment number for MSG, and
ensure it is valid. The number is [1..n] for attachments
@ -1433,7 +1440,8 @@ attachments) in response to a (mu4e~proc-extract 'temp ... )."
((string= what "diary")
(icalendar-import-file path diary-file))
(t (mu4e-error "Unsupported action %S" what))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; UNNAMED Utilities
(defun mu4e-view-mark-custom ()
"Run some custom mark function."
@ -1444,6 +1452,8 @@ attachments) in response to a (mu4e~proc-extract 'temp ... )."
"Return t if we're in split-view, nil otherwise."
(member mu4e-split-view '(horizontal vertical)))
;;; Scroll commands
(defun mu4e-view-scroll-up-or-next ()
"Scroll-up the current message.
If `mu4e-view-scroll-to-next' is non-nil, and we can't scroll-up
@ -1465,6 +1475,8 @@ anymore, go the next message."
(interactive)
(scroll-down 1))
;;; Mark commands
(defun mu4e-view-unmark-all ()
"If we're in split-view, unmark all messages.
Otherwise, warn user that unmarking only works in the header
@ -1519,8 +1531,8 @@ list."
(mu4e-headers-mark-or-move-to-trash)
(mu4e~headers-move (or n 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; URL handling
;;; URL handling
(defun mu4e~view-get-urls-num (prompt &optional multi)
"Ask the user with PROMPT for an URL number for MSG, and ensure
it is valid. The number is [1..n] for URLs \[0..(n-1)] in the
@ -1605,7 +1617,7 @@ this is the default, you may not need it."
"Evaluate FUNC(uri) for each uri in the current message."
(maphash (lambda (_num uri) (funcall func uri)) mu4e~view-link-map))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Various commands
(defconst mu4e~view-raw-buffer-name " *mu4e-raw-view*"
"Name for the raw message view buffer.")

View File

@ -25,6 +25,7 @@
;;; Commentary:
;;; Code:
(require 'mu4e-vars)
(require 'mu4e-headers) ;; headers view
(require 'mu4e-view) ;; message view
@ -39,15 +40,12 @@
(when mu4e-org-support
(require 'mu4e-org)) ;; support for org-mode links
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; we can't properly use compose buffers that are revived using
;; desktop-save-mode; so let's turn that off
;; We can't properly use compose buffers that are revived using
;; desktop-save-mode; so let's turn that off.
(require 'desktop)
(add-to-list 'desktop-modes-not-to-save 'mu4e-compose-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload
(defun mu4e (&optional background)
"If mu4e is not running yet, start it. Then, show the main

View File

@ -27,9 +27,10 @@
;; Support for links to mu4e messages/queries from within org-mode,
;; and for writing message in org-mode, sending them as rich-text.
;; At least version 8.x of Org mode is required.
;;; Code:
;; The expect version here is org 8.x
(require 'org)
(require 'mu4e-compose)
@ -41,16 +42,15 @@
(declare-function mu4e-message "mu4e-message")
(declare-function mu4e-compose-mode "mu4e-compose")
;;; editing with org-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Editing with org-mode
;;
;; below, some functions for the org->html conversion
;; based on / inspired by Eric Schulte's org-mime.el
;; Homepage: http://orgmode.org/worg/org-contrib/org-mime.php
;;
;; EXPERIMENTAL
(defvar org-export-skip-text-before-1st-heading)
(defvar org-export-htmlize-output-type)
(defvar org-export-preserve-breaks)