summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <amin@aminb.org>2018-07-14 20:25:14 -0400
committerAmin Bandali <amin@aminb.org>2018-07-14 20:25:14 -0400
commit26172d919a15dceda1b2b2d22c1568d718fbc236 (patch)
tree8ba8b8414318f029ed0fc1da72493aeed561afab
parent8e9c7d731c1d20e574261c991d40cf4e13a1d569 (diff)
downloadconfigs-26172d919a15dceda1b2b2d22c1568d718fbc236.tar.gz
configs-26172d919a15dceda1b2b2d22c1568d718fbc236.tar.xz
configs-26172d919a15dceda1b2b2d22c1568d718fbc236.zip
[emacs/supercite] add jwiegley's supercite config as a reference
from https://github.com/jwiegley/dot-emacs/blob/f3dd82ba7fdcd8f63603e7e7a9acb078f70de8fe/dot-gnus.el#L477
-rw-r--r--init.org51
1 files changed, 51 insertions, 0 deletions
diff --git a/init.org b/init.org
index 8bba36d..4cfe1fa 100644
--- a/init.org
+++ b/init.org
@@ -1255,6 +1255,57 @@ Emacs package that displays available keybindings in popup
(add-to-list 'recentf-exclude (expand-file-name ab-maildir)))
#+end_src
+** supercite
+
+#+begin_src emacs-lisp :tangle no
+(use-package supercite
+ :commands sc-cite-original
+ :init
+ (add-hook 'mail-citation-hook 'sc-cite-original)
+
+ (defun sc-remove-existing-signature ()
+ (save-excursion
+ (goto-char (region-beginning))
+ (when (re-search-forward message-signature-separator (region-end) t)
+ (delete-region (match-beginning 0) (region-end)))))
+
+ (add-hook 'mail-citation-hook 'sc-remove-existing-signature)
+
+ (defun sc-remove-if-not-mailing-list ()
+ (unless (assoc "list-id" sc-mail-info)
+ (setq attribution sc-default-attribution
+ citation (concat sc-citation-delimiter
+ sc-citation-separator))))
+
+ (add-hook 'sc-attribs-postselect-hook 'sc-remove-if-not-mailing-list)
+
+ :config
+ (defun sc-fill-if-different (&optional prefix)
+ "Fill the region bounded by `sc-fill-begin' and point.
+Only fill if optional PREFIX is different than
+`sc-fill-line-prefix'. If `sc-auto-fill-region-p' is nil, do not
+fill region. If PREFIX is not supplied, initialize fill
+variables. This is useful for a regi `begin' frame-entry."
+ (if (not prefix)
+ (setq sc-fill-line-prefix ""
+ sc-fill-begin (line-beginning-position))
+ (if (and sc-auto-fill-region-p
+ (not (string= prefix sc-fill-line-prefix)))
+ (let ((fill-prefix sc-fill-line-prefix))
+ (unless (or (string= fill-prefix "")
+ (save-excursion
+ (goto-char sc-fill-begin)
+ (or (looking-at ">+ +")
+ (< (length
+ (buffer-substring (point)
+ (line-end-position)))
+ 65))))
+ (fill-region sc-fill-begin (line-beginning-position)))
+ (setq sc-fill-line-prefix prefix
+ sc-fill-begin (line-beginning-position)))))
+nil))
+#+end_src
+
* Post initialization
:PROPERTIES:
:CUSTOM_ID: post-initialization