[net.emacs] a couple of simple text-mode macros for indenting

matt@oddjob.UChicago.UUCP (Matt Crawford) (05/17/84)

Here a few macros I use in text mode.  They make indenting behave a little
more flexibly.


(defun
    (set-left-margin-here
	(setq left-margin (current-column))
    )
    (set-right-margin-here
	(setq right-margin (current-column))
    )
   (indent-relative &ind-amt
	(setq &ind-amt (current-indent))
	(backward-word)
	(delete-white-space)
	(newline)
	(to-col	(if (> &ind-amt 0)
		     &ind-amt
		     left-margin))
	(end-of-line)
	1
    )
    (align-to-left-margin &old-mark &was-a-mark
	(setq &was-a-mark
	      (! (error-occurred (setq &old-mark (mark)))))
	(set-mark)
	(beginning-of-line)
	(delete-white-space)
	(to-col left-margin)
	(if &was-a-mark
	    (progn
		(goto-character &old-mark)
		(exchange-dot-and-mark)))
	(novalue)
    )
    (text-mode-hook
	(setq right-margin 77)
	(setq left-margin 1)
	(local-bind-to-key "set-left-margin-here" "\e{")
	(local-bind-to-key "set-right-margin-here" "\e}")
	(local-bind-to-key "align-to-left-margin" "\e|")
	(set-auto-fill-hook "indent-relative")
    )
)
___________________________________________________
Matt			ARPA: crawford@anl-mcs.arpa
Crawford		UUCP: ihnp4!oddjob!matt