Article View: fj.editor.emacs
Article #3325Re: OLIMPIC BUG gmt-to-jst.el
From: Hideo Noro
Date: Fri, 07 Feb 1992 12:56
Date: Fri, 07 Feb 1992 12:56
236 lines
9702 bytes
9702 bytes
$BLnO$(J@$BAaBgM}9)$G$9!#(J In article <HIRANO.92Feb7115926@azabu.tkl.iis.u-tokyo.ac.jp> hirano@tkl.iis.u-tokyo.ac.jp (HIRANO Satoshi) writes: >In article <NORO.92Feb7051603@qlair.ohara.info.waseda.ac.jp> noro@ohara.info.waseda.ac.jp (Hideo Noro) writes: > >$B$_$?$i!"$=$N%P%0%U%#%C%/%9HG$@$C$?$h$&$G$9!#(J > >$B$*$*(J$B!"$1$C$3$&0&MQ$5$l$F$$$^$9$M!#(J > >$B$9$$$^$;$s$1$I!"%P%0%U%#%C%/%9HG$r;}$C$F$$$J$$$N$G!"A4BN$r%]%9%H$7(J$B$F(J >$BD:$1$^$;$s$+!#LnO$$5$s$N=$@5$,F~$C$?$d$D$,$$$$$G$9!#(J $B$O$$!#(Jfj.sources $B$O$A$g$C$HCQ$:$+$7$$$N$G(J:-)$B$3$C$A$K=P$7$^$9!#(J $B$H;W$C$?$H$3$m$GAaB.%P%0$,$$$^$7$?!#(Jdate $B$,(J increment $B$5$l$?$i(J $BMKF|$b(J increment $B$7$J$$$H$$$1$J$$$s$G$9$M!#$G!">/$7(J($B$[$s$N>/$7$G$9(J) emacs $B$N@55,I=8=$K$D$$$F%^%K%e%"%k$rFI$s$@$N$G!"$A(J$B$g$C$H%5!<%A$N$H(J $B$3$m$,$^$H$b$K$J$C$F$$$^$9!#(J($BCY$/$J$C$?$+$b$7$l$J$$(J) $B$G!"%P%0$,$^$@$$$k$+$b$7$l$^$;(J$B$s$,!"E,Ev$K2D0&$,$C$F$"$2$F$/$@$5$$!#(J >>NN N O O R R O O ___ P P $BKY$A$($_$5$s$O1J1s$N%"%$%I%k$G(J$B$9(J by $B$_$+$j$s(J > >$B;d$NDo$OKY$A$($_$N%U%!%s%/%i%V$KF~$C$F$$$^$7$?!#(J:-) $B$J$s$@$+?F6a46$,M/$$$F$-$^$9(J$B$M!#(J:-) # $B=$O@=q$+$J$$$H!#(J #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # gmt-to-jst.el # This archive created: Fri Feb 7 21:46:57 1992 export PATH; PATH=/bin:$PATH if test -f 'gmt-to-jst.el' then echo shar: will not over-write existing file "'gmt-to-jst.el'" else sed 's/^X//' << \SHAR_EOF > 'gmt-to-jst.el' X;@Path: yuasasun!tutgw!nttlab!hirose!heart!kikuchi X;@From: kikuchi@riec.tohoku.ac.jp (Toshiaki Kikuchi) X;@Newsgroups: fj.editor.emacs X;@Subject: Re: gmt-to-jst.el X;@Message-ID: <1206@heart.riec.tohoku.ac.jp> X;@Date: 22 Jul 90 05:28:13 GMT X;@References: <1195@heart.riec.tohoku.ac.jp> <1205@heart.riec.tohoku.ac.jp> X;@Sender: news@heart.riec.tohoku.ac.jp X;@Distribution: fj X;@Organization: Research Institute of Electrical Communication, TOHOKU univ. X;@Lines: 140 X;@In-reply-to: kikuchi@riec.tohoku.ac.jp's message of 22 Jul 90 14:24:34 JST X;@ X;@ gmt-tojst.el $B$NK\BN$G$9!#(J X;@$B;H$$J}$O!"E,Ev$J%G%#%l%/%H%j$KCV$$$F(J byte-compile $B$7(J$B$^$9!#$=$l$+$i(J X;@~/.emacs $B$G(J X;@ X;@ (load-library "gmt-to-jst.elc" ) X;@ (setq gnus-Article-prepare-hook '(lambda () (gmt-to-jst))) X;@ X;@$B$H$7$F2<$5$$!#(J X;@ X;@ X;@ X;@ $B5FCO(J $B=S>4!wElKLEENO(J X;@ (kikuchi@noguchi.riec.tohoku.ac.jp) X;@ X;@#! /bin/sh X;@# This is a shell archive, meaning: X;@# 1. Remove everything above the #! /bin/sh line. X;@# 2. Save the resulting text in a file. X;@# 3. Execute the file with /bin/sh (not csh) to create: X;@# gmt-to-jst.el X;@# This archive created: Sun Jul 22 14:19:35 1990 X;@export PATH; PATH=/bin:/usr/bin:$PATH X;@echo shar: "extracting 'gmt-to-jst.el'" '(3158 characters)' X;@if test -f 'gmt-to-jst.el' X;@then X;@ echo shar: "will not over-write existing file 'gmt-to-jst.el'" X;@else X;@sed 's/^X//' << \SHAR_EOF > 'gmt-to-jst.el' X;; gmt-to-jst.el X;; copyright (C) 1990 Toshiaki Shingu (shingu@cpr.canon.co.jp) X X;; Anyone can freely copy, modify, distribute this program, X;; but WITHOUT ANY WARRANTY; without even the implied X;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR X;; PURPOSE. X X; This program converts Greenwich mean time to Japanese standard time X; in GNUS news reader. X; JST is preceded nine hours to GMT. You can rewrite this program X; for another time zone easily. X X; Usage X; X; Insert the following two lines into ~/.emacs X; X;(load-library "gmt-to-jst.elc" ) X;(setq gnus-Article-prepare-hook '(lambda () (gmt-to-jst))) X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; X; noro-p(noro@ohara.info.waseda.ac.jp) modification (7 Feb 1992). X; 1. Handles Date: field format including the day of the week. X; ex. 'Date: Fri, 7 Feb 1992 12:05:30 GMT' X; 2. If the year is less than 100, use year as X; (year + gmt-to-jst-base-year). X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; X X; added by noro-p X(defvar gmt-to-jst-base-year 1900 X"*Offest of the year in the Date: field. If the year is less than 100, Xuse year as (year + gmt-to-jst-base-year)") X; X(defun gmt-to-jst () X (goto-char (point-min)) X (let ((hour) (year) (month) (date) (week)) X (re-search-forward "\\(^Date: \\)\\(Sun, \\|Mon, \\|Tue, \\|Wed, \\|Thu, \\|Fri, \\|Sat, \\|\\)\\([0-9]+\\) \\([A-Za-z]+\\) \\([0-9]+\\) \\([0-9]+\\)\\([0-9: ]+\\)\\(GMT\n\\)") ; modified by noro-p X (setq hour X (string-to-int (buffer-substring (match-beginning 6) (match-end 6)))) X (setq year X (string-to-int (buffer-substring (match-beginning 5) (match-end 5)))) X (if (< year 100) X (setq year (+ year gmt-to-jst-base-year))) X (setq month X (buffer-substring (match-beginning 4) (match-end 4))) X (setq date X (string-to-int (buffer-substring (match-beginning 3) (match-end 3)))) X (setq week X (buffer-substring (match-beginning 2) (match-end 2))) X (setq hour (+ hour 9)) X (if (>= hour 24) X (progn X (setq hour (- hour 24)) X (setq date (+ date 1)) X (cond ((string-equal week "Sun, ") X (setq week "Mon, ")) X ((string-equal week "Mon, ") X (setq week "Tue, ")) X ((string-equal week "Tue, ") X (setq week "Wed, ")) X ((string-equal week "Wed, ") X (setq week "Thu, ")) X ((string-equal week "Thu, ") X (setq week "Fri, ")) X ((string-equal week "Fri, ") X (setq week "Sat, ")) X ((string-equal week "Sat, ") X (setq week "San, "))) X (cond ((and (string-equal month "Jan") (= date 32)) X (setq month "Feb") X (setq date 1)) X ((and (string-equal month "Feb") X (= date X (if (or (and X (= (% year 4) 0) X (/= (% year 100) 0)) X (= (% year 400) 0)) X 30 X 29))) X (setq month "Mar") X (setq date 1)) X ((and (string-equal month "Mar") (= date 32)) X (setq month "Apr") X (setq date 1)) X ((and (string-equal month "Apr") (= date 31)) X (setq month "May") X (setq date 1)) X ((and (string-equal month "May") (= date 32)) X (setq month "Jun") X (setq date 1)) X ((and (string-equal month "Jun") (= date 31)) X (setq month "Jul") X (setq date 1)) X ((and (string-equal month "Jul") (= date 32)) X (setq month "Aug") X (setq date 1)) X ((and (string-equal month "Aug") (= date 32)) X (setq month "Sep") X (setq date 1)) X ((and (string-equal month "Sep") (= date 31)) X (setq month "Oct") X (setq date 1)) X ((and (string-equal month "Oct") (= date 32)) X (setq month "Nov") X (setq date 1)) X ((and (string-equal month "Nov") (= date 31)) X (setq month "Dec") X (setq date 1)) X ((and (string-equal month "Dec") (= date 32)) X (setq month "Jan") X (setq date 1) X (setq year (+ 1 year))) X (t nil)) X ) ) X (delete-region (match-beginning 8) (match-end 8)) X (goto-char (match-beginning 8)) X (insert "JST\n") X (delete-region (match-beginning 6) (match-end 6)) X (goto-char (match-beginning 6)) X (insert X (if (< hour 10) X (concat "0" (int-to-string hour)) X (int-to-string hour))) X (delete-region (match-beginning 5) (match-end 5)) X (goto-char (match-beginning 5)) X (insert (int-to-string year)) X (delete-region (match-beginning 4) (match-end 4)) X (goto-char (match-beginning 4)) X (insert month) X (delete-region (match-beginning 3) (match-end 3)) X (goto-char (match-beginning 3)) X (insert (int-to-string date)) X (delete-region (match-beginning 2) (match-end 2)) X (goto-char (match-beginning 2)) X (insert week) X )) X X;@SHAR_EOF X;@if test 3158 -ne "`wc -c < 'gmt-to-jst.el'`" X;@then X;@ echo shar: "error transmitting 'gmt-to-jst.el'" '(should have been 3158 characters)' X;@fi X;@fi X;@exit 0 X;@# End of shell archive X;@ X;@ SHAR_EOF fi # end of overwriting check # End of shell archive exit 0 -- N N OO RRR OO PPP $B9%$-$J8@MU(J NN N O O R R O O ___ P P $BKY$A$($_$5$s$O1J1s$N%"%$%I%k$G$9(J by $B$_$+$j$s(J N NN O O RRR O O PPP $B%U%!%$%C%H%C!*(J by $B$R$m$A$c$s(J N N OO R RR OO P $BAa0pEDBg3XM}9)3XIt(J $BDL?.(J $B>.868&5f<<(J $BLnO$1Q@8(J
Technical Details
Message-ID:
<NORO.92Feb7215626@qlair.ohara.info.waseda.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ccut!wnoc-tyo-news!toumon!wsdohr!noroReferences:
<HIRANO.92Feb6180021@azabu.tkl.iis.u-tokyo.ac.jp> <WKENJI.92Feb6202544@einstein.flab.Fujitsu.Co.JP> <NORO.92Feb7051603@qlair.ohara.info.waseda.ac.jp> <HIRANO.92Feb7115926@azabu.tkl.iis.u-tokyo.ac.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: ff358,3aeeb20553853b53 X-Google-Attributes: gidff358,public X-Google-ArrivalTime: 1992-02-07 05:06:18 PST Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ccut!wnoc-tyo-news!toumon!wsdohr!noro From: noro@ohara.info.waseda.ac.jp (Hideo Noro) Newsgroups: fj.editor.emacs Subject: Re: OLIMPIC BUG gmt-to-jst.el Message-ID: <NORO.92Feb7215626@qlair.ohara.info.waseda.ac.jp> Date: 7 Feb 92 12:56:26 GMT References: <HIRANO.92Feb6180021@azabu.tkl.iis.u-tokyo.ac.jp> <WKENJI.92Feb6202544@einstein.flab.Fujitsu.Co.JP> <NORO.92Feb7051603@qlair.ohara.info.waseda.ac.jp> <HIRANO.92Feb7115926@azabu.tkl.iis.u-tokyo.ac.jp> Sender: news@ohara.info.waseda.ac.jp Distribution: fj Organization: Ohara Lab., Dept. of Info. and Comp. Sci., Waseda Univ., JAPAN Lines: 236 In-Reply-To: hirano@tkl.iis.u-tokyo.ac.jp's message of 7 Feb 1992 11:59:26 JST Nntp-Posting-Host: qlair.ohara.info.waseda.ac.jp