]> code.delx.au - gnu-emacs/blobdiff - lisp/expand.el
* lisp/descr-text.el (describe-char-unicode-data): Fix copy/paste errors.
[gnu-emacs] / lisp / expand.el
index 359db36b23b0c37bb85f232814dc64affca7b90e..b0f19d2a01b9fc1e16daaf178540627ac51d3a35 100644 (file)
@@ -1,7 +1,6 @@
 ;;; expand.el --- make abbreviations more usable
 
-;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Frederic Lepied <Frederic.Lepied@sugix.frmug.org>
 ;; Maintainer: Frederic Lepied <Frederic.Lepied@sugix.frmug.org>
@@ -9,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
     ("while" "while () {\n\n}" (8 12))
     ("default" "default:\n\nbreak;" 10)
     ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37))
-  "Expansions for C mode. See `expand-add-abbrevs'.")
+  "Expansions for C mode.  See `expand-add-abbrevs'.")
 
 ;; lisp example from Jari Aalto <jaalto@tre.tele.nokia.fi>
 (defconst expand-sample-lisp-mode-expand-list
      (list 12 14))
 
     )
-   "Expansions for Lisp mode. See `expand-add-abbrevs'.")
+   "Expansions for Lisp mode.  See `expand-add-abbrevs'.")
 
 ;; perl example from Jari Aalto <jaalto@tre.tele.nokia.fi>
 (defconst expand-sample-perl-mode-expand-list
     "for"                               ; foreach
     (concat
      "for (  )\n"
-     "{\n\n\}"
+     "{\n\n}"
      )
     (list 7 12))
 
     "whi"                               ; foreach
     (concat
      "while (  )\n"
-     "{\n\n\}"
+     "{\n\n}"
      )
     (list 9 15))
 
     "iff"
     (concat
      "if (  )\n"
-     "{\n\n\}"
+     "{\n\n}"
      )
     (list 6 12))
 
    (list "rtu"  "return ;"      (list 8))
 
    )
-  "Expansions for Perl mode. See `expand-add-abbrevs'.")
+  "Expansions for Perl mode.  See `expand-add-abbrevs'.")
 
 ;;; Code:
 
 ;;;###autoload
 (defun expand-add-abbrevs (table abbrevs)
-  "Add a list of abbrev to abbrev table TABLE.
+  "Add a list of abbreviations to abbrev table TABLE.
 ABBREVS is a list of abbrev definitions; each abbrev description entry
 has the form (ABBREV EXPANSION ARG).
 
 ABBREV is the abbreviation to replace.
 
 EXPANSION is the replacement string or a function which will make the
-expansion.  For example you, could use the DMacros or skeleton packages
+expansion.  For example, you could use the DMacros or skeleton packages
 to generate such functions.
 
 ARG is an optional argument which can be a number or a list of
@@ -282,7 +279,7 @@ beginning of the expanded text.
 
 If ARG is a list of numbers, point is placed according to the first
 member of the list, but you can visit the other specified positions
-cyclicaly with the functions `expand-jump-to-previous-slot' and
+cyclically with the functions `expand-jump-to-previous-slot' and
 `expand-jump-to-next-slot'.
 
 If ARG is omitted, point is placed at the end of the expanded text."
@@ -296,18 +293,15 @@ If ARG is omitted, point is placed at the end of the expanded text."
 (defvar expand-list nil "Temporary variable used by the Expand package.")
 
 (defvar expand-pos nil
-  "If non-nil, stores a vector containing markers to positions defined by the last expansion.
-This variable is local to a buffer.")
+  "If non-nil, stores a vector containing markers to positions defined by the last expansion.")
 (make-variable-buffer-local 'expand-pos)
 
 (defvar expand-index 0
-  "Index of the last marker used in `expand-pos'.
-This variable is local to a buffer.")
+  "Index of the last marker used in `expand-pos'.")
 (make-variable-buffer-local 'expand-index)
 
 (defvar expand-point nil
-  "End of the expanded region.
-This variable is local to a buffer.")
+  "End of the expanded region.")
 (make-variable-buffer-local 'expand-point)
 
 (defun expand-add-abbrev (table abbrev expansion arg)
@@ -370,7 +364,7 @@ See `expand-add-abbrevs'.  Value is non-nil if expansion was done."
     nil))
 
 (defun expand-do-expansion ()
-  (delete-backward-char (length last-abbrev-text))
+  (delete-char (- (length last-abbrev-text)))
   (let* ((vect (symbol-value last-abbrev))
         (text (aref vect 0))
         (position (aref vect 1))
@@ -429,8 +423,8 @@ This is used only in conjunction with `expand-add-abbrevs'."
        (goto-char (aref expand-pos expand-index))
        (run-hooks 'expand-jump-hook))))
 
-;;;###autoload (define-key ctl-x-map "ap" 'expand-jump-to-previous-slot)
-;;;###autoload (define-key ctl-x-map "an" 'expand-jump-to-next-slot)
+;;;###autoload (define-key abbrev-map "p" 'expand-jump-to-previous-slot)
+;;;###autoload (define-key abbrev-map "n" 'expand-jump-to-next-slot)
 
 (defun expand-build-list (len l)
   "Build a vector of offset positions from the list of positions."
@@ -472,7 +466,6 @@ This is used only in conjunction with `expand-add-abbrevs'."
                      (beginning-of-defun)
                      (point))
                    (point-min)))
-          (here (point))
           (state (parse-partial-sexp lim (point))))
       (cond
        ((nth 3 state) 'string)
@@ -506,5 +499,4 @@ This is used only in conjunction with `expand-add-abbrevs'."
 ;; run load hooks
 (run-hooks 'expand-load-hook)
 
-;; arch-tag: fee53e9e-30e3-4ef3-b191-9785e1f8e885
 ;;; expand.el ends here