diff options
author | JSDurand <mmemmew@gmail.com> | 2022-07-23 09:25:59 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-07-23 09:25:59 +0800 |
commit | 4eb051c74d5485bc533f9f309b96a20b942368da (patch) | |
tree | a047b805774a09e33b9f943a85ae26d95cd02538 /mail.el | |
parent | 7c32b41d8242d4d0dbe558b5fcfc49b710d2a3e6 (diff) |
mail: delete gmail and add fix-quptation function
* gnus-conf.el (gnus-secondary-select-methods): Delete gmail.
* mail.el: Delete gmail.
(durand-fix-quotation): Fix the quotation style.
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) |