message: Make sure org-contacts is loaded
parent
01fcdc89b2
commit
b86f8e419c
|
@ -92,7 +92,8 @@ A fortune is appended if `ambrevar/message-compose-fortune-p' is non-nil."
|
|||
(setq message-signature 'ambrevar/message-add-signature-and-maybe-fortune)
|
||||
|
||||
|
||||
(defun ambrevar/mu4e-select-dictionary ()
|
||||
(when (when (require 'org-contacts nil t))
|
||||
(defun ambrevar/message-select-dictionary ()
|
||||
"Set dictionary according to the LANGUAGE property of the first
|
||||
\"To:\" recipient found in the Org contacts file."
|
||||
(interactive)
|
||||
|
@ -116,12 +117,13 @@ A fortune is appended if `ambrevar/message-compose-fortune-p' is non-nil."
|
|||
(setq addresses (cdr addresses))
|
||||
(ispell-change-dictionary (cdr (assoc (car addresses) address-lang-map)))
|
||||
(setq addresses nil)))))
|
||||
(add-hook 'message-setup-hook 'ambrevar/mu4e-select-dictionary)
|
||||
(add-hook 'message-setup-hook 'ambrevar/message-select-dictionary))
|
||||
;; Because it's to tempting to send an e-mail riddled with typos...
|
||||
(add-hook 'message-setup-hook 'flyspell-mode)
|
||||
|
||||
|
||||
;; Org capture for emails in org-contacts
|
||||
(when (require 'org-contacts nil 'noerror)
|
||||
;; TODO: Don't duplicate contacts.
|
||||
(defun ambrevar/message-complete-address ()
|
||||
(require 'subr-x)
|
||||
|
@ -162,7 +164,7 @@ A fortune is appended if `ambrevar/message-compose-fortune-p' is non-nil."
|
|||
|
||||
(add-to-list 'org-capture-templates
|
||||
`("C" "Add e-mail address to contacts" entry (file+headline ,(car org-contacts-files) "Contacts")
|
||||
"* %(apply 'ambrevar/org-capture-contact-format (ambrevar/message-complete-address))"))
|
||||
"* %(apply 'ambrevar/org-capture-contact-format (ambrevar/message-complete-address))")))
|
||||
|
||||
;; The following is an alternative using the template format string. It has some missing features though:
|
||||
;; - Can't use (thing-at-point 'email) as a default.
|
||||
|
|
Loading…
Reference in New Issue