--- tc.el Tue Oct 31 19:10:26 2000 +++ .elisp/tc.el Sun Jan 21 09:51:10 2001 @@ -483,6 +500,23 @@ Normally, tc-max-lines is set to limit the citation of very long mails (e.g. citations).") +(defvar tc-remove-empty-lines t + + "*Whether empty cited lines should be removed before filling. Thus, +paragraphs that would (when set to nil) look like: + +> foo +> +> bar + +look like: + +> foo + +> bar + +when set to t.") + (defun tc-indent-region (start end) "*Cite the region like trivial-cite, but without parsing headers. Doesn't cut the signature either." @@ -526,7 +560,8 @@ (add-hook 'mail-citation-hook 'trivial-cite) Bugs: Not very intelligent about old citation marks other than '>'. Customization: See variables tc-fill-long-lines, tc-remove-signature, -tc-citation-string, tc-make-attribution and tc-header-funs." +tc-citation-string, tc-make-attribution, tc-remove-empty-lines and +tc-header-funs." (save-excursion (let ((start (point))) ;; Initialize some fields @@ -568,6 +603,9 @@ (setq tc-cite-marks (escape-char-range tc-cite-marks)) ;; Do the actual citation (tc-indent-citation) + ;; remove empty citation lines + (if tc-remove-empty-lines + (tc-remove-empty-lines start (mark-marker))) ;; Fill paragraphs (if tc-fill-long-lines (tc-fill-cited-text start (mark-marker))) @@ -580,6 +618,19 @@ ;;; ************************************************************ ;;; Reformatting cited text ;;; ************************************************************ + +(defun tc-remove-empty-lines (begin end) + "Remove all \"empty\" lines (those which have only the cite mark on them) +from the citation." + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region begin end) + (goto-char (point-min)) + (while (re-search-forward (concat "^\\(" tc-citation-string " *\\)+$") (point-max) t) + (beginning-of-line) + (kill-line))))) + (defun tc-fill-cited-paragraphs (cite-len) "Fill cited paragraphs, keeping cite-marks in their correct places. Used