This commit is contained in:
parent
f0153c19bd
commit
819c8a41fa
78
init.el
78
init.el
|
@ -1,7 +1,8 @@
|
|||
;;; EMACS init file -*- lexical-binding:t -*-
|
||||
|
||||
(eval-and-compile
|
||||
(defconst my-is-nixos (file-exists-p "/nix")
|
||||
"Whether or not Emacs is running on NixOS.")
|
||||
"Whether or not Emacs is running on NixOS."))
|
||||
|
||||
(when my-is-nixos
|
||||
(setq auth-sources '("/run/agenix/authinfo")))
|
||||
|
@ -524,7 +525,7 @@
|
|||
(save-match-data
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((check-end (-> (concat "^" comment-start " -+ >8 -+$")
|
||||
(let ((check-end (-> (format "^%s -+ >8 -+$" comment-start)
|
||||
(re-search-forward pos-end t)
|
||||
(or pos-end)))
|
||||
(comment-start-char (aref comment-start 0)))
|
||||
|
@ -667,6 +668,79 @@
|
|||
(term-exec . with-editor-export-editor)
|
||||
(vterm-mode . with-editor-export-editor))
|
||||
|
||||
(use-package smtpmail
|
||||
:ensure nil
|
||||
:custom
|
||||
(smtpmail-smtp-service 587)
|
||||
(smtpmail-stream-type 'starttls)
|
||||
(smtpmail-default-smtp-server "smtp.gmail.com")
|
||||
(message-send-mail-function #'smtpmail-send-it)
|
||||
(message-citation-line-function #'message-insert-formatted-citation-line)
|
||||
(message-kill-buffer-on-exit t))
|
||||
|
||||
(use-package mu4e
|
||||
:if my-is-nixos
|
||||
:ensure nil
|
||||
:bind
|
||||
("C-c M m" . mu4e)
|
||||
("C-c M c" . mu4e-compose-new)
|
||||
("C-c M u" . mu4e-update-mail-and-index)
|
||||
:hook (mu4e-view-mode . my-inhibit-hl-line-mode)
|
||||
:custom
|
||||
(mail-user-agent 'mu4e-user-agent)
|
||||
(mu4e-get-mail-command "mbsync -a")
|
||||
(mu4e-sent-messages-behavior 'delete)
|
||||
(mu4e-change-filenames-when-moving t)
|
||||
(mu4e-view-show-images t)
|
||||
(mu4e-use-fancy-chars t)
|
||||
(mu4e-attachment-dir "~/Downloads")
|
||||
(mu4e-context-policy 'ask)
|
||||
(mu4e-compose-context-policy 'ask-if-none)
|
||||
(mu4e-confirm-quit nil)
|
||||
(mu4e-completing-read-function #'completing-read)
|
||||
:init
|
||||
(let ((age-file "/run/agenix/email.json"))
|
||||
(when (file-exists-p age-file)
|
||||
(defvar my--agenix-email-json-data
|
||||
(with-temp-buffer
|
||||
(insert-file-contents age-file)
|
||||
(json-parse-buffer :object-type 'alist)))
|
||||
(pcase-let ((`((address . ,address) (name . ,name) ,_)
|
||||
(alist-get 'personal my--agenix-email-json-data)))
|
||||
(setq user-mail-address address
|
||||
user-full-name name))))
|
||||
:config
|
||||
(when (boundp 'my--agenix-email-json-data)
|
||||
(require 'dash)
|
||||
(require 'cl-lib)
|
||||
(setq mu4e-contexts
|
||||
(--map (pcase-let ((`(,type (address . ,address) (name . ,name) ,_) it))
|
||||
(make-mu4e-context
|
||||
:name (symbol-name type)
|
||||
:enter-func (lambda ()
|
||||
(mu4e-message (format "Entering \"%s\" context"
|
||||
type)))
|
||||
:leave-func (lambda ()
|
||||
(mu4e-message (format "Leaving \"%s\" context"
|
||||
type)))
|
||||
:match-func (lambda (msg)
|
||||
(when msg
|
||||
(mu4e-message-contact-field-matches
|
||||
msg
|
||||
:to address)))
|
||||
:vars (cl-labels ((folder-name (folder-type)
|
||||
(format "/%s/[Gmail]/%s" type folder-type)))
|
||||
`((user-mail-address . ,address)
|
||||
(user-full-name . ,name)
|
||||
(mu4e-drafts-folder . ,(folder-name "Drafts"))
|
||||
(mu4e-sent-folder . ,(folder-name "Sent Mail"))
|
||||
(mu4e-trash-folder . ,(folder-name "Trash"))
|
||||
(smtpmail-smtp-server . "smtp.gmail.com")
|
||||
(smtpmail-smtp-user . ,address)))))
|
||||
my--agenix-email-json-data)))
|
||||
(when (fboundp 'imagemagick-register-types)
|
||||
(imagemagick-register-types)))
|
||||
|
||||
(use-package emacs-everywhere
|
||||
:ensure nil
|
||||
:commands emacs-everywhere
|
||||
|
|
Loading…
Reference in a new issue