;;; Code:
-(defcustom only-global-abbrevs nil
+(defcustom only-global-abbrevs nil
"*t means user plans to use global abbrevs only.
This makes the commands that normally define mode-specific abbrevs
define global abbrevs instead."
(clear-abbrev-table (symbol-value (car tables)))
(setq tables (cdr tables)))))
+(defun copy-abbrev-table (table)
+ "Make a new abbrev-table with the same abbrevs as TABLE."
+ (let ((new-table (make-abbrev-table)))
+ (mapatoms
+ (lambda (symbol)
+ (define-abbrev new-table
+ (symbol-name symbol)
+ (symbol-value symbol)
+ (symbol-function symbol)))
+ table)
+ new-table))
+
(defun insert-abbrevs ()
"Insert after point a description of all defined abbrevs.
Mark is set after the inserted text."
(setq found (car tables)))
(setq tables (cdr tables)))
found))
-
+
(defun prepare-abbrev-list-buffer (&optional local)
(save-excursion
(let ((table local-abbrev-table))
(while tables
(insert-abbrev-table-description (car tables) nil)
(setq tables (cdr tables))))
- (write-region 1 (point-max) file)
+ (write-region (point-min) (point-max) file)
(erase-buffer)))
\f
(defun add-mode-abbrev (arg)
(y-or-n-p (format "%s expands to \"%s\"; redefine? "
name (abbrev-expansion name table))))
(define-abbrev table (downcase name) exp))))
-
+
(defun inverse-add-mode-abbrev (arg)
"Define last word before point as a mode-specific abbrev.
With prefix argument N, defines the Nth word before point.
(interactive "p")
(inverse-add-abbrev
(if only-global-abbrevs
- global-abbrev-table
+ global-abbrev-table
(or local-abbrev-table
(error "No per-mode abbrev table")))
"Mode" arg))