4.4BSD/usr/src/contrib/emacs-18.57/lisp/abbrev.elc


(defun abbrev-mode (arg) "\
Toggle abbrev mode.
With arg, turn abbrev mode on iff arg is positive.
In abbrev mode, inserting an abbreviation causes it to expand
and be replaced by its expansion." (interactive "P") (byte-code "ˆ	??	!V !" [abbrev-mode arg nil prefix-numeric-value 0 set-buffer-modified-p buffer-modified-p] 4))

(defvar edit-abbrevs-map nil "\
Keymap used in edit-abbrevs.")

(if edit-abbrevs-map nil (setq edit-abbrevs-map (make-sparse-keymap)) (define-key edit-abbrevs-map "" (quote edit-abbrevs-redefine)) (define-key edit-abbrevs-map "" (quote edit-abbrevs-redefine)))

(defun kill-all-abbrevs nil "\
Undefine all defined abbrevs." (interactive) (byte-code "ˆ	@J!A)" [tables abbrev-table-name-list nil clear-abbrev-table] 4))

(defun insert-abbrevs nil "\
Insert after point a description of all defined abbrevs.
Mark is set after the inserted text." (interactive) (byte-code "ÈĊ	@\"A)`)!" [tables abbrev-table-name-list t nil push-mark insert-abbrev-table-description] 5))

(defun list-abbrevs nil "\
Display a list of all defined abbrevs." (interactive) (byte-code " !" [nil display-buffer prepare-abbrev-list-buffer] 3))

(defun prepare-abbrev-list-buffer nil (byte-code "!q 	@\"A)eb! )!" [tables abbrev-table-name-list t nil get-buffer-create "*Abbrevs*" erase-buffer insert-abbrev-table-description set-buffer-modified-p edit-abbrevs-mode] 7))

(defun edit-abbrevs-mode nil "\
Major mode for editing the list of abbrev definitions.
\\{edit-abbrevs-map}" (interactive) (byte-code "Èĉʼn
!" [major-mode mode-name edit-abbrevs-map nil edit-abbrevs-mode "Edit-Abbrevs" use-local-map] 2))

(defun edit-abbrevs nil "\
Alter abbrev definitions by editing a list of them.
Selects a buffer containing a list of abbrev definitions.
You can edit them and type C-c C-c to redefine abbrevs
according to your editing.
Buffer contains a header line for each abbrev table,
 which is the abbrev table name in parentheses.
This is followed by one line per abbrev in that table:
NAME   USECOUNT   EXPANSION   HOOK
where NAME and EXPANSION are strings with quotes,
USECOUNT is an integer, and HOOK is any valid function
or may be omitted (it is usually omitted)." (interactive) (byte-code " !" [nil switch-to-buffer prepare-abbrev-list-buffer] 3))

(defun edit-abbrevs-redefine nil "\
Redefine abbrevs according to current buffer contents." (interactive) (byte-code "!!" [t nil define-abbrevs set-buffer-modified-p] 3))

(defun define-abbrevs (&optional arg) "\
Define abbrevs according to current visible buffer contents.
See documentation of edit-abbrevs for info on the format of the
text you must have in the buffer.
With argument, eliminate all abbrev definitions except
the ones defined from the buffer now." (interactive "P") (byte-code " ebm?#op!!!l?e!!!!l?L!	!	F
B&
\"+
)" [arg nil t buf table abbrevs name count exp hook kill-all-abbrevs re-search-forward "^(" read forward-line 1 skip-chars-backward " 	
" define-abbrev-table] 17))

(defun read-abbrev-file (file &optional quietly) "\
Read abbrev definitions from file written with write-abbrev-file.
Takes file name as argument.
Optional second argument non-nil means don't print anything." (interactive "fRead abbrev file: ") (byte-code "ˆGV	#‰" [file abbrev-file-name nil quietly save-abbrevs t abbrevs-changed load 0] 4))

(defun quietly-read-abbrev-file (file) "\
Read abbrev definitions from file written with write-abbrev-file.
Takes file name as argument.  Does not print anything." (byte-code "\"" [file t read-abbrev-file] 3))

(defun write-abbrev-file (file) "\
Write all abbrev definitions to file of Lisp code.
The file can be loaded to define the same abbrevs." (interactive "FWrite abbrev file: ") (byte-code "Ĉ
GV	!q 
.
@\"
A)d# )" [file abbrev-file-name tables abbrev-table-name-list nil 0 get-buffer-create " write-abbrev-file" erase-buffer insert-abbrev-table-description write-region 1] 7))

(defun add-mode-abbrev (arg) "\
Define mode-specific abbrev for last word(s) before point.
Argument is how many words before point form the expansion;
or zero means the region is the expansion.
A negative argument means to undefine the specified abbrev.
Reads the abbreviation in the minibuffer." (interactive "p") (byte-code "Ĉ	
!#" [only-global-abbrevs global-abbrev-table local-abbrev-table arg nil add-abbrev error "No per-mode abbrev table." "Mode"] 5))

(defun add-global-abbrev (arg) "\
Define global (all modes) abbrev for last word(s) before point.
Argument is how many words before point form the expansion;
or zero means the region is the expansion.
A negative argument means to undefine the specified abbrev.
Reads the abbreviation in the minibuffer." (interactive "p") (byte-code "ˆ	#" [global-abbrev-table arg nil add-abbrev "Global"] 4))

(defun add-abbrev (table type arg) (byte-code "	Y`	U 	[!`)\"#!?@
\"?@

\"#!J
!#*" [exp arg name type table 0 buffer-substring mark forward-word nil read-string format "%s abbrev for \"%s\": " abbrev-expansion y-or-n-p "%s expands to \"%s\"; redefine? " define-abbrev downcase] 14))

(defun inverse-add-mode-abbrev (arg) "\
Define last word before point as a mode-specific abbrev.
With argument N, defines the Nth word before point.
Reads the expansion in the minibuffer.
Expands the abbreviation after defining it." (interactive "p") (byte-code "Ĉ	
!#" [only-global-abbrevs global-abbrev-table local-abbrev-table arg nil inverse-add-abbrev error "No per-mode abbrev table." "Mode"] 5))

(defun inverse-add-global-abbrev (arg) "\
Define last word before point as a global (mode-independent) abbrev.
With argument N, defines the Nth word before point.
Reads the expansion in the minibuffer.
Expands the abbreviation after defining it." (interactive "p") (byte-code "ˆ	#" [global-abbrev-table arg nil inverse-add-abbrev "Global"] 4))

(defun inverse-add-abbrev (table type arg) (byte-code "[!`!`\")#!
\"?6
\"#!H
!
#	b )+" [name nameloc exp arg type table nil forward-word buffer-substring 1 read-string format "%s expansion for \"%s\": " abbrev-expansion y-or-n-p "%s expands to \"%s\"; redefine? " define-abbrev downcase expand-abbrev] 14))

(defun abbrev-prefix-mark (&optional arg) "\
Mark current point as the beginning of an abbrev.
Abbrev to be expanded starts here rather than at
beginning of word.  This way, you can expand an abbrev
with a prefix: insert the prefix, use this command,
then insert the abbrev." (interactive "P") (byte-code "È  pc" [arg abbrev-start-location abbrev-start-location-buffer nil expand-abbrev point-marker "-"] 4))

(defun expand-region-abbrevs (start end &optional noquery) "\
For abbrev occurrence in the region, offer to expand it.
The user is asked to type y or n for each occurrence.
A numeric argument means don't query; expand all abbrevs.
Calling from a program, arguments are START END &optional NOQUERY." (interactive "r") (byte-code "ň	^bd	]Zm?!`d
ZX?  :! 5!: )))" [start end lim modp noquery nil forward-word 1 buffer-modified-p expand-abbrev set-buffer-modified-p unexpand-abbrev y-or-n-p "Expand this? "] 9))