;;; tempo.el --- Flexible template insertion
-;; Copyright (C) 1994, 1995, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: David K}gedal <davidk@lysator.liu.se>
;; Created: 16 Feb 1994
;; 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,
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.
(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)
(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)
"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)))
;;;
"Jump to the next mark in `tempo-forward-mark-list'."
(interactive)
(let ((next-mark (catch 'found
- (mapcar
+ (mapc
(function
(lambda (mark)
(if (< (point) mark)
(interactive)
(let ((prev-mark (catch 'found
(let (last)
- (mapcar
+ (mapc
(function
(lambda (mark)
(if (<= (point) mark)
(if tempo-leave-completion-buffer
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
- (all-completions string tag-list)))
+ (all-completions string tag-list)
+ string))
(save-window-excursion
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
- (all-completions string tag-list)))
+ (all-completions string tag-list)
+ string))
(sit-for 32767))))
;;;