]> code.delx.au - gnu-emacs/blobdiff - lisp/abbrev.el
(write-abbrev-file): Don't hardcode point-min == 1.
[gnu-emacs] / lisp / abbrev.el
index ab0f715d27278b98985030a9c277f5fba07586d4..a73c8e0fe8d9aeb7edba1bca50ff944b8eb6eef4 100644 (file)
@@ -28,7 +28,7 @@
 
 ;;; 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."
@@ -74,6 +74,18 @@ buffer."
       (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."
@@ -103,7 +115,7 @@ Otherwise display all abbrevs."
        (setq found (car tables)))
       (setq tables (cdr tables)))
     found))
-    
+
 (defun prepare-abbrev-list-buffer (&optional local)
   (save-excursion
     (let ((table local-abbrev-table))
@@ -207,7 +219,7 @@ The argument FILE is the file name to write."
      (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)
@@ -254,7 +266,7 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
            (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.
@@ -263,7 +275,7 @@ Expands the abbreviation after defining it."
   (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))