From xemacs-m  Thu Apr  3 18:11:39 1997
Received: from corona.pixar.com (corona.pixar.com [138.72.20.84])
	by xemacs.org (8.8.5/8.8.5) with SMTP id SAA00082
	for <xemacs-beta@xemacs.org>; Thu, 3 Apr 1997 18:11:38 -0600 (CST)
Received: by corona.pixar.com (Smail3.1.29.1 #2)
	id m0wCwa5-0001b8C; Thu, 3 Apr 97 16:10 PST
Sender: retnuh@pixar.com (Hunter Kelly)
Sender: retnuh@corona
To: bwarsaw@python.org
Cc: wmperry@aventail.com, Kyle Jones <kyle_jones@wonderworks.com>,
        xemacs-beta@xemacs.org
Subject: Re: mail mode nit
References: <E0wCVFF-0000sf-00@neal.ctd.comsat.com> 	<199704021829.KAA18549@newman> 	<QQcjop16442.199704021947@crystal.WonderWorks.COM> 	<199704022045.MAA20582@newman> <199704022155.QAA12787@anthem.CNRI.Reston.Va.US>
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: text/plain; charset=US-ASCII
From: Hunter Kelly <retnuh@corona.pixar.com>
Date: 03 Apr 1997 16:10:12 -0800
In-Reply-To: "Barry A. Warsaw"'s message of Wed, 2 Apr 1997 16:55:40 -0500
Message-ID: <yvt3et77imz.fsf@corona.pixar.com>
Lines: 42
X-Mailer: Gnus v5.4.37/XEmacs 19.15(beta104)

Who wants to port it to message-mode?  :)

Hunter

"Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US> writes:

> [1  <text/plain; us-ascii (7bit)>]
> 
> Never let a good idea go unhacked.  Here's what I came up with,
> supporting wrapping in both directions (bind TAB to
> mail-mode-smart-tab and SHIFT-TAB to mail-mode-smart-tab-backwards).
> 
> -Barry
> 
> [2 p1 <text/plain>]
> (defun mail-mode-smart-tab ()
>   (interactive)
>   (let ((text-start (save-excursion (mail-text) (point)))
> 	(cnt 1))
>     (if (>= (point) text-start)
> 	(tab-to-tab-stop)
>       (while (< 0 cnt)
> 	(if (re-search-forward "^[^ \t]" text-start t)
> 	    (if (not (looking-at "[^:\n]+: ?"))
> 		(goto-char (point-min))
> 	      (goto-char (match-end 0))
> 	      (setq cnt (1- cnt)))
> 	  (mail-text))))))
> 
> (defun mail-mode-smart-tab-backwards ()
>   (interactive)
>   (let ((text-start (save-excursion (mail-text) (point)))
> 	(cnt -1))
>     (if (>= (point) text-start)
> 	(tab-to-tab-stop)
>       (while (> 0 cnt)
> 	(beginning-of-line)
> 	(if (re-search-backward "^[^ \t]" (point-min) t)
> 	    (if (looking-at "[^:\n]+: ?")
> 		(progn (goto-char (match-end 0))
> 		       (setq cnt (1+ cnt))))
> 	  (mail-text))))))

