X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-mua.el;h=6fe5f6d0152ad855dca18c7fe451c15431b2a13a;hb=2ca941163da06aed564dab1990fb333fd7457ec2;hp=9d08c2c9bf11d0127612bd96b0186badb152c5b0;hpb=a7ba52eb94edaf254e74034ff86d4ac37cb3ed6b;p=notmuch diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 9d08c2c9..6fe5f6d0 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -38,7 +38,7 @@ (declare-function notmuch-draft-postpone "notmuch-draft" ()) (declare-function notmuch-draft-save "notmuch-draft" ()) -;; +;;; Options (defcustom notmuch-mua-send-hook nil "Hook run before sending messages." @@ -73,8 +73,7 @@ If this is `nil' then no `User-Agent:' will be generated." :group 'notmuch-send) (defcustom notmuch-mua-hidden-headers nil - "Headers that are added to the `message-mode' hidden headers -list." + "Headers that are added to the `message-mode' hidden headers list." :type '(repeat string) :group 'notmuch-send) @@ -83,10 +82,11 @@ list." :group 'notmuch) (defcustom notmuch-mua-cite-function 'message-cite-original - "*Function for citing an original message. + "Function for citing an original message. + Predefined functions include `message-cite-original' and -`message-cite-original-without-signature'. -Note that these functions use `mail-citation-hook' if that is non-nil." +`message-cite-original-without-signature'. Note that these +functions use `mail-citation-hook' if that is non-nil." :type '(radio (function-item message-cite-original) (function-item message-cite-original-without-signature) (function-item sc-cite-original) @@ -120,7 +120,7 @@ to `notmuch-mua-send-hook'." :type 'regexp :group 'notmuch-send) -;; +;;; Various functions (defun notmuch-mua-attachment-check () "Signal an error if the message text indicates that an @@ -167,8 +167,7 @@ Typically this is added to `notmuch-mua-send-hook'." (t (error "Invalid value for `notmuch-mua-compose-in'")))) (defun notmuch-mua-maybe-set-window-dedicated () - "Set the selected window as dedicated according to -`notmuch-mua-compose-in'." + "Set the selected window as dedicated according to `notmuch-mua-compose-in'." (when (or (eq notmuch-mua-compose-in 'new-frame) (eq notmuch-mua-compose-in 'new-window)) (set-window-dedicated-p (selected-window) t))) @@ -216,6 +215,8 @@ Typically this is added to `notmuch-mua-send-hook'." (funcall original-func header references) (unless (bolp) (insert "\n"))) +;;; Mua reply + (defun notmuch-mua-reply (query-string &optional sender reply-all) (let ((args '("reply" "--format=sexp" "--format-version=4")) (process-crypto notmuch-show-process-crypto) @@ -319,6 +320,8 @@ Typically this is added to `notmuch-mua-send-hook'." (message-goto-body) (set-buffer-modified-p nil)) +;;; Mode and keymap + (defvar notmuch-message-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) @@ -334,10 +337,12 @@ Typically this is added to `notmuch-mua-send-hook'." (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) +;;; New messages + (defun notmuch-mua-pop-to-buffer (name switch-function) - "Pop to buffer NAME, and warn if it already exists and is -modified. This function is notmuch adaptation of -`message-pop-to-buffer'." + "Pop to buffer NAME, and warn if it already exists and is modified. +Like `message-pop-to-buffer' but enable `notmuch-message-mode' +instead of `message-mode' and SWITCH-FUNCTION is mandatory." (let ((buffer (get-buffer name))) (if (and buffer (buffer-name buffer)) @@ -529,6 +534,8 @@ will be addressed to all recipients of the source message." (notmuch-mua-reply query-string sender reply-all) (deactivate-mark))) +;;; Checks + (defun notmuch-mua-check-no-misplaced-secure-tag () "Query user if there is a misplaced secure mml tag. @@ -540,11 +547,11 @@ tag, or the user confirms they mean it." (goto-char (point-max)) (or ;; We are always fine if there is no secure tag. - (not (search-backward "<#secure" nil 't)) + (not (search-backward "<#secure" nil t)) ;; There is a secure tag, so it must be at the start of the ;; body, with no secure tag earlier (i.e., in the headers). (and (= (point) body-start) - (not (search-backward "<#secure" nil 't))) + (not (search-backward "<#secure" nil t))) ;; The user confirms they means it. (yes-or-no-p "\ There is a <#secure> tag not at the start of the body. It is @@ -571,6 +578,8 @@ The <#secure> tag at the start of the body is not followed by a newline. It is likely that the message will be sent unsigned and unencrypted. Really send? ")))) +;;; Finishing commands + (defun notmuch-mua-send-common (arg &optional exit) (interactive "P") (run-hooks 'notmuch-mua-send-hook) @@ -584,7 +593,7 @@ unencrypted. Really send? ")))) (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") - (notmuch-mua-send-common arg 't)) + (notmuch-mua-send-common arg t)) (defun notmuch-mua-send (&optional arg) (interactive "P") @@ -594,7 +603,7 @@ unencrypted. Really send? ")))) (interactive) (message-kill-buffer)) -;; +;;; _ (define-mail-user-agent 'notmuch-user-agent 'notmuch-mua-mail 'notmuch-mua-send-and-exit @@ -604,8 +613,6 @@ unencrypted. Really send? ")))) ;; composing a message. (notmuch-mua-add-more-hidden-headers) -;; - (provide 'notmuch-mua) ;;; notmuch-mua.el ends here