[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mhc:01886] Re: 英文日付の取り込み



森下です。

From: Mimpei MORISHITA <mimpei@xxxxxxxxx>
Subject: 英文日付の取り込み
Date: Thu, 19 Feb 2004 19:11:29 -0800 (PDT)
Message-ID: <20040219.191129.91276483.mimpei@xxxxxxxxxxxx>

> しばらく前から、MHC を便利に使わせていただいております。
> 最近英文でスケジュールの案内を受け取る機会が増えたため、Feb 20, 2004
> といった形式の日付も MHC で取り込めればと思い、以下のようなパッチを作
> 成しました。

すみません、August を Augst と typo していましたので出し直します。

Index: mhc-guess.el
===================================================================
RCS file: /cvsroot/mhc/emacs/mhc-guess.el,v
retrieving revision 1.17
diff -c -r1.17 mhc-guess.el
*** mhc-guess.el	2003/11/05 01:12:43	1.17
--- mhc-guess.el	2004/02/20 02:35:52
***************
*** 88,93 ****
--- 88,102 ----
  	      "\\)?")
       mhc-guess/make-date-from-mmdd 2 3 8 9 10)
      
+     (,(concat "\\(Jan\\(uary\\)?\\|Feb\\(ruary\\)?\\|Mar\\(ch\\)?\\|"
+ 	      "Apr\\(il\\)?\\|May\\|Jun\\|July?\\|Aug\\(ust\\)?\\|"
+ 	      "Sep\\(tember\\)?\\|Oct\\(ober\\)\\|"
+ 	      "Nov\\(ember\\)?\\|Dec\\(ember\\)?\\)"
+ 	      "\.?,? +"
+ 	      "\\([0-9][0-9]?\\)\\(st\\|nd\\rd\\|th\\)?,? *" ;; day
+ 	      "\\(\\('\\|[1-9][0-9]\\)?[0-9][0-9]\\)?") ;; year
+      mhc-guess/make-date-from-monthdd 1 11 13)
+     
      throw
  
    (,(concat "\\(今度\\|[今来次]週\\|再来週\\)[\n  ]*の?[\n  ]*"
***************
*** 332,337 ****
--- 341,364 ----
        (setq date (mhc-date-yy+ date year-offset)))
      (store-match-data data)
      date))
+ 
+ (defun mhc-guess/make-date-from-monthdd (now month-str dd-str yy-str)
+   (let* ((month-alist
+ 	  '(("Jan" . "1") ("Feb" . "2") ("Mar" . "3") ("Apr" . "4")
+ 	    ("May" . "5") ("Jun" . "6") ("Jul" . "7") ("Aug" . "8")
+ 	    ("Sep" . "9") ("Oct" . "10") ("Nov" . "11") ("Dec" . "12")))
+ 	 (mm-str (cdr (assoc (substring month-str 0 3) month-alist)))
+ 	 (yy-length (length yy-str)))
+     (cond ((= yy-length 4)		; "yyyy"
+ 	   (mhc-guess/make-date-from-yyyymmdd now yy-str mm-str dd-str))
+ 	  ((= yy-length 3)		; "'yy"
+ 	   (mhc-guess/make-date-from-yyyymmdd
+ 	    now
+ 	    (concat (substring (format-time-string "%Y") 0 2)
+ 		    (substring yy-str 1 3))
+ 	    mm-str dd-str))
+ 	  (t
+ 	   (mhc-guess/make-date-from-mmdd now mm-str dd-str)))))
  
  (defun mhc-guess/make-date-from-relative-day (now rel-word)
    (cond 

--
もりした みんぺい