home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
editor
/
me_cd.arc
/
ABBREV.MUT
next >
Wrap
Text File
|
1988-04-04
|
2KB
|
70 lines
;; abbrev.mut : abbrevation mode
;; C Durland 4/88
;; Note: This is a very limited abbrev mode.
(include spoint.mut)
(const abbrev-buffer "*ABBREVs*")
(defun
stuff-text (array byte text 1) HIDDEN
{
(int n z)
(for (n 0) (!= 0 (z (text n)))(+= n 1)(exe-key z))
}
lookup-abbrev (string name) HIDDEN
{
(bool s)
(save-point)
(switch-to-buffer abbrev-buffer)(beginning-of-buffer)
(if (re-search-forward (concat '^' name ' ' ))
{ (looking-at '.*') (s TRUE) }
(s FALSE)
)
(restore-point)(msg "")
s
}
expand-abbrev
{
(bool s)
(if (and (!= 1 (current-column))
{ (previous-character)(s (looking-at '\w'))(next-character) s } )
{
(previous-word)
(if (and (looking-at '\w+')(lookup-abbrev (get-matched '&')))
{ (delete-word)(stuff-text (get-matched '&')) }
(next-word)
)
})
}
select-abbrev-file
{
(string abbrev-file 85)
(abbrev-file (ask "What abbrev file do you want to load? "))
(kill-buffer abbrev-buffer)(save-point)
(switch-to-buffer abbrev-buffer)(read-file abbrev-file)
(buffer-flags -1 0x6)
(restore-point)
}
key-pressed-hook (int key)
{
(switch key
0x20 () ; space
0x2C () ; comma
0x14D () ; Return
0x21 () ; !
0x2E () ; period
0x3F () ; ?
default (done) ; key does not trigger abbrev expansion
)
(exe-key 0x1031) ; S-1
}
)
(bind-local-key "expand-abbrev" "S-1")