mackenzi@stolaf.UUCP (David MacKenzie) (12/03/88)
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: mark.cmd
# Wrapped by dave@edfdc on Sat Dec 3 04:22:07 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mark.cmd' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mark.cmd'\"
else
echo shar: Extracting \"'mark.cmd'\" \(3038 characters\)
sed "s/^X//" >'mark.cmd' <<'END_OF_FILE'
X; mark.cmd
X; Bookmark macros for MicroEMACS v3.9 and higher
X; These macros are similar to the m and ' and ` commands in vi.
X;
X; Each buffer has its own set of bookmarks.
X; We kludge around the lack of array variables by building "set"
X; statements in temporary buffers and then executing them.
X; Each bookmark position is stored as two variables, the names of which
X; are constructed from the following pieces:
X; %ml and %mc ("mark line and mark column")
X; the bookmark key character
X; the leftmost six characters of the buffer name
X; (MicroEMACS variables are significant to nine characters)
X;
X; Bugs:
X; The bookmarks don't move if you move, delete or insert lines.
X;
X; David MacKenzie
X; Latest revision: 11/23/88
X
X23 store-macro
X run set-bookmark
X!endm
Xbind-to-key execute-macro-23 M-^B
X
X24 store-macro
X run jump-bookmark
X!endm
Xbind-to-key execute-macro-24 M-^J
X
Xstore-procedure set-bookmark
X write-message "Set bookmark: "
X set %markchar >key
X
X ; Save current position so we can return exactly.
X set %savename $cbufname
X set %savewlin $cwline
X set %saveline $curline
X set %savecol $curcol
X
X ; Create a truncated buffer name to fit in 9-char max var name.
X set %truncnam &left %savename 6
X ; Create a command to execute in an invisible buffer.
X select-buffer "[BookTemp]"
X ; Save current line number.
X insert-string "set "
X insert-string &cat &cat "%ml" %markchar %truncnam
X insert-string " "
X insert-string %saveline
X insert-string "~n"
X ; Save current column.
X insert-string "set "
X insert-string &cat &cat "%mc" %markchar %truncnam
X insert-string " "
X insert-string %savecol
X insert-string "~n"
X unmark-buffer
X
X ; Execute the command and clean up.
X execute-buffer "[BookTemp]"
X
X select-buffer %savename
X %savewlin redraw-display
X delete-buffer "[BookTemp]"
X write-message &cat &cat "[Bookmark " %markchar " set]"
X!endm
X
Xstore-procedure jump-bookmark
X write-message "Jump to bookmark: "
X set %markchar >key
X
X ; Save current position so we can return exactly.
X set %savename $cbufname
X set %savewlin $cwline
X
X ; Create a truncated buffer name to fit in 9-char max var name.
X set %truncnam &left %savename 6
X ; Create a command to execute in an invisible buffer.
X select-buffer "[JumpTemp]"
X ; Restore line number.
X insert-string "set %jumpline "
X insert-string &cat &cat "%ml" %markchar %truncnam
X insert-string "~n"
X insert-string "set %jumpcol "
X insert-string &cat &cat "%mc" %markchar %truncnam
X insert-string "~n"
X unmark-buffer
X
X ; Execute the command and clean up.
X execute-buffer "[JumpTemp]"
X
X select-buffer %savename
X delete-buffer "[JumpTemp]"
X
X !if &sequal %jumpline "ERROR"
X write-message &cat &cat "[Bookmark " %markchar " not set]"
X %savewlin redraw-display
X !else
X write-message &cat &cat "[Bookmark " %markchar "]"
X set $curcol %jumpcol
X ; Don't ask me why we need to add 1 here.
X set $cwline &add %jumpline 1
X redraw-display
X !endif
X!endm
END_OF_FILE
if test 3038 -ne `wc -c <'mark.cmd'`; then
echo shar: \"'mark.cmd'\" unpacked with wrong size!
fi
# end of 'mark.cmd'
fi
echo shar: End of shell archive.
exit 0