74 |
(clear-abbrev-table (symbol-value (car tables))) |
(clear-abbrev-table (symbol-value (car tables))) |
75 |
(setq tables (cdr tables))))) |
(setq tables (cdr tables))))) |
76 |
|
|
77 |
|
(defun copy-abbrev-table (table) |
78 |
|
"Make a new abbrev-table with the same abbrevs as TABLE." |
79 |
|
(let ((new-table (make-abbrev-table))) |
80 |
|
(mapatoms |
81 |
|
(lambda (symbol) |
82 |
|
(define-abbrev new-table |
83 |
|
(symbol-name symbol) |
84 |
|
(symbol-value symbol) |
85 |
|
(symbol-function symbol))) |
86 |
|
table) |
87 |
|
new-table)) |
88 |
|
|
89 |
(defun insert-abbrevs () |
(defun insert-abbrevs () |
90 |
"Insert after point a description of all defined abbrevs. |
"Insert after point a description of all defined abbrevs. |
91 |
Mark is set after the inserted text." |
Mark is set after the inserted text." |
212 |
abbrev-file-name))) |
abbrev-file-name))) |
213 |
(or (and file (> (length file) 0)) |
(or (and file (> (length file) 0)) |
214 |
(setq file abbrev-file-name)) |
(setq file abbrev-file-name)) |
215 |
(save-excursion |
(let ((coding-system-for-write 'emacs-mule)) |
216 |
(set-buffer (get-buffer-create " write-abbrev-file")) |
(with-temp-file file |
217 |
(erase-buffer) |
(insert ";;-*-coding: emacs-mule;-*-\n") |
218 |
(let ((tables abbrev-table-name-list)) |
(dolist (table abbrev-table-name-list) |
219 |
(while tables |
(insert-abbrev-table-description table nil))))) |
|
(insert-abbrev-table-description (car tables) nil) |
|
|
(setq tables (cdr tables)))) |
|
|
(write-region 1 (point-max) file) |
|
|
(erase-buffer))) |
|
220 |
|
|
221 |
(defun add-mode-abbrev (arg) |
(defun add-mode-abbrev (arg) |
222 |
"Define mode-specific abbrev for last word(s) before point. |
"Define mode-specific abbrev for last word(s) before point. |
229 |
(interactive "p") |
(interactive "p") |
230 |
(add-abbrev |
(add-abbrev |
231 |
(if only-global-abbrevs |
(if only-global-abbrevs |
232 |
global-abbrev-table |
global-abbrev-table |
233 |
(or local-abbrev-table |
(or local-abbrev-table |
234 |
(error "No per-mode abbrev table"))) |
(error "No per-mode abbrev table"))) |
235 |
"Mode" arg)) |
"Mode" arg)) |