[mew-dist 18512] Re: 'Re:[count]' Subjectの設定について(質問)

NINOMIYA Hideyuki nin at example.com
2001年 8月 16日 (木) 06:28:13 JST


おはようございます	二宮@お四国%真夜中に目が覚めて寝れなくなっちゃった です

山本 和彦 様 は Thu, 16 Aug 2001 00:27:15 +0900 (JST) 頃に
    Subject: [mew-dist 18500] Re:[count] Subjectの設定について(質問)
    Message-Id: <20010816.002715.24461858.kazu at example.com>
        に於いて以下のようにおっしゃっていました。
※都合により手を加えさせていただく事が有ります。御了承下さいマセヽ...
かず> Re[X]: というのは、インターネットの慣習に従わないという意味で
かず> チャレンジングですが、まぁそういうメーラがあってもいいでしょう。
かず> 
かず> Mew で正式にサポートする気はありませんが、これを実装するために
かず> hook が必要なら定義します。

hook じゃ無いですが、こんなのでどうでしょう ?

Index: mew-summary.el
===================================================================
RCS file: /tmp/am/da/cvs/mew/mew-summary.el,v
retrieving revision 1.43
diff -u -c -F(def -r1.43 mew-summary.el
cvs server: conflicting specifications of output style
*** mew-summary.el	2001/08/14 08:38:57	1.43
--- mew-summary.el	2001/08/15 20:19:50
*************** (defun mew-summary-reply (&optional only
*** 1437,1443 ****
  	       (setq newsgroups nil))
  	   (setq subject (mew-header-get-value mew-subj:))
  	   (if subject
! 	       (setq subject (mew-subject-simplify (concat mew-reply-string subject))))
  	   (let ((old-message-id  (mew-header-get-value mew-message-id:))
  		 (old-in-reply-to (mew-header-get-value mew-in-reply-to:))
  		 (old-references  (mew-header-get-value mew-references:))
--- 1437,1448 ----
  	       (setq newsgroups nil))
  	   (setq subject (mew-header-get-value mew-subj:))
  	   (if subject
! 	       (setq subject (concat
! 			      (if (and mew-reply-string-func
! 				       (fboundp mew-reply-string-func))
! 				  (funcall mew-reply-string-func subject)
! 				mew-reply-string)
! 			      (mew-subject-simplify subject))))
  	   (let ((old-message-id  (mew-header-get-value mew-message-id:))
  		 (old-in-reply-to (mew-header-get-value mew-in-reply-to:))
  		 (old-references  (mew-header-get-value mew-references:))
Index: mew-vars2.el
===================================================================
RCS file: /tmp/am/da/cvs/mew/mew-vars2.el,v
retrieving revision 1.22
diff -u -c -F(def -r1.22 mew-vars2.el
cvs server: conflicting specifications of output style
*** mew-vars2.el	2001/07/12 22:18:57	1.22
--- mew-vars2.el	2001/08/15 20:19:50
*************** (defvar mew-summary-mark-undo-marks
*** 40,45 ****
--- 40,46 ----
  ;;; Field Magic
  ;;;
  
+ (defvar mew-reply-string-func nil)
  (defvar mew-reply-string "Re: ")
  (defvar mew-reply-regex
    "Re\\(\\|[*^]?[0-9]+\\|\\[[0-9]+\\]\\|([0-9]+)\\)[:>] *"
*************** (defvar mew-subject-simplify-replace-ali
*** 61,67 ****
  		 "\\|"
  		 mew-forward-regex
  		 "\\)*")
! 	 'mew-reply-string) ;; new text
     ;; replace multiple Fw: and Re: into single Fw:
     (cons (concat "^" ;; regexp
  		 mew-forward-regex
--- 62,68 ----
  		 "\\|"
  		 mew-forward-regex
  		 "\\)*")
! 	 nil) ;; delete
     ;; replace multiple Fw: and Re: into single Fw:
     (cons (concat "^" ;; regexp
  		 mew-forward-regex
===================================================================

使い方

(setq mew-reply-string-func 'my-reply-string)
(defun my-reply-string (subj)
    がんばる
    ret) ;; "Re:[x] " を返す

あっ、もう少しエレガントな方法思い付いた。。。

Index: mew-summary.el
===================================================================
RCS file: /tmp/am/da/cvs/mew/mew-summary.el,v
retrieving revision 1.43
diff -u -c -F(def -r1.43 mew-summary.el
cvs server: conflicting specifications of output style
*** mew-summary.el	2001/08/14 08:38:57	1.43
--- mew-summary.el	2001/08/15 21:04:33
*************** (defun mew-subject-simplify (str &option
*** 1345,1351 ****
  	    replace (if no-replace nil (cdr (car action-list)))
  	    action-list (cdr action-list))
        (if (string-match regexp str)
! 	  (setq str (replace-match (if replace (eval replace) "") nil t str))))
      str))
  
  (defun mew-summary-reply (&optional onlytofrom)
--- 1345,1355 ----
  	    replace (if no-replace nil (cdr (car action-list)))
  	    action-list (cdr action-list))
        (if (string-match regexp str)
! 	  (setq str (replace-match (if replace
! 				       (if (fboundp replace)
! 					   (funcall replace str)
! 					 (eval replace))
! 				     "") nil t str))))
      str))
  
  (defun mew-summary-reply (&optional onlytofrom)
===================================================================

(setq mew-subject-simplify-replace-alist
      ((...regexp...) . 'my-reply-string)
      ......)

みたいにするってのは ?
これだと Fw[x]: みたいなこともできる ....
--─
ICQ UIN:57442553                          二宮 秀幸@愛媛 鬼北 広見町
PGP-Fingerprint:  6C59 EC08 5B23 6490 44D0  7CD3 DA40 219F 7114 8553
PGP-Public-Key:    http://user.shikoku.ne.jp/~nin/pgp/public-key.txt
mailto:nin at example.com   http://user.shikoku.ne.jp/~nin/index.html
mailto:nin at example.com http://home.jp.freebsd.org/~nin/index.html



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