Add 2008 to copyright years.
[bpt/emacs.git] / lisp / skeleton.el
index d4caca3..8ae3a1b 100644 (file)
@@ -1,6 +1,7 @@
 ;;; skeleton.el --- Lisp language extension for writing statement skeletons
 
-;; Copyright (C) 1993, 1994, 1995, 1996, 2003 by Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003,
+;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
 ;; Maintainer: FSF
@@ -10,7 +11,7 @@
 
 ;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -20,8 +21,8 @@
 
 ;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;; page 3:     mirror-mode, an example for setting up paired insertion
 
 
-(defvar skeleton-transformation 'identity
+(defvar skeleton-transformation-function 'identity
   "*If non-nil, function applied to literal strings before they are inserted.
 It should take strings and characters and return them transformed, or nil
 which means no transformation.
 Typical examples might be `upcase' or `capitalize'.")
+(defvaralias 'skeleton-transformation 'skeleton-transformation-function)
 
 ; this should be a fourth argument to defvar
-(put 'skeleton-transformation 'variable-interactive
+(put 'skeleton-transformation-function 'variable-interactive
      "aTransformation function: ")
 
 
 (defvar skeleton-autowrap t
-  "Controls wrapping behaviour of functions created with `define-skeleton'.
+  "Controls wrapping behavior of functions created with `define-skeleton'.
 When the region is visible (due to `transient-mark-mode' or marking a region
 with the mouse) and this is non-nil and the function was called without an
 explicit ARG, then the ARG defaults to -1, i.e. wrapping around the visible
@@ -74,8 +76,9 @@ The variables `v1' and `v2' are still set when calling this.")
 
 
 ;;;###autoload
-(defvar skeleton-filter 'identity
+(defvar skeleton-filter-function 'identity
   "Function for transforming a skeleton proxy's aliases' variable value.")
+(defvaralias 'skeleton-filter 'skeleton-filter-function)
 
 (defvar skeleton-untabify t
   "When non-nil untabifies when deleting backwards with element -ARG.")
@@ -154,9 +157,9 @@ on `skeleton-autowrap'.  An ARG of  M-0  will prevent this just for once.
 This command can also be an abbrev expansion (3rd and 4th columns in
 \\[edit-abbrevs]  buffer: \"\"  command-name).
 
-Optional first argument STR may also be a string which will be the value
+Optional second argument STR may also be a string which will be the value
 of `str' whereas the skeleton's interactor is then ignored."
-  (skeleton-insert (funcall skeleton-filter skeleton)
+  (skeleton-insert (funcall skeleton-filter-function skeleton)
                   ;; Pretend  C-x a e  passed its prefix arg to us
                   (if (or arg current-prefix-arg)
                       (prefix-numeric-value (or arg
@@ -198,7 +201,7 @@ SKELETON is made up as (INTERACTOR ELEMENT ...).  INTERACTOR may be nil if
 not needed, a prompt-string or an expression for complex read functions.
 
 If ELEMENT is a string or a character it gets inserted (see also
-`skeleton-transformation').  Other possibilities are:
+`skeleton-transformation-function').  Other possibilities are:
 
        \\n     go to next line and indent according to mode
        _       interesting point, interregion here
@@ -206,8 +209,8 @@ If ELEMENT is a string or a character it gets inserted (see also
                interesting point set by _
        >       indent line (or interregion if > _) according to major mode
        @       add position to `skeleton-positions'
-       &       do next ELEMENT iff previous moved point
-       |       do next ELEMENT iff previous didn't move point
+       &       do next ELEMENT if previous moved point
+       |       do next ELEMENT if previous didn't move point
        -num    delete num preceding characters (see `skeleton-untabify')
        resume: skipped, continue here if quit is signaled
        nil     skipped
@@ -359,7 +362,7 @@ automatically, and you are prompted to fill in the variable parts.")))
            (backward-delete-char-untabify (- element))
          (delete-backward-char (- element)))
       (insert (if (not literal)
-                 (funcall skeleton-transformation element)
+                 (funcall skeleton-transformation-function element)
                element))))
    ((or (eq element '\n)                       ; actually (eq '\n 'n)
        ;; The sequence `> \n' is handled specially so as to indent the first
@@ -463,7 +466,7 @@ will attempt to insert pairs of matching characters.")
   "*If this is nil, paired insertion is inhibited before or inside a word.")
 
 
-(defvar skeleton-pair-filter (lambda () nil)
+(defvar skeleton-pair-filter-function (lambda () nil)
   "Attempt paired insertion if this function returns nil, before inserting.
 This allows for context-sensitive checking whether pairing is appropriate.")
 
@@ -489,7 +492,7 @@ Elements might be (?` ?` _ \"''\"), (?\\( ?  _ \" )\") or (?{ \\n > _ \\n ?} >).
 With no ARG, if `skeleton-pair' is non-nil, pairing can occur.  If the region
 is visible the pair is wrapped around it depending on `skeleton-autowrap'.
 Else, if `skeleton-pair-on-word' is non-nil or we are not before or inside a
-word, and if `skeleton-pair-filter' returns nil, pairing is performed.
+word, and if `skeleton-pair-filter-function' returns nil, pairing is performed.
 Pairing is also prohibited if we are right after a quoting character
 such as backslash.
 
@@ -511,7 +514,7 @@ symmetrical ones, and the same character twice for the others."
              (and (not mark)
                   (or overwrite-mode
                       (if (not skeleton-pair-on-word) (looking-at "\\w"))
-                      (funcall skeleton-pair-filter))))
+                      (funcall skeleton-pair-filter-function))))
          (self-insert-command (prefix-numeric-value arg))
        (skeleton-insert (cons nil skeleton) (if mark -1))))))
 
@@ -525,13 +528,13 @@ symmetrical ones, and the same character twice for the others."
 ;;  (kill-all-local-variables)
 ;;  (make-local-variable 'skeleton-pair)
 ;;  (make-local-variable 'skeleton-pair-on-word)
-;;  (make-local-variable 'skeleton-pair-filter)
+;;  (make-local-variable 'skeleton-pair-filter-function)
 ;;  (make-local-variable 'skeleton-pair-alist)
 ;;  (setq major-mode 'mirror-mode
 ;;     mode-name "Mirror"
 ;;     skeleton-pair-on-word t
 ;;     ;; in the middle column insert one or none if odd window-width
-;;     skeleton-pair-filter (lambda ()
+;;     skeleton-pair-filter-function (lambda ()
 ;;                            (if (>= (current-column)
 ;;                                    (/ (window-width) 2))
 ;;                                ;; insert both on next line