From:	CSBVAX::MRGATE!@KL.SRI.Com:KARP@SUMEX-AIM.STANFORD.EDU@SMTP  8-OCT-1987 14:26
To:	EVERHART
Subj:	Field hack for Gosling Emacs

Received: from SUMEX-AIM.STANFORD.EDU by KL.SRI.COM with TCP; Thu 8 Oct 87 09:48:39-PDT
Date: Thu, 8 Oct 87 09:45:57 PDT
From: Peter Karp <KARP@SUMEX-AIM.STANFORD.EDU>
Subject: Field hack for Gosling Emacs
To: info-vax@KL.SRI.COM
Message-ID: <12340874073.44.KARP@SUMEX-AIM.STANFORD.EDU>

Users of Gosling Emacs may be interested in the Mock Lisp code below.

(Note I have no qualms about giving away bits of software which are so
small that (a) no one would pay for them anyway, and (b) it's not worth
your trouble to charge for them).

Enjoy.


;				Field.ml
;
; 			\\\Written by Peter D. Karp///
;			  This code is Public Domain
;
; This package defines functions for manipulating "fields", where a
; field is a region delimited by the mark and the "field-mark" - 
; a second mark AND associated buffer name.  This provides a different
; way of copying and moving text within Emacs.  Instead of always having
; to delete text in order to move or copy it, it is possible to specify a
; field of interest and then move to the point of insertion before actually
; changing the contents of the a buffer.  And fields can be moved or copied
; across buffers.
;
; To copy a region of text from one point to another, move to its start and
; do a "set-mark", move to its end and do a "set-field-mark"; then move to
; its destination and do a "copy-field".  The association of region start/end
; with mark/field-mark may be reversed.
;
;
; User functions:				Suggested bindings:
; ---------------				-------------------
;	copy-field					ESC-C, ESC-c
;     *	goto-field-mark
;	move-field					ESC-Y, ESC-y
;     *	return-to-pre-gotofield-buffer
;	set-field-mark					ESC-M, ESC-m
;     *	yank-from-fieldbuffer
;
; * These functions would probably not be used much by most users.


(declare-global  field-mark)
(declare-global  field-buffer)
(declare-global  pre-gotofield-buffer)


(defun

    (move-field  insertion-point
	(setq  insertion-point  (dot))

	(goto-field-mark)
	(delete-region-to-buffer  "fieldbuffer")

	(return-to-pre-gotofield-buffer)
	(goto-character insertion-point)

	(yank-buffer  "fieldbuffer")
    )


    (copy-field  insertion-point
	(setq  insertion-point  (dot))

	(goto-field-mark)
	(copy-region-to-buffer  "fieldbuffer")

	(return-to-pre-gotofield-buffer)
	(goto-character insertion-point)
	(yank-buffer  "fieldbuffer")
    )


    (yank-from-fieldbuffer
	(yank-buffer  "fieldbuffer")
    )


    (set-field-mark
	(setq  field-mark  (dot))
	(setq  field-buffer  (current-buffer-name))
	(message  "Field-Mark set.")
    )


    (goto-field-mark
	(setq  pre-gotofield-buffer  (current-buffer-name))
	(switch-to-buffer  field-buffer)
	(goto-character  field-mark)
    )


    (return-to-pre-gotofield-buffer
	(switch-to-buffer  pre-gotofield-buffer)
    )
)
-------
-------
