From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/30316 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.gnus.general Subject: Re: message-do-auto-fill, to not fill some things Date: 25 Apr 2000 07:25:24 +1000 Organization: Bah Humbug Sender: owner-ding@hpc.uh.edu Message-ID: <87u2gri43f.fsf@zip.com.au> References: <87yabdcbdu.fsf@zip.com.au> <87ln243ks0.fsf@zip.com.au> <200004232056.WAA25690@lucy.cs.uni-dortmund.de> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035166872 7814 80.91.224.250 (21 Oct 2002 02:21:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 02:21:12 +0000 (UTC) Return-Path: Original-Received: from lisa.math.uh.edu (lisa.math.uh.edu [129.7.128.49]) by mailhost.sclp.com (Postfix) with ESMTP id 807D9D051E for ; Mon, 24 Apr 2000 17:27:08 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by lisa.math.uh.edu (8.9.1/8.9.1) with ESMTP id QAB18313; Mon, 24 Apr 2000 16:27:06 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 24 Apr 2000 16:26:31 -0500 (CDT) Original-Received: from mailhost.sclp.com (postfix@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id QAA21926 for ; Mon, 24 Apr 2000 16:26:21 -0500 (CDT) Original-Received: from vasquez.zip.com.au (vasquez.zip.com.au [203.12.97.41]) by mailhost.sclp.com (Postfix) with ESMTP id D75DAD051E for ; Mon, 24 Apr 2000 17:26:34 -0400 (EDT) Original-Received: from localhost (banana4.zip.com.au [61.8.30.36]) by vasquez.zip.com.au (8.9.2/8.9.1) with ESMTP id HAA13143 for ; Tue, 25 Apr 2000 07:26:23 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.11 #1 (Debian)) id 12jqM8-0000FD-00; Tue, 25 Apr 2000 07:25:24 +1000 Original-To: ding@gnus.org Original-Lines: 24 User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:30316 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:30316 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes: > > I was hoping that it is possible to play tricks with > adaptive-fill-regexp and adaptive-fill-first-line-regexp but couldn't > find out how to do that quickly. Below is something I came up with for a message-fill-paragraph. It seems to do mostly the right thing, someone smart can pick it up and run with it, or kick it into touch. To try it, start editing a message and do (load "mfill.el") Filling a long References: or Subject: is nice, but is it right to fill mail addresses on space boundaries? If not then the easy way of just letting some variables might be doomed. Kai, your new auto-fill-inhibit-regexp I guess won't inhibit on a filled line in the headers, which is either good or bad depending on your viewpoint. If there's already some filling perhaps it's right to do more. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=mfill.el (defun message-headers-end-pos () (save-excursion (goto-char (point-min)) (or (and (search-forward (concat "\n" mail-header-separator "\n") nil t) (match-beginning 0)) (and (search-forward "\n\n" nil t) (match-beginning 0)) (point-max)))) ;; paragraph-separate includes blank lines so these aren't squeezed ;; out when filling a preceding header line. Not that there should be ;; blank lines, but if you've put some in deliberately you don't want ;; them removed. mail-header-separator is included so filling on the ;; last line of the headers doesn't grab the separator line too. ;; ;; The paragraph extents are determined before setting fill-prefix ;; because that variable does bad things to paragraph motion. ;; fill-region-as-paragraph is used rather than fill-paragraph for the ;; same reason. (defun message-headers-fill-paragraph (arg) (let* ((paragraph-separate (concat "[ ]*$\\|" (regexp-quote mail-header-separator) "$")) (paragraph-start (concat "[A-Za-z-]+:\\|" paragraph-separate))) (save-excursion (let* ((bop (progn (forward-paragraph) (point))) (eop (progn (backward-paragraph) (point))) (fill-prefix " ")) (fill-region-as-paragraph bop eop arg))))) (defun message-fill-paragraph (arg) (cond ((<= (point) (message-headers-end-pos)) (message-headers-fill-paragraph arg)) ((not (save-excursion (beginning-of-line) (looking-at "<#part"))) (fill-paragraph arg))) t) (set (make-local-variable 'fill-paragraph-function) 'message-fill-paragraph) --=-=-=--