From xemacs-m  Tue Aug  5 03:44:36 1997
Received: from inf.enst.fr (ojuTngEvDcKS36i0yTsSWK9mzRtFs8NI@inf.enst.fr [137.194.2.81])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id DAA12359
	for <xemacs-beta@xemacs.org>; Tue, 5 Aug 1997 03:44:35 -0500 (CDT)
Received: from metheny.enst.fr (metheny.enst.fr [137.194.160.27])
          by inf.enst.fr (8.8.4/8.8.4) with ESMTP
	  id KAA20992 for <xemacs-beta@xemacs.org>; Tue, 5 Aug 1997 10:44:22 +0200 (MET DST)
Received: (from verna@localhost)
          by metheny.enst.fr (8.8.4/8.8.4)
	  id KAA28346; Tue, 5 Aug 1997 10:44:19 +0200 (MET DST)
Date: Tue, 5 Aug 1997 10:44:19 +0200 (MET DST)
Message-Id: <199708050844.KAA28346@metheny.enst.fr>
From: Didier Verna <verna@inf.enst.fr>
MIME-Version: 1.0
To: xemacs-beta@xemacs.org
Subject: indent-buffer
X-Mailer: VM 6.33 under 20.3 "Budapest" XEmacs  Lucid (beta16)
Reply-To: verna@inf.enst.fr
X-Attribution: Did
X-Url: http://www-inf.enst.fr/~verna/
X-Face: 6o|eiKqaHN.ANh8HXDzntcWUOCg\]RsOd.ctvm~*y}Y^R&*a+Co,\s#=HWsw3x$b_n2kJ#g
 (7u?J^@^xP)f,jUF|0Z'J:|G/bMA5O12*b,7`-Q`=pKsCRIpso07.Y>YB2H{7`?u&yh;C_ZtLHfj<!
 $J=.i&Al'?,ax]MZd4tcm)_wF3$n*:f/lgS.;?Jr3T;Fl^q<qP**'tw
X-Face: |j}\)O|k##MrRz#VK$Jy=0r=3Qc,,a/Tr6*JQbE73dy17]<u3$*$]4O\1|h\|O\EDT9d$n+
 MTB{U&>2YcmW$9Z&H21e}#~#pgc>dn(is5Bv1l!{1re+Q9suKIOUmOqZs2>QMxHlR;;}kaGYA@HR3D
 C6
Content-Type: text/plain; charset=US-ASCII

        `		Hi !
       / |
      /  /	(What am I doing at work at 8.15 am ??)
      `||
       ||	Here's a small function I'd like to see added in indent.el
       ||	I find it usefull sometimes for instance when stealing
       ||	shamelessly some code from another guy who doesn't use
   _   ||	my personal indentation values ;-)
  //|  ||
  || \_||
   \\           Didier Verna
   //  __
  //  {__}   E.N.S.T. INF C-214        http://www-inf.enst.fr/~verna/
 ||    __      46 rue Barrault            mailto:verna@inf.enst.fr
 \\   {__}   75634 Paris  cedex 13       Tel.   (33) 01 45 81 80 72
  \\
   ``----         France
------------------------------------------------------------------------------

(defun indent-buffer (ignore-narrowing column)
  "Same as indent-region but for the whole buffer.
If called interactively and the buffer is narrowed, 
ask the user wether to ignore narrowing before performing indentation."
  (interactive (list 
		(if (or (> (point-min) 1) (< (point-max) (+ 1 (buffer-size))))
		    (y-or-n-p "Ignore narrowing ?") nil)
		current-prefix-arg))
  (let ((start (if ignore-narrowing (save-restriction (widen) (point-min))
		 (point-min))) 
	(end (if ignore-narrowing (save-restriction (widen) (point-max))
	       (point-max))))
    (if ignore-narrowing
	(save-restriction (widen) (indent-region start end column))
      (indent-region start end column))))

