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

Maybe TABOO y-koga at example.com
1998年 1月 28日 (水) 14:48:36 JST


こが:
> こんな感じでどうでしょう。

forward 時に Config: 行の後に空行が入ってしまうのを修正しました。

これを使って Config: を自動挿入するようにすると、Config: 行末にカーソ
ルが行くようになるのですが (合意の仕様)、ここですぐに C-cC-y して悲し
い思いをすることが多くなってしまいます (もちろん summary のところで A 
を使えばいいんですけどね)。そもそも mew-draft-cite はヘッダ部では使う
必要ないと思うので、ヘッダ部で呼び出した場合はメッセージを表示して終了
するようにしてみました。どうでしょう?

BEGIN------------------- ここから ------------------------
diff -urN ../orig/mew-draft.el ./mew-draft.el
--- ../orig/mew-draft.el	Sun Jan 25 21:05:05 1998
+++ ./mew-draft.el	Wed Jan 28 14:40:38 1998
@@ -446,7 +446,6 @@
   (and mew-cc   (mew-header-insert-here "Cc:" mew-cc))
   (mew-header-insert-here "Subject:" (if subject subject "")) ;; tricky
   (and mew-from (mew-header-insert-here "From:" mew-from))
-  (and mew-config (mew-header-insert-here "Config:" mew-config))
   (and mew-fcc  (mew-header-insert-here "Fcc:" mew-fcc))
   (and mew-dcc  (mew-header-insert-here "Dcc:" mew-dcc))
   (and mew-reply-to (mew-header-insert-here "Reply-To:" mew-reply-to))
@@ -476,8 +475,12 @@
     )
   (mew-header-insert-here "Mime-Version:" mew-mv:-num)
   (insert mew-header-separator "\n")
+  (mew-draft-insert-config)
   (mew-draft-refresh)
-  (if nl (insert "\n"))
+  (save-excursion
+    (re-search-forward mew-eoh2)
+    (if nl (insert "\n"))
+    )
   (if to ;; there is no To:
       ()
     (goto-char (point-min))
@@ -524,7 +527,7 @@
 		(setq existp t))
 	    ))
 	(if (and existp 
-		 (not (y-or-n-p "Do you want to post to NetNews ?")))
+		 (not (y-or-n-p "Do you want to post to NetNews?")))
 	    (mew-header-delete-lines '("Newsgroups:")))
 	))
   (run-hooks 'mew-send-hook)
@@ -690,62 +693,64 @@
 ;; MUST take care of C-x C-x
 ;; MUST be able to cancel by C-x u
   (interactive "P")
-  (let ((nonmewbuf mew-message-citation-buffer) ;; buffer local, so copy here
-	cite beg end)
-    (save-excursion
-      ;;
-      ;; extract the body without header
-      ;;
-      (set-buffer (or nonmewbuf (mew-buffer-message)))
-      (save-restriction
-        ;; first prepare "cite"
-        (widen)
-	(cond
-	 ;; arg will be effect in mew-cite-original
-	 ((mew-mark) 
-	  (setq beg (region-beginning) end (region-end)))
-	 ((equal mew-message-citation 'header)
-	  ;; header exists in Message mode. Skip the header
-	  ;; because we will concatenate it to cite later.
+  (if (mew-draft-in-header-p)
+      (message "You cannot cite a message here.")
+    (let ((nonmewbuf mew-message-citation-buffer) ;; buffer local, so copy here
+	  cite beg end)
+      (save-excursion
+	;;
+	;; extract the body without header
+	;;
+	(set-buffer (or nonmewbuf (mew-buffer-message)))
+	(save-restriction
+	  ;; first prepare "cite"
+	  (widen)
+	  (cond
+	   ;; arg will be effect in mew-cite-original
+	   ((mew-mark) 
+	    (setq beg (region-beginning) end (region-end)))
+	   ((equal mew-message-citation 'header)
+	    ;; header exists in Message mode. Skip the header
+	    ;; because we will concatenate it to cite later.
+	    (goto-char (point-min))
+	    (re-search-forward mew-eoh2 nil t)
+	    (forward-line)
+	    (setq beg (point) end (point-max)))
+	   (t
+	    (setq beg (point-min) end (point-max)))
+	   )
+	  (setq cite (mew-buffer-substring beg end))
+	  )
+	;;
+	;; concat the header
+	;;
+	(set-buffer (or nonmewbuf
+			;; header exists only in cache if multipart
+			(mew-cache-hit (mew-current-get 'message))
+			(mew-buffer-message)))
+	(save-restriction
+	  (widen)
 	  (goto-char (point-min))
 	  (re-search-forward mew-eoh2 nil t)
-	  (forward-line)
-	  (setq beg (point) end (point-max)))
-	 (t
-	  (setq beg (point-min) end (point-max)))
-	 )
-	(setq cite (mew-buffer-substring beg end))
-	)
+	  (setq cite (concat (mew-buffer-substring (point-min) (point)) 
+			     "\n" cite))
+	  ))
+      ;; 
+      ;; Draft mode, insert the header and the body.
       ;;
-      ;; concat the header
-      ;;
-      (set-buffer (or nonmewbuf
-		      ;; header exists only in cache if multipart
-		      (mew-cache-hit (mew-current-get 'message))
-		      (mew-buffer-message)))
       (save-restriction
-	(widen)
-	(goto-char (point-min))
-	(re-search-forward mew-eoh2 nil t)
-	(setq cite (concat (mew-buffer-substring (point-min) (point)) 
-			   "\n" cite))
-	))
-    ;; 
-    ;; Draft mode, insert the header and the body.
-    ;;
-    (save-restriction
-      ;; this gets complicated due to supercite, please don't care
-      (narrow-to-region (point)(point)) ;; for (goto-char (point-min))
-      (insert cite)
-      (push-mark (point) t t)
-      (goto-char (point-min)))
-    (cond
-     (mew-cite-hook
-      (run-hooks 'mew-cite-hook))
-     (t (mew-cite-original arg))
-     )
-    (mew-highlight-body)
-    ))
+	;; this gets complicated due to supercite, please don't care
+	(narrow-to-region (point)(point)) ;; for (goto-char (point-min))
+	(insert cite)
+	(push-mark (point) t t)
+	(goto-char (point-min)))
+      (cond
+       (mew-cite-hook
+	(run-hooks 'mew-cite-hook))
+       (t (mew-cite-original arg))
+       )
+      (mew-highlight-body)
+      )))
 
 (defun mew-cite-original (&optional arg)
   (if (< (marker-position (mark-marker)) (point))
@@ -839,6 +844,36 @@
 		(format "Folder %s remains" mimefolder)
 	      (mew-delete-directory-recursively mimedir))))
       (message "Draft was not killed"))
+    ))
+
+(defun mew-draft-insert-config ()
+  (interactive)
+  (let ((config-new nil)
+	(config-cur (mew-header-get-value "Config:"))
+	(config-guess (mew-config-guess-by-alist)))
+    (cond
+     (mew-auto-insert-config
+      (cond
+       ((equal mew-config 'guess)
+	(if config-guess (setq config-new (car config-guess))
+	  (and mew-config-list (setq config-new (car mew-config-list)))))
+       (mew-config (setq config-new mew-config)))
+      (if (and mew-config
+	       (or (not config-cur)
+		   (and (not (equal config-new config-cur))
+			(y-or-n-p
+			 (format "Do you want to change Config: value to %s?" 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)
+	    (forward-line -1)
+	    (end-of-line)))
+      ))
     ))
 
 (defun mew-draft-insert-signature ()
diff -urN ../orig/mew-encode.el ./mew-encode.el
--- ../orig/mew-encode.el	Sun Jan 25 21:05:07 1998
+++ ./mew-encode.el	Mon Jan 26 19:35:51 1998
@@ -50,6 +50,7 @@
   "Make a MIME message. Charset guess, mapping directory structure 
 to multipart, and so on."
   (interactive)
+  (mew-draft-insert-config)
   (if (mew-header-get-value mew-ct:)
       (progn
 	(ding)
@@ -87,11 +88,6 @@
   (re-search-forward mew-eoh2)
   (beginning-of-line)
   (setq mew-draft-buffer-header (point-marker)) ;; just in case
-  ;; Insert Config: if necessary.
-  (let ((config (mew-config-guess-by-alist)))
-    (if (and config (not (mew-header-get-value "Config:")))
-	(mew-header-insert-here "Config:" (car config))
-      ))
   (mew-highlight-header-region
    (point-min) (marker-position mew-draft-buffer-header))
   )
diff -urN ../orig/mew-summary.el ./mew-summary.el
--- ../orig/mew-summary.el	Sun Jan 25 21:05:35 1998
+++ ./mew-summary.el	Mon Jan 26 18:23:54 1998
@@ -1480,8 +1480,6 @@
 		(mew-header-insert-here "Dcc:" mew-dcc))
  	    (if (and mew-from (not (mew-header-get-value "From:")))
  		(mew-header-insert-here "From:" mew-from))
- 	    (if (and mew-config (not (mew-header-get-value "Config:")))
- 		(mew-header-insert-here "Config:" mew-config))
  	    (if (and mew-reply-to (not (mew-header-get-value "Reply-To:")))
  		(mew-header-insert-here "Reply-To:" mew-reply-to))
 	    (if (and mew-x-mailer (not (mew-header-get-value "X-Mailer:")))
diff -urN ../orig/mew-vars.el ./mew-vars.el
--- ../orig/mew-vars.el	Sun Jan 25 21:05:40 1998
+++ ./mew-vars.el	Mon Jan 26 19:04:21 1998
@@ -412,6 +412,8 @@
 (defvar mew-config (car mew-config-list)
   "*A value inserted into Config: field in Draft mode if non-nil.")
 
+(defvar mew-auto-insert-config nil)
+
 (defvar mew-config-guess-alist nil)
 
 (defvar mew-header-alist nil

END--------------------- ここまで ------------------------
----
NEC ネットワーキング技術研究所 & 慶應義塾SFC研究所
こがよういちろう <y-koga at example.com> 他



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