diff options
Diffstat (limited to 'mail.el')
-rw-r--r-- | mail.el | 57 |
1 files changed, 56 insertions, 1 deletions
@@ -14,7 +14,7 @@ (setq mu4e-confirm-quit nil) ;; mbsync works a lot better! (setq mu4e-get-mail-command - "mbsync mymail-inbox mymail-sent gmail-inbox gmail-sent") + "mbsync mymail-inbox mymail-sent") (setq mu4e-change-filenames-when-moving t) (setq mu4e-view-show-addresses t) ; show full addresses! (setq mu4e-view-show-images t) @@ -249,3 +249,58 @@ and produce the quoted message." (define-key message-mode-map (vector 3 ?q) #'durand-quote-message) (define-key gnus-summary-mode-map (vector 3 ?q) #'durand-quote-message) (define-key gnus-article-mode-map (vector 3 ?q) #'durand-quote-message) + +;;; Fix the quotation style + +(defun durand-fix-quotation (&optional just-use-durand) + "Fix the quotation style. +If JUST-USE-DURAND is non-nil, just use \"Durand\" as the +person." + (interactive "P") + (save-match-data + (save-excursion + (let* ((beg (region-beginning)) + (end (region-end)) + (end (progn (goto-char end) (point-marker))) + (person (cond (just-use-durand "Durand") + ((read-string "Name: "))))) + (goto-char beg) + (while (< (point) (marker-position end)) + (cond + ((re-search-forward + (rx-to-string '(seq ">>" eol)) + (marker-position end) + t) + (replace-match "" nil nil nil 0))) + (forward-line 1)) + (goto-char beg) + (while (< (point) (marker-position end)) + (cond ((looking-at (rx-to-string + '(seq bol (zero-or-more (in space)) + (group + (one-or-more + ">>" + (one-or-more (in space))) + (group (one-or-more (not (in ">\n")))) + (one-or-more + ">>" + (one-or-more (in space))))) + t)) + (let ((middle-text (match-string 2))) + (replace-match + (format "%s> %s" person middle-text) t t nil 1))) + ((looking-at (rx-to-string + '(seq bol (one-or-more (in space)) + (group + (one-or-more + ">>" + (one-or-more (in space))))) + t)) + (replace-match (format "%s> " person) t t nil 1))) + (forward-line 1)) + (fill-region beg (marker-position end)) + (message "Processing...Done"))))) + +(define-key message-mode-map (vector 3 ?f) #'durand-fix-quotation) +(define-key gnus-summary-mode-map (vector 3 ?f) #'durand-fix-quotation) +(define-key gnus-article-mode-map (vector 3 ?f) #'durand-fix-quotation) |