;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/gnus/message-incal.el (require 'message) (require 'message-header) (require 'mode-line) (require 'super) (add-to-list 'message-syntax-checks '(long-lines . disabled)) (setq mml-content-disposition-alist '((t . "attachment"))) (setq message-auto-save-directory nil) (setq message-kill-buffer-on-exit t) (setq message-kill-buffer-query nil) (let*((title "underground experts united") (url-ds "https://dataswamp.org/~incal") (signature (format "%s\n%s" title url-ds)) ) (setq message-signature signature) ) (defun goto-replied-to-message () (interactive) (when (bufferp message-reply-buffer) (switch-to-buffer message-reply-buffer) )) (defun message-cite-region (beg end &optional levels) (interactive "*r\np") (or levels (setq levels 1)) (goto-char beg) (beginning-of-line) (let*((fst (line-number-at-pos)) (lst (line-number-at-pos end)) (n (1+ (- lst fst))) ) (dotimes (_ n) (when (looking-at ">+ \\{0,1\\}") (delete-region (match-beginning 0) (match-end 0)) ) (when (> levels 0) (insert-char ?> levels) (insert-char ?\s) ) ; repair ugly >quotes as well (forward-line) ) (goto-char (point-min)) (forward-line (1- lst)) (end-of-line) )) (defun message-mode-hook-f () (lines) ) (add-hook 'message-mode-hook #'message-mode-hook-f) (defun message-send-hook-f () (remove-empty-headers) ) (add-hook 'message-send-hook #'message-send-hook-f) (defun message-save-draft () (interactive) (let ((before-save-hook '(untab-all (lambda () (delete-trailing-whitespace (get-header-separator-pos) nil) )))) (save-buffer) )) ;; works here but not in `gnus-article-mode' ;; regexp from gnus-art.el line 7878, Emacs 29.0 Gnus 5.13 (font-lock-add-keywords 'message-mode '( ("['`‘]\\([a-z][a-z0-9]+-[a-z]+\\)['’]" (1 font-lock-reference-face)) ) t) (defun message-bol () (interactive) (let ((beg (point)) (end (progn (message-beginning-of-line) (point))) ) (when (= beg end) (forward-line 0) ))) (defun message-mode-keys () (let ((kmap message-mode-map)) (disable-super-global-keys kmap) (keymap-set kmap "C-a" #'message-bol) (keymap-set kmap "C-c a" #'goto-replied-to-message) (keymap-set kmap "C-x C-s" #'message-save-draft) (keymap-set kmap "M-;" #'message-cite-region) (keymap-set kmap "M-n" #'message-yank-subject) )) (message-mode-keys) (provide 'message-incal)