;;;; connection to supercite ;;; Time-stamp: (setq mail-yank-hooks 'sc-cite-original) (setq mail-setup-hook 'mail-js:mail-setup-function) ; for RMAIL,PCMAIL,GNUS ;; (setq mail-setup-hook 'sc-overload-functions) ; for RMAIL,PCMAIL,GNUS (setq sc-nested-citation-p t sc-citation-leader "" ) (defvar sc-fill-paragraph-hook-old (if (boundp 'sc-fill-paragraph-hook) sc-fill-paragraph-hook nil) "Part of my mug abuse mechanism.") (defvar sc-auto-fill-region-p-old (if (boundp 'sc-auto-fill-region-p) sc-auto-fill-region-p nil) "Part of my mug abuse mechanism.") (defvar js:mug-abuse nil "Whether the message being replied to appears to be about mugs.") (defun js:sc-pre-hook-function () "My function for putting onto sc-pre-hook." (setq js:mug-abuse (and (save-excursion (goto-char (point-min)) (search-forward "mug" (point-max) t)) (yes-or-no-p "It's about mugs, isn't it? "))) (if js:mug-abuse (progn (require 'js-doctor) (setq sc-fill-paragraph-hook-old sc-fill-paragraph-hook sc-auto-fill-region-p-old sc-auto-fill-region-p) (setq sc-fill-paragraph-hook 'js-doctor:doctor-paragraph sc-auto-fill-region-p t)) (setq sc-fill-paragraph-hook sc-fill-paragraph-hook-old sc-auto-fill-region-p sc-auto-fill-region-p-old)) (setq sc-nested-citation-p (y-or-n-p "Nest citations? "))) (setq sc-pre-hook 'js:sc-pre-hook-function) ;; sc-electric-mode-hook (defun js:sc-post-hook-function () "My function for sc-post-hook." (if js:mug-abuse (progn (setq sc-fill-paragraph-hook sc-fill-paragraph-hook-old sc-auto-fill-region-p sc-auto-fill-region-p-old ) (require 'js-flame) (save-excursion (goto-char (point-max)) (insert "More gibberish about mugs?"))) (message "Glad to see there's no mention of mugs..."))) (setq sc-post-hook 'js:sc-post-hook-function) (defun citation-split-line () "Split the line, trying to preserve citation marking." (interactive) (require 'supercite) ; used to be called sc (let* ((split-column (current-column)) (splitting-point (point)) (citation-marker nil)) (save-excursion (beginning-of-line 1) (if (re-search-forward sc-cite-regexp splitting-point t) (setq citation-marker (buffer-substring (match-beginning 0) (match-end 0))))) (insert "\n") (if citation-marker (progn (insert citation-marker) (setq split-column (- split-column (length citation-marker))))) (insert (make-string split-column 32)))) (defun citation-split-line () "Open a line in a citation." (interactive) (let* ((open-length (- (point) (save-excursion (beginning-of-line 1) (point)))) (citation-marker (save-excursion (beginning-of-line 1) (if (re-search-forward "^>+" (point-max) t) (buffer-substring (match-beginning 0) (match-end 0)) "")))) (insert "\n" citation-marker (make-string (- open-length (length citation-marker)) ? )))) (defun quick-cite (start end prefix buffer) "Cite the current region into a mail buffer." (interactive "r sPrefix lines with: bBuffer into which to cite: ") (let ((citation (buffer-substring start end))) (set-buffer buffer) (let ((start-of-insertion (point))) (insert citation) (save-restriction (narrow-to-region start-of-insertion (point)) (goto-char start-of-insertion) (while (not (eobp)) (insert prefix) (beginning-of-line 2)))))) (bbdb-insinuate-sc) (require 'sendmail) (define-key mail-mode-map "\n" 'citation-split-line) ;;; end of supercite-config.el