[Mew-dist 03966] Re: Config:
SAKAI Kiyotaka
ksakai at example.com
1998年 2月 25日 (水) 12:11:34 JST
>> In article <19980224203816S.kazu at example.com>, Kazu Yamamoto (山本和彦) <Kazu at example.com> writes:
> 結局 Config: の合意は取れたのでしょうか?
議論半ばというところです。
> とりあえず、現時点で酒井さんが気に入っている実装のパッチを b19 に対
> して作ってもらえませんか?
それでは送ります。
patch1 は Config: ヘッダでの complete 機能を拡張するためのもので、TAB
で補完、C-c TAB で rotate するようになります。
patch2 は guess-alist の仕様を拡張するためのもので、t, nil をというシ
ンボルを使えるようになります。ただ、refile の方 alias も同時に変更する
ことになるため、別途、議論が必要かもしれません。
patch3 が config に関する本体のパッチです。
patch1, patch2, patch3 は独立に当てられるようになっているはずです。
--
酒井 清隆 (E-mail: ksakai at example.com)
-------------- next part --------------
Index: mew-complete.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-complete.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-complete.el
--- mew-complete.el 1998/02/25 02:05:11 1.1.1.1
+++ mew-complete.el 1998/02/25 02:19:32
@@ -120,6 +120,19 @@
)
))
+(defun mew-complete-config ()
+ (interactive)
+ (let ((word (mew-delete-value ",")))
+ (if (null word)
+ (tab-to-tab-stop)
+ (mew-complete
+ word
+ (mew-slide-pair mew-config-list)
+ "mew-config-list"
+ nil) ;; use car
+ )
+ ))
+
;;
;; Circular completion: C-cC-t
;;
@@ -158,9 +171,9 @@
)
))
-(defun mew-complete-circular (msg clist cname)
+(defun mew-complete-circular (msg clist cname &optional here)
(interactive)
- (let ((str (mew-delete-value)))
+ (let ((str (mew-delete-value here)))
(if (null str)
(if (car clist)
(insert (car clist))
@@ -176,9 +189,9 @@
(interactive)
(mew-complete-circular "from" mew-from-list "mew-from-list"))
-(defun mew-complete-config ()
+(defun mew-complete-config-circular ()
(interactive)
- (mew-complete-circular "config" mew-config-list "mew-config-list"))
+ (mew-complete-circular "config" mew-config-list "mew-config-list" ","))
;;
;; Hart function for completions
@@ -276,7 +289,7 @@
)
))
-(defun mew-delete-value ()
+(defun mew-delete-value (&optional here)
(beginning-of-line)
(if (not (looking-at "[^:]+:"))
()
@@ -288,6 +301,10 @@
nil
(let ((start (point)) ret)
(end-of-line)
+ (if (and here (re-search-backward (regexp-quote here) start t))
+ (progn
+ (setq start (1+ (point)))
+ (end-of-line)))
(setq ret (buffer-substring start (point)))
(delete-region start (point))
ret))))
Index: mew-vars.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-vars.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-vars.el
--- mew-vars.el 1998/02/25 02:05:13 1.1.1.1
+++ mew-vars.el 1998/02/25 02:19:32
@@ -473,7 +473,8 @@
("Dcc:" . mew-complete-address)
("Bcc:" . mew-complete-address)
("Reply-To:" . mew-complete-address)
- ("Fcc:" . mew-complete-folder))
+ ("Fcc:" . mew-complete-folder)
+ ("Config:" . mew-complete-config))
"*Completion function alist concerned with the key."
)
@@ -484,7 +485,7 @@
("Bcc:" . mew-complete-domain)
("Reply-To:" . mew-complete-domain)
("From:" . mew-complete-from)
- ("Config:" . mew-complete-config))
+ ("Config:" . mew-complete-config-circular))
"*Circular completion function alist concerned with the key."
)
-------------- next part --------------
Index: mew-refile.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-refile.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-refile.el
--- mew-refile.el 1998/02/25 02:05:12 1.1.1.1
+++ mew-refile.el 1998/02/25 02:27:49
@@ -134,25 +134,31 @@
(mew-refile-guess-by-alist1 mew-refile-guess-alist))
(defun mew-refile-guess-by-alist1 (alist)
- (let (header sublist key val ret return)
+ (let (name header sublist key val ret return)
(while alist
- (setq header (mew-header-get-value (car (car alist))))
+ (setq name (car (car alist)))
(setq sublist (cdr (car alist)))
- (if header
- (while sublist
- (setq ret nil)
- (setq key (car (car sublist)))
- (setq val (cdr (car sublist)))
- (if (and (stringp key) (string-match key header))
- (cond
- ((stringp val)
- (setq ret (mew-refile-guess-by-alist2 key header val)))
- ((listp val)
- (setq ret (mew-refile-guess-by-alist1 val)))))
- (setq return (append return
- (or (and (listp ret) ret)
- (and ret (list ret)))))
- (setq sublist (cdr sublist))))
+ (cond ((eq name t)
+ (setq return (append return (list sublist))))
+ ((eq name nil)
+ (or return (setq return (list sublist))))
+ (t
+ (setq header (mew-header-get-value name))
+ (if header
+ (while sublist
+ (setq ret nil)
+ (setq key (car (car sublist)))
+ (setq val (cdr (car sublist)))
+ (if (and (stringp key) (string-match key header))
+ (cond
+ ((stringp val)
+ (setq ret (mew-refile-guess-by-alist2 key header val)))
+ ((listp val)
+ (setq ret (mew-refile-guess-by-alist1 val)))))
+ (setq return (append return
+ (or (and (listp ret) ret)
+ (and ret (list ret)))))
+ (setq sublist (cdr sublist))))))
(setq alist (cdr alist)))
(mew-refile-list-uniq return)
))
-------------- next part --------------
Index: mew-draft.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-draft.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-draft.el
--- mew-draft.el 1998/02/25 02:05:11 1.1.1.1
+++ mew-draft.el 1998/02/25 02:58:50
@@ -153,6 +153,7 @@
(define-key mew-draft-mode-map "\C-c\C-l" 'mew-fib-flush-input)
(define-key mew-draft-mode-map "\C-c\C-f" 'mew-fib-fill-default)
(define-key mew-draft-mode-map "\C-c\C-k" 'mew-fib-delete-frame)
+ (define-key mew-draft-mode-map "\C-c\C-o" 'mew-draft-insert-config)
(define-key mew-draft-mode-map "\C-x\C-s" 'mew-save-buffer)
(if mew-temacs-p
(easy-menu-define
@@ -472,9 +473,9 @@
(setq halist (cdr halist)))
)
(mew-header-insert-here "Mime-Version:" mew-mv:-num)
+ (if (and mew-config-auto-insert (mew-draft-guess-config))
+ (mew-header-insert-here "Config:" (mew-draft-guess-config)))
(insert mew-header-separator "\n")
- (if mew-config-auto-insert
- (mew-draft-insert-config))
(mew-draft-refresh)
(if nl
(save-excursion
@@ -807,12 +808,11 @@
))
(defun mew-draft-make-message ()
+ "Make MIME and insert config before sending message."
(interactive)
(save-excursion
- (if mew-ask-config
- (if (y-or-n-p "Do you want to use Config:?")
- (mew-draft-insert-config)
- (mew-header-delete-lines '("Config:"))))
+ (if mew-config-insert-when-make-message
+ (mew-draft-insert-config))
(message "Making a MIME letter ...")
(mew-draft-make-mime)
(message "Making a MIME letter ... done")
@@ -858,34 +858,38 @@
(message "Draft was not killed"))
))
+(defun mew-draft-guess-config ()
+ (if (eq mew-config 'guess)
+ (let ((config (mew-refile-guess-by-alist1 mew-config-guess-alist)))
+ (if config (mew-join "," config)))
+ mew-config))
+
(defun mew-draft-insert-config ()
+ "Insert Config header."
(interactive)
(let ((config-cur (mew-header-get-value "Config:"))
- (config-new))
- (if (and config-cur
- (y-or-n-p "Do you want to use current Config:?")) ()
- (cond
- ((equal mew-config 'guess)
- (setq config-new (car (mew-config-guess-by-alist)))
- (or config-new (setq config-new (car mew-config-list))))
- (t
- (setq config-new mew-config))
- )
- (if (not mew-config-auto-insert)
- (setq config-new (mew-input-config config-new)))
- (if config-new
- (progn
- (widen)
- (mew-header-delete-lines '("Config:"))
- (goto-char (point-min))
- (re-search-forward mew-eoh2)
- (beginning-of-line)
- (mew-header-insert-here "Config:" config-new)
- (mew-draft-refresh)
- (forward-line -1)
- (end-of-line)
- config-new)
- nil))))
+ (config-new (mew-draft-guess-config)))
+ (if (and mew-ask-config (not (interactive-p)))
+ (setq config-new (mew-input-config config-new)))
+ (if (and (interactive-p) (not config-new))
+ (setq config-new ""))
+ (if config-new
+ (if (and config-cur
+ (or (string= config-cur config-new)
+ (not
+ (y-or-n-p
+ (format "Do you want to replace Config value with %s? "
+ config-new)))))
+ nil
+ (widen)
+ (mew-header-delete-lines '("Config:"))
+ (goto-char (point-min))
+ (re-search-forward mew-eoh2)
+ (beginning-of-line)
+ (mew-header-insert-here "Config:" config-new)
+ (mew-draft-refresh)
+ (forward-line -1)
+ (end-of-line)))))
(defun mew-draft-insert-signature ()
(interactive)
Index: mew-encode.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-encode.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-encode.el
--- mew-encode.el 1998/02/25 02:05:11 1.1.1.1
+++ mew-encode.el 1998/02/25 02:28:51
@@ -39,9 +39,6 @@
)
)
-(defun mew-config-guess-by-alist ()
- (mew-refile-guess-by-alist1 mew-config-guess-alist))
-
;;;
;;;
;;;
Index: mew-minibuf.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-minibuf.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-minibuf.el
--- mew-minibuf.el 1998/02/25 02:05:12 1.1.1.1
+++ mew-minibuf.el 1998/02/25 02:28:51
@@ -193,7 +193,7 @@
mew-config-list)
nil nil nil))
(if (string= config "")
- default
+ (or default "default")
config)
))
Index: mew-vars.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b19/mew-vars.el,v
retrieving revision 1.2
diff -u -r1.2 mew-vars.el
--- mew-vars.el 1998/02/25 02:27:26 1.2
+++ mew-vars.el 1998/02/25 02:59:24
@@ -444,6 +444,8 @@
(defvar mew-config-auto-insert nil)
+(defvar mew-config-insert-when-make-message nil)
+
(defvar mew-config-guess-alist nil)
(defvar mew-header-alist nil
Mew-dist メーリングリストの案内