-;;; wl-template.el -- Draft template feature for Wanderlust.
+;;; wl-template.el --- Draft template feature for Wanderlust.
-;; Copyright 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
-;; Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
;; Author: Masahiro MURATA <muse@ba2.so-net.ne.jp>
;; Keywords: mail, net news
;;; Commentary:
;;; Code:
-;;
+;;
;; Variables
(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)
\\{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)
(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")
+ (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))
(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))
(setq wl-template (car (nth wl-template-cur-num wl-template-alist)))
mail-header-separator)
(wl-highlight-message (point-min) (point-max) t)
- (and wl-highlight-x-face-func
- (funcall
- wl-highlight-x-face-func
- (point-min) (re-search-forward mail-header-separator nil t)))
+ (when wl-highlight-x-face-function
+ (funcall wl-highlight-x-face-function
+ (point-min) (re-search-forward mail-header-separator nil t)))
(setq mode-line-process (concat ":" wl-template))
(set-buffer-modified-p nil))))
(defun wl-template-next ()
"Display next reference in other buffer."
(interactive)
- (if (eq wl-template-max-num
- (setq wl-template-cur-num (1+ wl-template-cur-num)))
+ (if (= wl-template-max-num
+ (setq wl-template-cur-num (1+ wl-template-cur-num)))
(setq wl-template-cur-num 0))
(wl-template-show))
(defun wl-template-prev ()
"Display previous reference in other buffer."
(interactive)
- (setq wl-template-cur-num (if (eq wl-template-cur-num 0)
+ (setq wl-template-cur-num (if (zerop wl-template-cur-num)
(1- wl-template-max-num)
(1- wl-template-cur-num)))
(wl-template-show))