~willvaughn/.emacs.d

d6d2dd42c28e4154f2ed2f8370db3d603c96cf7d — William Vaughn 1 year, 3 months ago 13322a3
rm my email crazy regex message-indent-citation-function
1 files changed, 0 insertions(+), 21 deletions(-)

M lisp/wv-email.el
M lisp/wv-email.el => lisp/wv-email.el +0 -21
@@ 37,26 37,6 @@
  (setq-local company-backends
              '(notmuch-company company-capf)))

(defun wv-email/strip-citation-for-gmail-thread-folding (&optional start end yank-only)
  "Format citations so they fold correctly in Gmail's application UI."
  (unless start (setq start (point)))
  ;; Remove mailto links
  (replace-regexp-in-region "<mailto:[^>]*>" "" start (or end (mark t)))
  ;; Remove parentheses links (http(s), tel, email)
  (replace-regexp-in-region ">*[[:space:]]*([[:space:]]*\n*>*[[:space:]]*\\(https*://[^>[:space:])]*\\|tel:[^>)[:space:]]*\\|.*@.*\\.[^>)[:space:]]*\\)[[:space:]]*\n*>*[[:space:]]*)" "" start (or end (mark t)))
  ;; Remove angle bracket links (http(s) only)
  (replace-regexp-in-region "^>*[[:space:]]*<[[:space:]]*\n*>*[[:space:]]*https*://[^>[:space:]]*[[:space:]]*\n*>[[:space:]]*\n\\(>*\\)" "\\1" start (or end (mark t)))
  (replace-regexp-in-region "[[:space:]]*<[[:space:]]*\n*>*[[:space:]]*https*://[^>[:space:]]*[[:space:]]*\n*>" "" start (or end (mark t)))
  ;; Fix citation email addresses that span multiple lines.
  (replace-regexp-in-region "\\(.*\\) <[[:space:]]*\n*>*[[:space:]]*\\(.*@.*\\.[^>[:space:]]*\\)[[:space:]]*> wrote:$" "\\1 <\\2> wrote:" start (or end (mark t)))
  ;; Remove asterisks
  (replace-regexp-in-region "[\\*]+" "" start (or end (mark t)))
  ;; Remove horizontal rule separators
  (replace-regexp-in-region "^>*[[:space:]]*[-_]\\{3,\\}$" "" start (or end (mark t)))
  ;; Fix superhuman dates adding spaces that shouldn't exist.
  (replace-regexp-in-region "\\(yesterday\\|today\\|[[:word:]]\\{3\\}[[:space:]]+[[:digit:]]+\\) \\([\\.,:]\\)" "\\1\\2" start (or end (mark t)))
  (goto-char start))

(use-package message
  :config
  (setq message-kill-buffer-on-exit t


@@ 64,7 44,6 @@
        send-mail-function 'sendmail-send-it
        message-signature t
        message-cite-style message-cite-style-gmail
        message-indent-citation-function (list #'message-indent-citation #'wv-email/strip-citation-for-gmail-thread-folding)
        message-citation-line-function 'message-insert-formatted-citation-line
        message-citation-line-format "On %a, %b %e, %Y at %I:%M %p %f wrote:\n"
        mml-secure-openpgp-sign-with-sender t