Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 (Tek) 9/26/83; site orca.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!wjh12!genrad!decvax!tektronix!orca!andrew
From: andrew@orca.UUCP (Andrew Klossner)
Newsgroups: net.emacs
Subject: Re: Centering text
Message-ID: <1242@orca.UUCP>
Date: Thu, 13-Dec-84 12:07:19 EST
Article-I.D.: orca.1242
Posted: Thu Dec 13 12:07:19 1984
Date-Received: Sat, 15-Dec-84 01:54:54 EST
References: <9500003@acf4.UUCP>
Organization: Tektronix, Wilsonville OR
Lines: 41

[]

	"does anyone know of an easy way/macro to center text in a
	file?"

If you're using Gosling/Unipress emacs, you can use the enclosed MLISP
function.  To use, bind it to a key, then, with the cursor on the
desired line, hit that key.  It will be centered between the left and
right margins.  If you have not set a right margin, it uses 72.

	"{ihnp4!cmcl2!}acf4!rosenblg"

The mail forwarder at ihnp4 says that "acf4" is a "bad system name".
In fact, ihnp4 has been bouncing a lot of my mail lately.

  -- Andrew Klossner   (decvax!tektronix!orca!andrew)       [UUCP]
                       (orca!andrew.tektronix@csnet-relay)  [ARPA]

------------------------------ cut here ------------------------------
(defun (center-line current-mark end-mark spaces
	(setq current-mark (dot))
	(beginning-of-line)
	(while (= ' ' (following-char))
		(delete-next-character)
		)
	(end-of-line)
	(setq end-mark (dot))
	(beginning-of-line)
	(setq spaces
		(/ (-
			(if (= right-margin 10000) 72 right-margin)
			(- end-mark (dot))
		   ) 2)
		)
	(while (> spaces 0)
		(insert-character ' ')
		(setq spaces (- spaces 1))
		)
	(goto-character current-mark)
	(novalue)
	))