There are no other files named bughunt.emacs in the archive.
!* [BBNG]PS:<EMACS.NEW>XBUG.EMACS.3, 31-Dec-82 22:40:52, Edit by FHSU!
!* ok to kill this library. wont leave Emacs with invalid commands.!
!* [BBNG]PS:<EMACS.NEW>BUGHUNT.EMACS.3, 31-Dec-82 12:37:09, Edit by FHSU!
!* moved & Set Bughunt Mode Line$ into Bughunter Mode$ so people who dont!
!* set their mode line hook properly dont get screwed.!
!* <EMACS>BUGHUNT.EMACS.20, 18-Nov-81 03:04:18, Edit by RMS!
!* <HOLMES>BUGHUNT.EMACS.7, 26-Jun-80 22:47:48, Edit by HOLMES!
!* <GERGELY.EMACS>BUGHUNT.EMACS.11, 20-Jun-80 12:58:04, Edit by GERGELY!
!~Filename~:! !Tack on for adding patches to programs!
!& Setup BUGHUNT Library:! !S Special Startup definitions!
:IA[A]_' "#[A' !* QA gets the special text!
!* prepare to set our functions up and setup for when we get killed!
:i* BugHunt_library_already_loaded fg 0'
0m.vBugHunt_Library_Loaded !* say we re loaded!
!& Kill Bughunt Library:! !S Undo what our buggy code did!
mK Bughunt_Library_Loaded !* we re finally gone!
!& Replace Def:! !S Find MM-var and rename.
Assumes Kill Variable is in qK.!
:i1 !* get string arg!
0fo..q MM_1u0 !* find definition!
q0 f"n m.v BUG_Old_1 ' !* save it for later!
mK MM_1 !* kill it!
!& Restore Def:! !S Restore saved macro.
Assumes Kill Variable is in qK.!
:i1 !* get string arg!
0fo..q BUG_Old_1u0 !* find definition!
q0 f"n m.v MM_1 ' !* restore it as a MM-var!
mK BUG_Old_1 !* kill it!
!& Set Bughunt Mode Line:! !S Set the Mode line hook for the library!
f[ b bind
1fs mode change
!Bughunter Mode:! !C Sets up comments to include a special text.
This text is defined in the variable $Bughunter Text$. If this
variable is undefined then your user name is used. An argument is
passed on directly to the value of Q$Bughunter Mode$. With no
argument the mode is toggled.!
FF"N "'N uBughunter_Mode W'
!^R Bughunt Indent for Comment:! !^R Move to or create comment.
Finds start of existing comment, or creates one at end of line.
Indents the comment to Comment Column.
An existing double semicolon (or whatever character) comment
is aligned like a line of code.
An existing triple semicolon comment is not moved.
With argument <n>, aligns the existing comments in the
next <n> lines, but does not create comments.
Comment Begin holds the string inserted to start a comment.
Comment Start holds the string recognized as starting an old one.
Comment End holds the string inserted to end a comment.
Comment Rounding holds the macro used when the code goes
past the comment column, to compute a new (larger) comment column
from the width of the code (default is "+1").!
f[ s string
Fq0:"G :i0;' !* [PJG] Use ; as default comment starter.!
[R [H [1 !* qR gets (if needed) macro to!
!* round comment col up.!
!* Each time thru, QH gets hpos!
!* and q1 gets actual comment col.!
[.1 [.2 [.3
ff"n !* With arg, repeat over that many lines,!
< 0l @:f :fb0"n m.1' !* and hack only lines which!
!* already have comments.!
-f ' !* Return range covering all lines hacked.!
0l @:f :fb0 "e !* No comment yet on this line =>!
:l gB -1u.1 !* with no arg, make a comment at!
!* end of line.!
0fo..qComment_Endu1 !* Add in the terminator if any.!
q1"n g1 fkc' fqBr'
"# !* For an existing comment,!
fq0-1"e 0a-(0,1a)"e !* Is one-char starter duplicated!
!* (;; in LISP)?!
0a-(0,2a)"e 2c 0' !* Yes. Maybe it's triplicated,!
!* => don't move it.!
0l mI !* Just duplicated => align!
!* comment as if it were code.!
0l :f ( s0 c)'' !* Return whole line as changed!
!* range, put pt after ;;!
fkc !* Else align to comment column.!
!* Go before the starter.!
fs shposu.1' !* Get old comment-indentation.!
.u.3 @-f _l !* Back up over indentation before!
!* calculating hpos!
qCu1 fs shposuH !* since the hpos will affect!
!* where comment goes!
qH-q1+1"g !* If code on line goes past!
!* comment column, round it up.!
0fo..q Comment_RoundinguR !* QR gets macro to round column!
"# qH-q1R+q1 u1'' !* Q1 gets temporarily altered!
!* comment col for this line.!
q1-q.1"n .,q.3k !* If indentation must be changed,!
!* flush old!
qH,q1mI' !* and insert the new.!
"# q.3j' !* Else move fwd over existing!
.,zf=Bf"e fqB+1' -1c !* Move fwd over comment starter.!
1000 FO..QBughunter_Mode-1000"E q1-q.1"e 0'' !* Return 0 if no change!
q.2,. !* or range of change.!
!^R Bughunt Indent New Comment Line:! !^R Inserts CRLF, then starts new comment.
The indentation and the number of comment-start characters
are copied from the previous line's comment.
If done when not in a comment, acts like ^R Indent New Line.!
@-F_ K !* Leave no spacing behind us at!
!* end of line.!
1,@MM !* Run this user's CR definition!
!* to insert a CR!
0fo..q Comment_Start[C !* If there is a comment format!
QC"n .[2 0:@l
0:fbc"l !* and we are inside a comment!
!* now, make a new one.!
0fo..q Comment_Begin[B !* How do new comments start?!
qb"e qcub' !* May be same as how old ones are!
fkc fs shpos[1 !* Make new line a comment with!
!* same indentation!
fqc-1"e @fc-1xc' !* and same number of extra!
!* semicolons to start with.!
qe"n -fqe f~e"n ge'' !* Put comment end on previous!
!* line, unless already one.!
2:@l -@f_ k !* Flush any whitespace at end of!
!* new line.!
qe"n -fqe f~e"n ge'' !* Put in comment end unless!
!* already have one.!
0@l 0,q1mMM_&_Xindent gc
gb !* Put in comment beginning!
.u2 :@l q0,.(q2j)'
0fo..q Fill_Prefix[3 !* If a prefix is defined, put it!
!* on new line.!
"# 0fo..q Space_Indent_Flag"n
0 f f@mI'' !* Else run the Tab definition to!
fs rgetty"e :0t'
!^R Bughunt Down Comment Line:! !^R Move to start of next line's comment.
Equivalent to ^R Down Real Line followed by ^R Indent For Comment.!
1000000.[.H !* Don't bother FM'ing - stay at column 0!
.[3 !* If this line already has a!
QComment_End[1 !* See if comment should have an!
FQ1"G .,(@L .+FQ1):FB1"E !* If so, does it have one?!
Q3J :@L G1 FK F'' !* If not, make one.!
Q3J @F_ R
.[2 !* Find end of whitespace!
!* following comment start.!
:@L .-FQ1-Q2:"G !* If comment end is at end of!
!* line and nothing!
!* comes between it and the!
Q3-FQ0J @:K !* Kill the comment and the!
!* preceding whitespace.!
@-F_ K 0 F''
:@L .U0 @L .-Q0"E I !* Advance to next line. Create!
!* line if nec.!
!^R Bughunt Up Comment Line:! !^R Move to start of previous line's comment.
Equivalent to ^R Up Real Line followed by ^R Indent For Comment.!
!& Replace Macro:! !S Replaces macro definitions on ^R characters.
Takes two arguments. The first is the macro to be replaced and
the second is the replacement. It pushes the old definitions.!
-1u..9 !* Q..9 - Character counter !
< %..9, :F U..9 Q..9:; !* Find next char whose def. matches !
U..9 > !* and push on the new definition !
0[0 QPrefix_Char_List[1 [2 [3 !* [RDH] Now do the Prefix Chars !
< Q0-FQ1; !* [RDH] Are we done? !
Q0+6U0 !* [RDH] Increment counter !
Q0-4,Q0 :G1 U2 !* [RDH] Get the dispatch Q-reg !
_F2 U3 !* [RDH] !
Q3"G 0,Q3 :G2 U2' !* [RDH] Eliminate blanks !
-1U..9 :I32(Q..9) !* [RDH] Q..9 - Character counter !
< %..9,F2 U..9 Q..9:; !* [RDH] Find next char whose def matches !
U:3 > !* [RDH] and change the definition !
> !* [RDH] Loop through Prefix Chars !
!* keep this as one long comment
* local modes:
* compile command: m(m.mGenerate library)dsk:bughuntbughunt.emacs