From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/34357 Path: main.gmane.org!not-for-mail From: Andreas Fuchs Newsgroups: gmane.emacs.gnus.general Subject: [OT] patch for tc.el: remove empty quoted lines Date: Sun, 21 Jan 2001 13:48:48 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035170299 30017 80.91.224.250 (21 Oct 2002 03:18:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 03:18:19 +0000 (UTC) Return-Path: Original-Received: from karazm.math.uh.edu (karazm.math.uh.edu [129.7.128.1]) by mailhost.sclp.com (Postfix) with ESMTP id C096CD049D for ; Sun, 21 Jan 2001 07:50:47 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by karazm.math.uh.edu (8.9.3/8.9.3) with ESMTP id GAC04267; Sun, 21 Jan 2001 06:49:47 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 21 Jan 2001 06:48:49 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@66-209.196.61.interliant.com [209.196.61.66] (may be forged)) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id GAA02334 for ; Sun, 21 Jan 2001 06:48:39 -0600 (CST) Original-Received: from cmail.ycn.com (p2.ycn.com [212.88.160.3]) by mailhost.sclp.com (Postfix) with ESMTP id 88EB7D049D for ; Sun, 21 Jan 2001 07:49:07 -0500 (EST) Original-Received: from dahaIM.dyndns.org (csvr3191.noe-online.at [194.106.234.191]) by cmail.ycn.com (8.10.2/8.9.3) with ESMTP id f0LClKw22892 for ; Sun, 21 Jan 2001 13:47:31 +0100 Original-Received: from asf by dahaIM.dyndns.org with local (Exim 3.20 #1 (Debian)) id 14KJvM-0002M3-00 for ; Sun, 21 Jan 2001 13:48:48 +0100 Mail-Copies-To: never Original-To: ding@gnus.org X-Attribution: asf Precedence: list X-Majordomo: 1.94.jlt7 Original-Lines: 115 Xref: main.gmane.org gmane.emacs.gnus.general:34357 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:34357 --=-=-= Hi. First off, sorry for being offtopic, but the tc mailing list does not seem to answer to my subscription request. I know that many gnus users also use tc, so I'll just post this here. I have been annoyed by tc's behavior (leaving empty lines that mark the end of a paragraph hanging around with a "> ") long enough now that I made a small patch to tc.el: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=tc-remove-empty.patch --- 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 --=-=-= This removes all text on cited paragraph break lines, so stuff like: >> foo >> >> bar > > baz looks like: >> foo >> bar > baz which should be just the behavior you know from supercite. There is just one problem with this thing: It does not detect lines that are using a cite prefix other than ">". Otherwise, it works just fine[tm] for me. Enjoy (as always, comments are very appreciated), -- Andreas Fuchs, , , antifuchs --=-=-=--