]> code.delx.au - gnu-emacs/blobdiff - lisp/tempo.el
(hexl-mode): Stash `eldoc-documentation-function' in
[gnu-emacs] / lisp / tempo.el
index 62ba3c9acae7145ca9e74631046b7b253979e025..75751367683d5d7473875d8eea847625662f8595 100644 (file)
@@ -1,7 +1,7 @@
 ;;; tempo.el --- Flexible template insertion
 
-;; Copyright (C) 1994, 1995, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: David K}gedal <davidk@lysator.liu.se>
 ;; Created: 16 Feb 1994
@@ -12,7 +12,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,
@@ -266,6 +266,8 @@ The elements in ELEMENTS can be of several types:
    that you often should place this item after the text you want on
    the line.
  - `r>': Like `r', but it also indents the region.
+ - (r> PROMPT <NAME> <NOINSERT>): Like (r ...), but is also indents
+   the region.
  - `n>': Inserts a newline and indents line.
  - `o': Like `%' but leaves the point before the newline.
  - nil: It is ignored.
@@ -313,9 +315,9 @@ mode, ON-REGION is ignored and assumed true if the region is active."
            (goto-char tempo-region-start))
        (save-excursion
          (tempo-insert-mark (point-marker))
-         (mapcar (function (lambda (elt)
-                             (tempo-insert elt on-region)))
-                 (symbol-value template))
+         (mapc (function (lambda (elt)
+                           (tempo-insert elt on-region)))
+               (symbol-value template))
          (tempo-insert-mark (point-marker)))
        (tempo-forward-mark))
     (tempo-forget-insertions)
@@ -352,6 +354,13 @@ possible."
                                         (goto-char tempo-region-stop)
                                       (tempo-insert-prompt-compat
                                        (cdr element))))
+        ((and (consp element)
+              (eq (car element) 'r>)) (if on-region
+                                          (progn
+                                            (goto-char tempo-region-stop)
+                                            (indent-region (mark) (point) nil))
+                                        (tempo-insert-prompt-compat
+                                         (cdr element))))
        ((and (consp element)
              (eq (car element) 's)) (tempo-insert-named (car (cdr element))))
        ((and (consp element)
@@ -451,10 +460,10 @@ never prompted."
   "Tries all the user-defined element handlers in `tempo-user-elements'."
   ;; Sigh... I need (some list)
   (catch 'found
-    (mapcar (function (lambda (handler)
-                       (let ((result (funcall handler element)))
-                         (if result (throw 'found result)))))
-           tempo-user-elements)
+    (mapc (function (lambda (handler)
+                     (let ((result (funcall handler element)))
+                       (if result (throw 'found result)))))
+         tempo-user-elements)
     (throw 'found nil)))
 
 ;;;
@@ -547,7 +556,7 @@ and insert the results."
   "Jump to the next mark in `tempo-forward-mark-list'."
   (interactive)
   (let ((next-mark (catch 'found
-                    (mapcar
+                    (mapc
                      (function
                       (lambda (mark)
                         (if (< (point) mark)
@@ -566,7 +575,7 @@ and insert the results."
   (interactive)
   (let ((prev-mark (catch 'found
                     (let (last)
-                      (mapcar
+                      (mapc
                        (function
                         (lambda (mark)
                           (if (<= (point) mark)
@@ -756,5 +765,5 @@ space bar, and looks something like this:
 
 (provide 'tempo)
 
-;;; arch-tag: b3c0ee36-db3b-47bc-875f-091b4e27a063
+;; arch-tag: b3c0ee36-db3b-47bc-875f-091b4e27a063
 ;;; tempo.el ends here