(listify-key-sequence-1, event-modifiers): Don't presume internal bit layout
[bpt/emacs.git] / lisp / abbrev.el
index 3cbeb19..5144a66 100644 (file)
@@ -1,12 +1,14 @@
 ;;; abbrev.el --- abbrev mode commands for Emacs
 
-;; Copyright (C) 1985-1991 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
+
+;; Keywords: abbrev
 
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
+;;; Commentary:
+
+;; This facility is documented in the Emacs Manual.
+
+;;; Code:
 
 (defconst only-global-abbrevs nil "\
 *t means user plans to use global abbrevs only.
@@ -25,7 +32,7 @@ Makes the commands to define mode-specific abbrevs define global ones instead.")
 
 (defun abbrev-mode (arg)
   "Toggle abbrev mode.
-With arg, turn abbrev mode on iff arg is positive.
+With argument 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")
@@ -122,7 +129,7 @@ the ones defined from the buffer now."
    (while (and (not (eobp)) (re-search-forward "^(" nil t))
      (let* ((buf (current-buffer))
            (table (read buf))
-           abbrevs)
+           abbrevs name hook exp count)
        (forward-line 1)
        (while (progn (forward-line 1)
                     (not (eolp)))
@@ -152,7 +159,7 @@ Does not print anything."
   (read-abbrev-file file t))
 
 (defun write-abbrev-file (file)
-  "Write all abbrev definitions to file of Lisp code.
+  "Write all abbrev definitions to file of Lisp code.
 The file written can be loaded in another session to define the same abbrevs.
 The argument FILE is the file name to write."
   (interactive
@@ -160,7 +167,6 @@ The argument FILE is the file name to write."
     (read-file-name "Write abbrev file: "
                    (file-name-directory (expand-file-name abbrev-file-name))
                    abbrev-file-name)))
-  (interactive "FWrite abbrev file: ")
   (or (and file (> (length file) 0))
       (setq file abbrev-file-name))
   (save-excursion
@@ -211,6 +217,7 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
          (read-string (format (if exp "%s abbrev for \"%s\": "
                                 "Undefine %s abbrev: ")
                               type exp)))
+    (set-text-properties 0 (length name) nil name)
     (if (or (null exp)
            (not (abbrev-expansion name table))
            (y-or-n-p (format "%s expands to \"%s\"; redefine? "
@@ -244,6 +251,7 @@ Expands the abbreviation after defining it."
      (forward-word (- arg))
      (setq name (buffer-substring (point) (progn (forward-word 1)
                                               (setq nameloc (point))))))
+    (set-text-properties 0 (length name) nil name)
     (setq exp (read-string (format "%s expansion for \"%s\": "
                                   type name)))
     (if (or (not (abbrev-expansion name table))