diff lisp/tempo.el @ 90203:187d6a1f84f7

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 485-492) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 92-94) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 22 Jul 2005 08:27:27 +0000
parents f9a65d7ebd29 dc9ffd263776
children 890cc78a5a24
line wrap: on
line diff
--- a/lisp/tempo.el	Tue Jul 19 02:58:20 2005 +0000
+++ b/lisp/tempo.el	Fri Jul 22 08:27:27 2005 +0000
@@ -117,7 +117,7 @@
 (defcustom tempo-interactive nil
   "*Prompt user for strings in templates.
 If this variable is non-nil, `tempo-insert' prompts the
-user for text to insert in the templates"
+user for text to insert in the templates."
   :type 'boolean
   :group 'tempo)
 
@@ -133,7 +133,7 @@
 
 (defcustom tempo-show-completion-buffer t
   "*If non-nil, show a buffer with possible completions, when only
-a partial completion can be found"
+a partial completion can be found."
   :type 'boolean
   :group 'tempo)
 
@@ -148,17 +148,17 @@
 (defvar tempo-insert-string-functions nil
   "List of functions to run when inserting a string.
 Each function is called with a single arg, STRING and should return
-another string. This could be used for making all strings upcase by
+another string.  This could be used for making all strings upcase by
 setting it to '(upcase), for example.")
 
 (defvar tempo-tags nil
-  "An association list with tags and corresponding templates")
+  "An association list with tags and corresponding templates.")
 
 (defvar tempo-local-tags '((tempo-tags . nil))
   "A list of locally installed tag completion lists.
 It is a association list where the car of every element is a symbol
-whose variable value is a template list. The cdr part, if non-nil, is a
-function or a regexp that defines the string to match. See the
+whose variable value is a template list.  The cdr part, if non-nil,
+is a function or a regexp that defines the string to match.  See the
 documentation for the function `tempo-complete-tag' for more info.
 
 `tempo-tags' is always in the last position in this list.")
@@ -175,8 +175,8 @@
 (defvar tempo-match-finder "\\b\\([[:word:]]+\\)\\="
   "The regexp or function used to find the string to match against tags.
 
-If `tempo-match-finder is a string, it should contain a regular
-expression with at least one \\( \\) pair. When searching for tags,
+If `tempo-match-finder' is a string, it should contain a regular
+expression with at least one \\( \\) pair.  When searching for tags,
 `tempo-complete-tag' calls `re-search-backward' with this string, and
 the string between the first \\( and \\) is used for matching against
 each string in the tag list. If one is found, the whole text between
@@ -229,51 +229,50 @@
 list of elements in the template, TAG is the tag used for completion,
 DOCUMENTATION is the documentation string for the insertion command
 created, and TAGLIST (a symbol) is the tag list that TAG (if provided)
-should be added to).  If TAGLIST is nil and TAG is non-nil, TAG is
-added to `tempo-tags'
+should be added to.  If TAGLIST is nil and TAG is non-nil, TAG is
+added to `tempo-tags'.
 
 The elements in ELEMENTS can be of several types:
 
- - A string. It is sent to the hooks in `tempo-insert-string-functions',
+ - A string: It is sent to the hooks in `tempo-insert-string-functions',
    and the result is inserted.
- - The symbol 'p. This position is saved in `tempo-marks'.
- - The symbol 'r. If `tempo-insert' is called with ON-REGION non-nil
-   the current region is placed here. Otherwise it works like 'p.
- - (p PROMPT <NAME> <NOINSERT>) If `tempo-interactive' is non-nil, the
+ - The symbol `p': This position is saved in `tempo-marks'.
+ - The symbol `r': If `tempo-insert' is called with ON-REGION non-nil
+   the current region is placed here.  Otherwise it works like `p'.
+ - (p PROMPT <NAME> <NOINSERT>): If `tempo-interactive' is non-nil, the
    user is prompted in the minibuffer with PROMPT for a string to be
-   inserted. If the optional parameter NAME is non-nil, the text is
-   saved for later insertion with the `s' tag. If there already is
+   inserted.  If the optional parameter NAME is non-nil, the text is
+   saved for later insertion with the `s' tag.  If there already is
    something saved under NAME that value is used instead and no
-   prompting is made. If NOINSERT is provided and non-nil, nothing is
-   inserted, but text is still saved when a NAME is provided. For
-   clarity, the symbol 'noinsert should be used as argument.
- - (P PROMPT <NAME> <NOINSERT>) Works just like the previous tag, but
-   forces tempo-interactive to be true.
- - (r PROMPT <NAME> <NOINSERT>) like the previous, but if
+   prompting is made.  If NOINSERT is provided and non-nil, nothing is
+   inserted, but text is still saved when a NAME is provided.  For
+   clarity, the symbol `noinsert' should be used as argument.
+ - (P PROMPT <NAME> <NOINSERT>): Works just like the previous tag, but
+   forces `tempo-interactive' to be true.
+ - (r PROMPT <NAME> <NOINSERT>): Like the previous tag, but if
    `tempo-interactive' is nil and `tempo-insert' is called with
-   ON-REGION non-nil, the current region is placed here. This usually
+   ON-REGION non-nil, the current region is placed here.  This usually
    happens when you call the template function with a prefix argument.
- - (s NAME) Inserts text previously read with the (p ..) construct.
-   Finds the insertion saved under NAME and inserts it. Acts like 'p
+ - (s NAME): Inserts text previously read with the (p ..) construct.
+   Finds the insertion saved under NAME and inserts it.  Acts like `p'
    if tempo-interactive is nil.
- - '& If there is only whitespace between the line start and point,
-   nothing happens. Otherwise a newline is inserted.
- - '% If there is only whitespace between point and end-of-line
-   nothing happens. Otherwise a newline is inserted.
- - 'n inserts a newline.
- - '> The line is indented using `indent-according-to-mode'. Note that
-   you often should place this item after the text you want on the
-   line.
- - 'r> Like r, but it also indents the region.
- - 'n> Inserts a newline and indents line.
- - 'o Like '% but leaves the point before the newline.
- - nil. It is ignored.
- - Anything else. It is evaluated and the result is treated as an
-   element to be inserted. One additional tag is useful for these
-   cases. If an expression returns a list '(l foo bar), the elements
-   after 'l will be inserted according to the usual rules. This makes
+ - `&': If there is only whitespace between the line start and point,
+   nothing happens.  Otherwise a newline is inserted.
+ - `%': If there is only whitespace between point and end of line,
+   nothing happens.  Otherwise a newline is inserted.
+ - `n': Inserts a newline.
+ - `>': The line is indented using `indent-according-to-mode'.  Note
+   that you often should place this item after the text you want on
+   the line.
+ - `r>': Like `r', but it also indents the region.
+ - `n>': Inserts a newline and indents line.
+ - `o': Like `%' but leaves the point before the newline.
+ - nil: It is ignored.
+ - Anything else: It is evaluated and the result is treated as an
+   element to be inserted.  One additional tag is useful for these
+   cases.  If an expression returns a list '(l foo bar), the elements
+   after `l' will be inserted according to the usual rules.  This makes
    it possible to return several elements from one expression."
-
   (let* ((template-name (intern (concat "tempo-template-"
 				       name)))
 	 (command-name template-name))
@@ -296,14 +295,14 @@
 (defun tempo-insert-template (template on-region)
   "Insert a template.
 TEMPLATE is the template to be inserted.  If ON-REGION is non-nil the
-`r' elements are replaced with the current region. In Transient Mark
+`r' elements are replaced with the current region.  In Transient Mark
 mode, ON-REGION is ignored and assumed true if the region is active."
   (unwind-protect
       (progn
 	(if (or (and (boundp 'transient-mark-mode) ; For Emacs
 		     transient-mark-mode
 		     mark-active)
-		(and (boundp 'zmacs-regions) ; For XEmacs
+		(if (featurep 'xemacs)
 		     zmacs-regions (mark)))
 	    (setq on-region t))
 	(and on-region
@@ -399,9 +398,9 @@
 ;;; tempo-insert-prompt
 
 (defun tempo-insert-prompt-compat (prompt)
-  "Compatibility hack for tempo-insert-prompt.
+  "Compatibility hack for `tempo-insert-prompt'.
 PROMPT can be either a prompt string, or a list of arguments to
-tempo-insert-prompt, or nil."
+`tempo-insert-prompt', or nil."
   (if (consp prompt)			; not nil either
       (apply 'tempo-insert-prompt prompt)
     (tempo-insert-prompt prompt)))
@@ -410,12 +409,12 @@
   "Prompt for a text string and insert it in the current buffer.
 If the variable `tempo-interactive' is non-nil the user is prompted
 for a string in the minibuffer, which is then inserted in the current
-buffer. If `tempo-interactive' is nil, the current point is placed on
+buffer.  If `tempo-interactive' is nil, the current point is placed on
 `tempo-mark'.
 
 PROMPT is the prompt string, SAVE-NAME is a name to save the inserted
-text under. If the optional argument NO-INSERT is non-nil, no text i
-inserted. This can be useful when there is a SAVE-NAME.
+text under.  If the optional argument NO-INSERT is non-nil, no text is
+inserted.  This can be useful when there is a SAVE-NAME.
 
 If there already is a value for SAVE-NAME, it is used and the user is
 never prompted."
@@ -448,8 +447,7 @@
 ;;; tempo-is-user-element
 
 (defun tempo-is-user-element (element)
-  "Tries all the user-defined element handlers in
-`tempo-user-elements'"
+  "Tries all the user-defined element handlers in `tempo-user-elements'."
   ;; Sigh... I need (some list)
   (catch 'found
     (mapcar (function (lambda (handler)
@@ -531,7 +529,7 @@
 ;;; tempo-insert-mark
 
 (defun tempo-insert-mark (mark)
-  "Insert a mark `tempo-marks' while keeping it sorted"
+  "Insert a mark `tempo-marks' while keeping it sorted."
   (cond ((null tempo-marks) (setq tempo-marks (list mark)))
 	((< mark (car tempo-marks)) (setq tempo-marks (cons mark tempo-marks)))
 	(t (let ((lp tempo-marks))
@@ -603,8 +601,8 @@
 
 COMPLETION-FUNCTION is an obsolete option for specifying an optional
 function or string that is used by `\\[tempo-complete-tag]' to find a
-string to match the tag against. It has the same definition as the
-variable `tempo-match-finder'. In this version, supplying a
+string to match the tag against.  It has the same definition as the
+variable `tempo-match-finder'.  In this version, supplying a
 COMPLETION-FUNCTION just sets `tempo-match-finder' locally."
   (let ((old (assq tag-list tempo-local-tags)))
     (if old
@@ -647,7 +645,7 @@
 
 (defun tempo-find-match-string (finder)
   "Find a string to be matched against a tag list.
-FINDER is a function or a string. Returns (STRING . POS), or nil
+FINDER is a function or a string.  Returns (STRING . POS), or nil
 if no reasonable string is found."
   (cond ((stringp finder)
 	 (let (successful)
@@ -671,7 +669,7 @@
 All the tags in the tag lists in `tempo-local-tags'
 \(this includes `tempo-tags') are searched for a match for the text
 before the point.  The way the string to match for is determined can
-be altered with the variable `tempo-match-finder'. If
+be altered with the variable `tempo-match-finder'.  If
 `tempo-match-finder' returns nil, then the results are the same as
 no match at all.