Edit some email stuff
This commit is contained in:
@ -16,27 +16,10 @@
|
|||||||
(defvar-local org-mu4e--html-message-p t
|
(defvar-local org-mu4e--html-message-p t
|
||||||
"Weather or not the current message should be htmlized.")
|
"Weather or not the current message should be htmlized.")
|
||||||
|
|
||||||
(defvar-local org-mu4e--override-org-mode-check nil
|
|
||||||
"Internal variable.
|
|
||||||
See `org-mu4e--override-org-mode-check-advice' for information about what this
|
|
||||||
does.")
|
|
||||||
|
|
||||||
(defvar org-mu4e--internal-message-mode-function
|
(defvar org-mu4e--internal-message-mode-function
|
||||||
(symbol-function 'mu4e-compose-mode)
|
(symbol-function 'mu4e-compose-mode)
|
||||||
"The `message-mode' (or derived mode) used by `org-mu4e-compose-mode'.")
|
"The `message-mode' (or derived mode) used by `org-mu4e-compose-mode'.")
|
||||||
|
|
||||||
(defun org-mu4e--override-org-mode-check-advice (oldfun &rest r)
|
|
||||||
"Around advice for various org mode functions.
|
|
||||||
This function will call OLDFUN with arguments R with `major-mode' let-bound to
|
|
||||||
\\='org-mode when `org-mu4e--override-org-mode-check' is t."
|
|
||||||
(let ((major-mode (if org-mu4e--override-org-mode-check
|
|
||||||
'org-mode
|
|
||||||
major-mode)))
|
|
||||||
(apply oldfun r)))
|
|
||||||
|
|
||||||
(advice-add 'org-element-at-point :around
|
|
||||||
'org-mu4e--override-org-mode-check-advice)
|
|
||||||
|
|
||||||
(defun org-mu4e-toggle-htmlize-mssage (&optional arg no-message)
|
(defun org-mu4e-toggle-htmlize-mssage (&optional arg no-message)
|
||||||
"Toggle weather the current message should be htmlized.
|
"Toggle weather the current message should be htmlized.
|
||||||
If ARG is a positive number or zero, enable htmlization, if it is negative,
|
If ARG is a positive number or zero, enable htmlization, if it is negative,
|
||||||
@ -206,17 +189,22 @@ ARG is passed directly to `message-send'."
|
|||||||
t ;; this tells org that we have handled the C-c C-c
|
t ;; this tells org that we have handled the C-c C-c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defmacro org-mu4e--with-replaced-compse-func (&rest body)
|
||||||
|
"Evaluate BODY with `mu4e-compose-mode' rebound to `org-mu4e-compose-mode'.
|
||||||
|
This makes use of `cl-letf' internally."
|
||||||
|
`(let ((org-mu4e--internal-message-mode-function
|
||||||
|
(symbol-function 'mu4e-compose-mode)))
|
||||||
|
(cl-letf (((symbol-function 'mu4e-compose-mode) 'org-mu4e-compose-mode))
|
||||||
|
,@body)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-mu4e-compose-new (&rest r)
|
(defun org-mu4e-compose-new (&rest r)
|
||||||
"This is like `mu4e-compose-new', but it utilizes `org-mu4e-compose-mode'.
|
"This is like `mu4e-compose-new', but it utilizes `org-mu4e-compose-mode'.
|
||||||
Each of the arguments in R are the same as `mu4e-compose-new', and are directly
|
Each of the arguments in R are the same as `mu4e-compose-new', and are directly
|
||||||
passed to it."
|
passed to it."
|
||||||
(interactive)
|
(interactive)
|
||||||
;; Save local variables set by `mu4e-compose-new'
|
(org-mu4e--with-replaced-compse-func
|
||||||
(let ((org-mu4e--internal-message-mode-function
|
(apply 'mu4e-compose-new r)))
|
||||||
(symbol-function 'mu4e-compose-mode)))
|
|
||||||
(cl-letf (((symbol-function 'mu4e-compose-mode) 'org-mu4e-compose-mode))
|
|
||||||
(apply 'mu4e-compose-new r))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-mu4e-compose-reply-to (&optional to wide)
|
(defun org-mu4e-compose-reply-to (&optional to wide)
|
||||||
@ -227,15 +215,13 @@ TO and WIDE are the same as `mu4e-compose-reply-to'."
|
|||||||
(let ((html-part-p (seq-find (lambda (handle)
|
(let ((html-part-p (seq-find (lambda (handle)
|
||||||
(equal (mm-handle-media-type (cdr handle))
|
(equal (mm-handle-media-type (cdr handle))
|
||||||
"text/html"))
|
"text/html"))
|
||||||
gnus-article-mime-handle-alist))
|
gnus-article-mime-handle-alist)))
|
||||||
(org-mu4e--internal-message-mode-function
|
(org-mu4e--with-replaced-compse-func
|
||||||
(symbol-function 'mu4e-compose-mode)))
|
(let ((buf (mu4e-compose-reply-to to wide)))
|
||||||
(cl-letf (((symbol-function 'mu4e-compose-mode) 'org-mu4e-compose-mode))
|
(with-current-buffer buf
|
||||||
(let ((buf (mu4e-compose-reply-to to wide)))
|
(setq org-mu4e--html-message-p
|
||||||
(with-current-buffer buf
|
;; make the variable look nicer by not having random data in it
|
||||||
(setq org-mu4e--html-message-p
|
(not (not html-part-p))))))))
|
||||||
;; make the variable look nicer by not having random data in it
|
|
||||||
(not (not html-part-p))))))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-mu4e-compose-reply (&optional wide)
|
(defun org-mu4e-compose-reply (&optional wide)
|
||||||
@ -244,6 +230,13 @@ WIDE is the same as `mu4e-compose-reply'."
|
|||||||
(interactive "P")
|
(interactive "P")
|
||||||
(org-mu4e-compose-reply-to nil wide))
|
(org-mu4e-compose-reply-to nil wide))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun org-mu4e-compose-edit ()
|
||||||
|
"This is like `mu4e-compose-edit', but utilizes `org-mu4e-compose-mode'."
|
||||||
|
(interactive)
|
||||||
|
(org-mu4e--with-replaced-compse-func
|
||||||
|
(mu4e-compose-edit)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defvar-keymap org-mu4e-compose-mode-map
|
(defvar-keymap org-mu4e-compose-mode-map
|
||||||
:parent org-mode-map
|
:parent org-mode-map
|
||||||
@ -340,13 +333,16 @@ This is derived from `org-mode', but it also essentially runs
|
|||||||
;; Add `message-mode' keyword and quote highlighting on top of the org syntax
|
;; Add `message-mode' keyword and quote highlighting on top of the org syntax
|
||||||
;; highlighting
|
;; highlighting
|
||||||
(font-lock-add-keywords nil message-font-lock-keywords)
|
(font-lock-add-keywords nil message-font-lock-keywords)
|
||||||
(setq-local org-mu4e--override-org-mode-check t)
|
(setq-local org-mu4e--override-org-mode-check t
|
||||||
|
org-export-with-toc nil)
|
||||||
(add-to-list (make-local-variable 'org-ctrl-c-ctrl-c-final-hook)
|
(add-to-list (make-local-variable 'org-ctrl-c-ctrl-c-final-hook)
|
||||||
'org-mu4e-send-and-exit)
|
'org-mu4e-send-and-exit)
|
||||||
(add-to-list (make-local-variable 'mode-line-misc-info)
|
(add-to-list (make-local-variable 'mode-line-misc-info)
|
||||||
'(:eval (if org-mu4e--html-message-p
|
'(:eval (if org-mu4e--html-message-p
|
||||||
"Text/HTML "
|
"Text/HTML "
|
||||||
"Text Only "))))
|
"Text Only "))))
|
||||||
|
;;;###autoload(derived-mode-add-parents 'org-mu4e-compose-mode '(mu4e-compose-mode))
|
||||||
|
(derived-mode-add-parents 'org-mu4e-compose-mode '(mu4e-compose-mode))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-mail-user-agent 'org-mu4e-user-agent
|
(define-mail-user-agent 'org-mu4e-user-agent
|
||||||
|
|||||||
70
init.el
70
init.el
@ -2352,6 +2352,14 @@ Note that this erases the buffer before doing anything."
|
|||||||
(advice-add 'jupyter-org--set-src-block-cache :around
|
(advice-add 'jupyter-org--set-src-block-cache :around
|
||||||
#'my/-fix-jupyter-org--set-src-block-cache)
|
#'my/-fix-jupyter-org--set-src-block-cache)
|
||||||
|
|
||||||
|
;; prevent warning in `execute-extended-command'
|
||||||
|
(defun my/-fix-jupyter-org--define-key-filter (oldfun &rest args)
|
||||||
|
"Prevent calling `jupyter-org--define-key-filter' outside of `org-mode'."
|
||||||
|
(when (derived-mode-p 'org-mode)
|
||||||
|
(apply oldfun args)))
|
||||||
|
(advice-add 'jupyter-org--define-key-filter :around
|
||||||
|
#'my/-fix-jupyter-org--define-key-filter)
|
||||||
|
|
||||||
(face-spec-set 'jupyter-repl-traceback
|
(face-spec-set 'jupyter-repl-traceback
|
||||||
'((default . (:background unspecified)))
|
'((default . (:background unspecified)))
|
||||||
'face-override-spec)
|
'face-override-spec)
|
||||||
@ -3317,30 +3325,44 @@ This will also update waybar."
|
|||||||
;; mu4e compose HTML messages
|
;; mu4e compose HTML messages
|
||||||
(use-package org-mime)
|
(use-package org-mime)
|
||||||
(require 'org-mu4e-compose)
|
(require 'org-mu4e-compose)
|
||||||
(setq ;; mail-user-agent 'org-mu4e-user-agent
|
(setq mail-user-agent 'org-mu4e-user-agent
|
||||||
org-mime-org-html-with-latex-default 'dvisvgm
|
org-mime-org-html-with-latex-default 'dvisvgm
|
||||||
org-mime-export-options '(:with-latex dvisvgm :with-footnotes t))
|
org-mime-export-options '(:with-latex dvisvgm :with-footnotes t))
|
||||||
;; (evil-define-key '(normal visual) org-mu4e-compose-mode-map
|
(evil-define-key '(normal visual) org-mu4e-compose-mode-map
|
||||||
;; "G" #'mu4e-compose-goto-bottom
|
"G" #'mu4e-compose-goto-bottom
|
||||||
;; "gg" #'mu4e-compose-goto-top)
|
"gg" #'mu4e-compose-goto-top)
|
||||||
;; (evil-define-key 'normal org-mu4e-compose-mode-map
|
(evil-define-key 'normal org-mu4e-compose-mode-map
|
||||||
;; "ZZ" #'message-send-and-exit
|
"ZZ" #'message-send-and-exit
|
||||||
;; "ZD" #'message-dont-send
|
"ZD" #'message-dont-send
|
||||||
;; "ZQ" #'message-kill-buffer
|
"ZQ" #'message-kill-buffer
|
||||||
;; "ZF" #'mml-attach-file)
|
"ZF" #'mml-attach-file)
|
||||||
;; (evil-define-key 'normal mu4e-view-mode-map
|
(evil-define-key 'normal mu4e-view-mode-map
|
||||||
;; "R" 'org-mu4e-compose-reply
|
"R" #'org-mu4e-compose-reply
|
||||||
;; "cr" 'org-mu4e-compose-reply)
|
"cr" #'org-mu4e-compose-reply
|
||||||
;; (evil-define-key 'normal mu4e-headers-mode-map
|
"ce" #'org-mu4e-compose-edit)
|
||||||
;; "R" 'org-mu4e-compose-reply
|
(evil-define-key 'normal mu4e-headers-mode-map
|
||||||
;; "cr" 'org-mu4e-compose-reply)
|
"R" #'org-mu4e-compose-reply
|
||||||
;; (defun my/-setup-org-mu4e-compose-mode ()
|
"cr" #'org-mu4e-compose-reply
|
||||||
;; "Setup up stuff in `org-mu4e-compose' buffers."
|
"E" #'org-mu4e-compose-edit
|
||||||
;; (setq-local ltex-eglot-variable-save-method 'file)
|
"ce" #'org-mu4e-compose-edit)
|
||||||
;; ;; this should come last so it can pick up the above
|
(evil-define-key 'normal mu4e-main-mode-map
|
||||||
;; ;; (my/eglot-if-trusted)
|
"C" #'compose-mail
|
||||||
;; )
|
"cc" #'compose-mail)
|
||||||
;; (add-hook 'org-mu4e-compose-mode-hook #'my/-setup-org-mu4e-compose-mode)
|
(defun my/-setup-org-mu4e-compose-mode ()
|
||||||
|
"Setup up stuff in `org-mu4e-compose' buffers."
|
||||||
|
(setq-local ltex-eglot-variable-save-method 'file)
|
||||||
|
;; this should come last so it can pick up the above
|
||||||
|
;; (my/eglot-if-trusted)
|
||||||
|
)
|
||||||
|
(add-hook 'org-mu4e-compose-mode-hook #'my/-setup-org-mu4e-compose-mode)
|
||||||
|
(setopt mu4e-compose-switch 'display-buffer)
|
||||||
|
(defun my/-match-mu4e-message-buffer (buffer _action)
|
||||||
|
"Matcher for mu4e message buffers for `display-buffer-alist'.
|
||||||
|
BUFFER is the buffer-or-string to match against."
|
||||||
|
(provided-mode-derived-p (buffer-local-value 'major-mode (get-buffer buffer))
|
||||||
|
'mu4e-compose-mode))
|
||||||
|
(add-to-list 'display-buffer-alist
|
||||||
|
'(my/-match-mu4e-message-buffer . (display-buffer-same-window)))
|
||||||
|
|
||||||
;; elfeed
|
;; elfeed
|
||||||
(use-package elfeed
|
(use-package elfeed
|
||||||
|
|||||||
Reference in New Issue
Block a user