Fixed.
[elisp/wanderlust.git] / wl / wl-template.el
index 0129e5a..b1f9230 100644 (file)
@@ -1,4 +1,4 @@
-;;; wl-template.el -- Draft template feature for Wanderlust.
+;;; wl-template.el --- Draft template feature for Wanderlust.
 
 ;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
@@ -27,7 +27,7 @@
 ;;; Commentary:
 
 ;;; Code:
-;; 
+;;
 
 ;; Variables
 
@@ -39,6 +39,7 @@
 (defvar wl-template-cur-num 0)
 (defvar wl-template-max-num 0)
 (defvar wl-template-draft-buffer nil)
+(defvar wl-template-preview nil)
 
 ;;; Code
 
   (define-key wl-template-mode-map "\r"    'wl-template-set)
   (define-key wl-template-mode-map "\n"    'wl-template-set))
 
+(defun wl-template-preview-p ()
+  "Return non-nil when preview template."
+  wl-template-preview)
+
 (defun wl-template-apply (name)
   "Apply NAME template to draft."
   (let (template)
@@ -77,7 +82,7 @@ See info under Wanderlust for full documentation.
 
 \\{wl-template-mode}
 
-Enterring WL-Template mode calls the value of `wl-template-mode-hook'."
+Entering WL-Template mode calls the value of `wl-template-mode-hook'."
   (kill-all-local-variables)
   (setq mode-name "Wl-Template"
        major-mode 'wl-template-mode)
@@ -85,10 +90,14 @@ Enterring WL-Template mode calls the value of `wl-template-mode-hook'."
   (setq buffer-read-only t)
   (run-hooks 'wl-template-mode-hook))
 
-(defun wl-template-select ()
+(defun wl-template-select (&optional arg)
   "Select template from `wl-template-alist'."
-  (interactive)
-  (if (not wl-template-visible-select)
+  (interactive "P")
+  (unless wl-template-alist
+    (error "Please set `wl-template-alist'"))
+  (if (not (if arg
+              (not wl-template-visible-select)
+            wl-template-visible-select))
       (wl-template-apply
        (completing-read (format "Template (%s): " wl-template-default-name)
                        wl-template-alist))
@@ -127,6 +136,7 @@ ARG is ignored."                    ; ARG ignored this version (?)
   (save-excursion
     (set-buffer wl-template-buffer-name)
     (let ((buffer-read-only nil)
+         (wl-template-preview t)
          (mail-header-separator  "--header separater--"))
       (erase-buffer)
       (goto-char (point-min))