[Mew-dist 03862] Re: Mew 1.93b6: mew-config breaks out mew-config-list setting ?

Makoto MATSUSHITA ( まつしたまこと ) matusita at example.com
1998年 2月 20日 (金) 13:35:55 JST


ksakai> 以下のパッチのようにしてはどうかと思うのですが、どうでしょうか?

個人的には,この patch で

・mew-draft-insert-config が返す値がかわってしまったこと (とはいえ,
  draft 生成時にうまく Config: をひっそりと入れる方法が別途かっこよく
  作れるのであれば,特にこれはなくても構わないはずなのですが)
・(先に投げた内容である) Config: の推論値を複数使えるようにするださい 
  code はやっぱり:-)消えてること(でも,そういう体になってしまったので
  戻りたくない:-)
・draft 生成時に自動挿入しようとする際に,いちいち mew-input-config を
  使って尋ねてくるようになったこと(なんとなく条件節を単純に書き間違え
  ているだけではないかという気がしていますが,どうでしょうか)

という点で,多分 mew-auto-ask 周りの話を除いて(つまり,多分酒井さんが
意図して変更されたであろう部分を除いて)極端に使いにくくなってしまった,
という気がしています.

断片的な patch であれこれ言ってばかりでは,話を追いかけるのも辛い気が
してきたので,これまでの酒井さんの patch 3 つに,私が先に(それなりにき
たない code ですが)作ったやつを,あらゆる merge してしまったやつ,とい
うのを作ってみました.

patch 自身は(ついさっき出た) Mew 1.93b17 からおこしてあります.ついで
に,mew-vars.el に変数へのコメントも適当に書いてみました.

これでとりあえず一件落着なのかな,と勝手に思ってるのですが‥‥これで,
いかがでしょうか _o_ > 特に酒井さん

-- -
Makoto `MAR' MATSUSHITA

*** mew-complete.el.dist	Sun Jan 25 21:05:01 1998
--- mew-complete.el	Fri Feb 20 13:19:09 1998
***************
*** 120,125 ****
--- 120,138 ----
        )
      ))
  
+ (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,166 ****
       )
      ))
  
! (defun mew-complete-circular (msg clist cname)
    (interactive)
!   (let ((str (mew-delete-value)))
      (if (null str)
  	(if (car clist)
  	    (insert (car clist))
--- 171,179 ----
       )
      ))
  
! (defun mew-complete-circular (msg clist cname &optional here)
    (interactive)
!   (let ((str (mew-delete-value here)))
      (if (null str)
  	(if (car clist)
  	    (insert (car clist))
***************
*** 176,184 ****
    (interactive)
    (mew-complete-circular "from" mew-from-list "mew-from-list"))
  
! (defun mew-complete-config ()
    (interactive)
!   (mew-complete-circular "config" mew-config-list "mew-config-list"))
  
  ;;
  ;; Hart function for completions
--- 189,197 ----
    (interactive)
    (mew-complete-circular "from" mew-from-list "mew-from-list"))
  
! (defun mew-complete-config-circular ()
    (interactive)
!   (mew-complete-circular "config" mew-config-list "mew-config-list" ","))
  
  ;;
  ;; Hart function for completions
***************
*** 276,282 ****
        )
      ))
  
! (defun mew-delete-value ()
    (beginning-of-line)
    (if (not (looking-at "[^:]+:"))
        ()
--- 289,295 ----
        )
      ))
  
! (defun mew-delete-value (&optional here)
    (beginning-of-line)
    (if (not (looking-at "[^:]+:"))
        ()
***************
*** 288,293 ****
--- 301,310 ----
  	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))))
*** mew-draft.el.dist	Wed Feb 18 10:27:37 1998
--- mew-draft.el	Fri Feb 20 13:19:09 1998
***************
*** 153,158 ****
--- 153,159 ----
    (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,480 ****
        (setq halist (cdr halist)))
      )
    (mew-header-insert-here "Mime-Version:" mew-mv:-num)
-   (insert mew-header-separator "\n")
    (if mew-config-auto-insert
!       (mew-draft-insert-config))
    (mew-draft-refresh)
    (if nl 
        (save-excursion
--- 473,481 ----
        (setq halist (cdr halist)))
      )
    (mew-header-insert-here "Mime-Version:" mew-mv:-num)
    (if mew-config-auto-insert
!       (if (mew-draft-insert-config) (insert "\n")))
!   (insert mew-header-separator "\n")
    (mew-draft-refresh)
    (if nl 
        (save-excursion
***************
*** 807,818 ****
      ))
  
  (defun mew-draft-make-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:"))))
      (message "Making a MIME letter ...")
      (mew-draft-make-mime)
      (message "Making a MIME letter ... done")
--- 808,818 ----
      ))
  
  (defun mew-draft-make-message ()
+   "Make MIME and insert config before sending message."
    (interactive)
    (save-excursion
!     (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,891 ****
        (message "Draft was not killed"))
      ))
  
  (defun mew-draft-insert-config ()
    (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))))
  
  (defun mew-draft-insert-signature ()
    (interactive)
--- 858,899 ----
        (message "Draft was not killed"))
      ))
  
+ (defun mew-draft-guess-config ()
+   (mew-refile-guess-by-alist1 mew-config-guess-alist))
+ 
  (defun mew-draft-insert-config ()
+   "Insert Config header."
    (interactive)
    (let ((config-cur (mew-header-get-value "Config:"))
! 	config-new)
!     (if (eq mew-config 'guess)
! 	(progn
! 	  (setq config-new (mew-draft-guess-config))
! 	  (if mew-config-ctrl-multi
! 	      (if config-new (setq config-new (mew-join "," config-new)))
! 	    (setq config-new (car config-new))))
!       (setq config-new mew-config))
!     (if (and (not (interactive-p)) (not mew-config-auto-insert))
! 	(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
! 		 (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)
! 	  config-new)
!       nil)))
  
  (defun mew-draft-insert-signature ()
    (interactive)
*** mew-encode.el.dist	Wed Feb 18 10:27:38 1998
--- mew-encode.el	Fri Feb 20 13:19:09 1998
***************
*** 39,47 ****
      )
    )
  
- (defun mew-config-guess-by-alist ()
-   (mew-refile-guess-by-alist1 mew-config-guess-alist))
- 
  ;;;
  ;;;
  ;;;
--- 39,44 ----
*** mew-minibuf.el.dist	Fri Feb 20 13:02:26 1998
--- mew-minibuf.el	Fri Feb 20 13:19:09 1998
***************
*** 193,199 ****
  		   mew-config-list)
  		  nil nil nil))
      (if (string= config "")
! 	default
        config)
      ))
  
--- 193,199 ----
  		   mew-config-list)
  		  nil nil nil))
      (if (string= config "")
! 	(or default "default")
        config)
      ))
  
*** mew-refile.el.dist	Fri Feb 20 13:02:27 1998
--- mew-refile.el	Fri Feb 20 13:19:09 1998
***************
*** 134,158 ****
    (mew-refile-guess-by-alist1 mew-refile-guess-alist))
  
  (defun mew-refile-guess-by-alist1 (alist)
!   (let (header sublist key val ret return)
      (while alist
!       (setq header  (mew-header-get-value (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))))
        (setq alist (cdr alist)))
      (mew-refile-list-uniq return)
      ))
--- 134,164 ----
    (mew-refile-guess-by-alist1 mew-refile-guess-alist))
  
  (defun mew-refile-guess-by-alist1 (alist)
!   (let (name header sublist key val ret return)
      (while alist
!       (setq name (car (car alist)))
        (setq sublist (cdr (car alist)))
!       (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)
      ))
*** mew-vars.el.dist	Fri Feb 20 13:02:30 1998
--- mew-vars.el	Fri Feb 20 13:29:38 1998
***************
*** 444,452 ****
  (defvar mew-config nil
    "*A value inserted into Config: field in Draft mode if non-nil.")
  
! (defvar mew-config-auto-insert nil)
  
! (defvar mew-config-guess-alist nil)
  
  (defvar mew-header-alist nil
    "*Alist of key and value pair for header field to be inserted on draft.
--- 444,461 ----
  (defvar mew-config nil
    "*A value inserted into Config: field in Draft mode if non-nil.")
  
! (defvar mew-config-auto-insert nil
!   "*If non nil, Mew inserts Config: automatically.")
  
! (defvar mew-config-insert-when-make-message nil
!   "*If non nil, Mew inserts Config: when Mew is making a message.")
! 
! (defvar mew-config-guess-alist nil
!   "*If non nil, mew guesses Config: value by using this hint.
! The format is the same of mew-refile-guess-alist.")
! 
! (defvar mew-config-ctrl-multi t
!   "*If non nil, guess functions guess multi folders.")
  
  (defvar mew-header-alist nil
    "*Alist of key and value pair for header field to be inserted on draft.
***************
*** 664,672 ****
  
  (defvar mew-ask-newsgroups nil
    "*If non-nil, prompt user if he/she want to include Newsgroups: field")
- 
- (defvar mew-ask-config nil
-   "*If non-nil, prompt user if he/she want to include/change Config: field")
  
  (defvar mew-ask-cite-prefix nil
    "*If non-nil, ask citation prefix when cite a message")
--- 673,678 ----



Mew-dist メーリングリストの案内