From: kobayasi@elecom.mie-u.ac.jp (Kobayasi Tadasi(Nasu lab))
Newsgroups: fj.editor.emacs
Subject: Re: [Thanks] How to change Date field, GMT to JST.
Date: 13 Oct 92 05:37:31 GMT
	<S91M801.92Oct1135753@ipckus.kansai-u.ac.jp>
Distribution: fj
Organization: Faculty of Eng., Mie Univ., Tsu, Japan.
In-reply-to: s91m801@kansai-u.ac.jp's message of 1 Oct 92 13:57:53 JST

$@>.NS!w;0=EBg(J $@$G$9!#(J

In article <S91M801.92Oct1135753@ipckus.kansai-u.ac.jp> s91m801@kansai-u.ac.jp (Marone / Takashi Murase) writes:

   >$@#M#a#r#o#n#e!w4XBg$G$9!#(J

   >GNUS $@$N(J article $@%P%C%U%!$G(J Date: $@%U%#!<%k%I$N(J GMT $@I=<($r(J
   >JST $@I=<($KJQ99$9$kJ}K!$r<ALd$7$?$N$G$9$,!"(J
   >$@K\Ev(J$@$K#F#A#Q$@$C$?$h$&$G(J...

   >$@$$$/$D$+J}K!$O$"$k$_$?$$$G$9$,!"4JC1$K$^$H$a$^$9$H(J
   >(1)GNUS 3.14.1 $@$N(J gnus-gmt-to-local $@$r;H$C$F!"(J
   >   gnus-Article-prepare-hook $@$K0z$C3]$1$k!#(J
   >(2)$@8ENS(J $@5*:H$5$s:n$N(J gnus-gmt-to-local.el $@$r;H$&!#(J
   >   $@!J(Jtimezone.el $@$,I,MW!K(J
   >(3)$@5FCO(J $@=S>4!wElKLEENO$5$s:n$N(J gmt-to-jst.el $@$r;H$&!#(J
   >$@$G!"EvJ}$G$O(J GNUS 3.13 $@$r;HMQ$7$F$*$j!"(Jtimezone.el $@$b<j85$K(J
   >$@$"$j$^$;$s$G$7$?(J$@$N$G!"(J(3)$@$NJ}K!$r<h$i$;$F$$$?$@$-$^$7$?!#(J

$@!VEv%5%$%H$G$b(J (3)$@$N(Jgmt-to-jst.el $@$r;H$*$&$H$7$?$N$G$9$,!"(JCnews $@$N%5!<%P!<$K(J
$@%]%9%H$7$?%K%e!<%9$r$=$N%5!<%P!<$GFI$b$&$H$9$k$H!"%(%i!<$,=P$F$7$^$$$^$7$?!#(J
$@!JB>$+(J$@$iE>Aw$5$l$F$-$?5-;v$d!"$=$N%5!<%P!<$+$iE>Aw$7$?5-;v$rB>$N%5!<%P!<(J
  $@$GFI$`$H$&$^$/$$$-$^$9!#!K(J

$@$3$l(J$@$O$=$N%5!<%P!<$G%]%9%H$7$?5-;v$N(J Date $@%U%#!<%k%I$,!"(J
	Date: Mon, 5 Oct 1992 10:38:40 GMT
$@$H$J$C$F$$$k(J$@$+$i$G$9!#!W(J
$@$H$$$&;XE&$rCf@n!w;0=EBg$5$s$+$i<u$1$^$7$?!#(J

$@%K%e!<%9%7%9%F%`$N@_Dj$rJQ99$9$l$P$$$$$N$+(J$@$bCN$l$^$;$s$,!"$3$l$^$G$N5-;v$N(J
$@$3$H$b$"$j$^$9$N$G!"(Jgmt-to-jst.el $@$rJQ99$7$F$I$A$i$G$b(J JST $@$rI=<($9$k(J$@$h$&$K(J
$@$7$^$7$?!#(J

$@;H$$J}$O!"%*%j%8%J%k$N(Jgmt-to-jst.el $@$HF1$8$G!"E,Ev$J%G%#%l%/%H%j$KCV$$$F(J
 byte-compile $@$7$^$9!#$=$l$+$i(J
~/.emacs $@$G(J
	(load "gmt-to-jst" )
	(setq gnus-Article-prepare-hook '(lambda () (gmt-to-jst)))
$@$H$7$F2<$5$$!#(J

$@$J$*!"$b$H$NL>A0$HF1$8$J$N$G!"F3F~$9$k;~$O5$$r$D$1$F2<$5$$!#(J

--------------------------------$@$3$3$+$i(J------------------------------------
;; gmt-to-jst.el
;; copyright (C) 1990 Toshiaki Shingu (shingu@cpr.canon.co.jp)
;; modified by Tadashi Kobayashi (kobayasi@elecom.mie-u.ac.jp) 1992

;; Anyone can freely copy, modify, distribute this program,
;; but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.

; This program converts Greenwich mean time to Japanese standard time
; in GNUS news reader.
; JST is preceded nine hours to GMT.  You can rewrite this program
; for another time zone easily.

; Usage
;
; Insert the following two lines into ~/.emacs
;
;(load "gmt-to-jst" )
;(setq gnus-Article-prepare-hook '(lambda () (gmt-to-jst)))

(defun gmt-to-jst ()
  (goto-char (point-min))
  (let ((hour) (year) (month) (date) (youbi))
    (re-search-forward "\\(^Date: \\)\\([a-zA-Z]*\\),? ?\\([0-9]+\\) \\([A-Za-z]+\\) \\([0-9]+\\) \\([0-9]+\\)\\([0-9: ]+\\)\\(GMT\n\\)")
    (setq hour
	  (string-to-int (buffer-substring (match-beginning 6) (match-end 6))))
    (setq year
	  (string-to-int (buffer-substring (match-beginning 5) (match-end 5))))
    (setq month
	  (buffer-substring (match-beginning 4) (match-end 4)))
    (setq date
	  (string-to-int (buffer-substring (match-beginning 3) (match-end 3))))
    (setq youbi
	  (buffer-substring (match-beginning 2) (match-end 2)))
    (setq hour (+ hour 9))
    (if (>= hour 24)
	(progn
	  (setq hour (- hour 24))
	  (cond ((string-equal youbi "Sun")
		 (setq youbi "Mon"))
		((string-equal youbi "Mon")
		 (setq youbi "Tue"))
		((string-equal youbi "Tue")
		 (setq youbi "Wed"))
		((string-equal youbi "Wed")
		 (setq youbi "Thu"))
		((string-equal youbi "Thu")
		 (setq youbi "Fri"))
		((string-equal youbi "Fri")
		 (setq youbi "Sat"))
		((string-equal youbi "Sat")
		 (setq youbi "Sun")))
	  (setq date (+ date 1))
	  (cond ((and (string-equal month "Jan") (= date 32))
		 (setq month "Feb")
		 (setq date 1))
		((and (string-equal month "Feb")
		      (= date 
			 (if (or (and
				  (= (% year 4) 0)
				  (/= (% year 100) 0))
				 (= (% year 400) 0))
			     30
			   29)))
		 (setq month "Mar")
		 (setq date 1))
		((and (string-equal month "Mar") (= date 32))
		 (setq month "Apr")
		 (setq date 1))
		((and (string-equal month "Apr") (= date 31))
		 (setq month "May")
		 (setq date 1))
		((and (string-equal month "May") (= date 32))
		 (setq month "Jun")
		 (setq date 1))
		((and (string-equal month "Jun") (= date 31))
		 (setq month "Jul")
		 (setq date 1))
		((and (string-equal month "Jul") (= date 32))
		 (setq month "Aug")
		 (setq date 1))
		((and (string-equal month "Aug") (= date 32))
		 (setq month "Sep")
		 (setq date 1))
		((and (string-equal month "Sep") (= date 31))
		 (setq month "Oct")
		 (setq date 1))
		((and (string-equal month "Oct") (= date 32))
		 (setq month "Nov")
		 (setq date 1))
		((and (string-equal month "Nov") (= date 31))
		 (setq month "Dec")
		 (setq date 1))
		((and (string-equal month "Dec") (= date 32))
		 (setq month "Jan")
		 (setq date 1)
		 (setq year (+ 1 year)))
		(t nil))
	  )	  )
    (delete-region (match-beginning 8) (match-end 8))
    (goto-char (match-beginning 8))
    (insert "JST\n")
    (delete-region (match-beginning 6) (match-end 6))
    (goto-char (match-beginning 6))
    (insert 
     (if (< hour 10)
	 (concat "0" (int-to-string hour))
       (int-to-string hour)))
    (delete-region (match-beginning 5) (match-end 5))
    (goto-char (match-beginning 5))
    (insert (int-to-string year))
    (delete-region (match-beginning 4) (match-end 4))
    (goto-char (match-beginning 4))
    (insert month)
    (delete-region (match-beginning 3) (match-end 3))
    (goto-char (match-beginning 3))
    (insert (int-to-string date))
    (delete-region (match-beginning 2) (match-end 2))
    (goto-char (match-beginning 2))
    (insert youbi)
    ))
--------------------------------$@$3$3$^$G(J-----------------------------------
--
	$@>.NS!!Ci!wFa?\8&(J.$@EE;R9)3X2J(J.$@9)3XIt(J.$@;0=EBg!J>pJs=hM}9V:B#4G/!K(J
			mail address:kobayasi@elecom.mie-u.ac.jp
Newsgroups: fj.editor.emacs