aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-gnus.el10
-rw-r--r--emacs/.emacs.d/lisp/my/my-gnus.el63
2 files changed, 71 insertions, 2 deletions
diff --git a/emacs/.emacs.d/init/ycp-gnus.el b/emacs/.emacs.d/init/ycp-gnus.el
index fd15e7f..43d56cc 100644
--- a/emacs/.emacs.d/init/ycp-gnus.el
+++ b/emacs/.emacs.d/init/ycp-gnus.el
@@ -32,7 +32,7 @@
;;; `mm-encode'
(my-package mm-encode
- (setq mm-encrypt-option nil ; use 'guided if you need more control
+ (setq mm-encrypt-option nil ; use 'guided if you need more control
mm-sign-option nil)) ; same
;;; `mml-sec'
@@ -52,10 +52,14 @@
message-ignored-cited-headers "" ; default is "." for all headers
message-confirm-send nil
message-kill-buffer-on-exit t
- message-wide-reply-confirm-recipients t
+ message-wide-reply-confirm-recipients nil
message-citation-line-format
"On %a %Y-%m-%d %H:%M:%S %z, %N wrote:\n")
(add-hook 'message-setup-hook #'message-sort-headers)
+ (require 'my-gnus)
+ (my-keybind message-mode-map
+ "M-n" #'my-message-after-next-cited
+ "M-p" #'my-message-before-previous-cited)
)
(my-package smtpmail
@@ -103,6 +107,8 @@
(setq gnus-message-replysign t)
(my-setq-from-local gnus-posting-styles)
(my-override mm-display-external)
+ (add-hook 'gnus-message-setup-hook #'message-remove-blank-cited-lines)
+ (add-hook 'gnus-message-setup-hook #'my-message-remove-trailing-cited-lines)
)
;; checking sources
diff --git a/emacs/.emacs.d/lisp/my/my-gnus.el b/emacs/.emacs.d/lisp/my/my-gnus.el
index 9c42204..599a19c 100644
--- a/emacs/.emacs.d/lisp/my/my-gnus.el
+++ b/emacs/.emacs.d/lisp/my/my-gnus.el
@@ -27,6 +27,69 @@
;;; Code:
+;;; `message-mode', the mode to compose messages
+(defun my-message-elide-remaining ()
+ "Elide all cited text after point."
+ (interactive)
+ (when-let* ((beg (point))
+ (citexp (concat "^\\("
+ (concat message-yank-cited-prefix "\\|")
+ message-yank-prefix
+ "\\)"))
+ (end (save-excursion
+ (goto-char (point-max))
+ (when (re-search-backward citexp nil t)
+ (beginning-of-line 2)
+ (point)))))
+ (when (< beg end) (message-elide-region beg end))))
+
+(defun my-message-remove-trailing-cited-lines ()
+ "Remove all trailing cited lines."
+ (interactive)
+ (save-excursion
+ (when-let* ((citexp (concat "^\\("
+ (concat message-yank-cited-prefix "\\|")
+ message-yank-prefix
+ "\\)+ *\n"))
+ (end (progn
+ (goto-char (point-max))
+ (when (re-search-backward citexp nil t)
+ (beginning-of-line 2)
+ (point))))
+ (beg (progn (beginning-of-line 0)
+ (while (looking-at-p citexp)
+ (beginning-of-line 0))
+ (beginning-of-line 2)
+ (point))))
+ (when (< beg end) (delete-region beg end)))))
+
+(defun my-message-before-previous-cited ()
+ "Move point to before previous cited portion."
+ (interactive)
+ (let ((citexp (concat "^\\("
+ (concat message-yank-cited-prefix "\\|")
+ message-yank-prefix
+ "\\)")))
+ (beginning-of-line 1)
+ (unless (looking-at-p citexp)
+ (re-search-backward citexp nil t))
+ (beginning-of-line 0)
+ (while (looking-at-p citexp)
+ (beginning-of-line 0))))
+
+(defun my-message-after-next-cited ()
+ "Move point to after the next cited portion."
+ (interactive)
+ (let ((citexp (concat "^\\("
+ (concat message-yank-cited-prefix "\\|")
+ message-yank-prefix
+ "\\)")))
+ (beginning-of-line 1)
+ (unless (looking-at-p citexp)
+ (re-search-forward citexp nil t))
+ (beginning-of-line 2)
+ (while (looking-at-p citexp)
+ (beginning-of-line 2))))
(defun my-gnus-summary-exit-like-mu4e () (interactive)
(if (get-buffer-window (gnus-buffer-live-p gnus-article-buffer))