[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Jeremy Weatherford wrote:
> I've heard of various TF macros and Emacs modes, but I'm not sure how to
> set these up.

Here's a TF module for general editing.

In your .tfrc, put /load localedit.tf or whereever you put it. Then the
server sends:

#$# edit name: foo upload: @program me.foo
return 0;
.

and tf receives this and loads it in pico or whatever and then sends
back:

@program me.foo
return 0;
.

/redo allows you to re-edit and re-send the last thing you edited.

It's not the most elegant thing in the world, but it's what I use, and I
happen to like it.
;;; Localedit script
;
; Originally from Kipp, mods by Psyclone
;
; Server sends: #$# edit name: <name> upload: <cmd>
;
; Script takes input until a ".", loads an editor on it, then
;   sends <cmd> and the edited input with an extra "." for
;   good luck. <name> is ignored. wraplog should be off..

; set this to an absolute path.  /sys does not do tilde completion
/set loced_basedir /home/bovine/tf
/set loced_doc /home/bovine/tf/tf_edit.doc

; set this to your favorite editor
/def pico=/sh pico -w %1

; init..
/set shipping 0

; trigger to finish local editing
; this should really be defined _within_ the start macro but, ugh.

/def -mregexp -t"^\\.$" do_localedit = \
        /if /test %{shipping} %;\
           /then /set shipping 0 %;\
           /log -w off %;\
           /pico %loced_doc %;\
           /sys echo . >> %{loced_doc} %;\
           /send %{upload} %;\
           /quote -dsend -S !"tail +2 %{loced_doc}" %;\
        /endif

; if you want backups, move the document somewhere instead of deleting it

/def -mregexp -t"^#\\$# edit name: (.*) upload: (.*)$" localedit_trigger = \
        /set upload %P2%;\
        /set shipping 1%;\
        /sh rm %{loced_doc}%;\
        /log -w %loced_doc

; command to let you edit the file and resend it, to (e.g.) fix bugs

/def redo = \
        /pico %{loced_doc}%;\
        /send %{upload}%;\
        /sys echo . >> %{loced_doc} %;\
        /quote -dsend -S !"tail +2 %{loced_doc}"