From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: swk Newsgroups: gmane.emacs.help Subject: Re: Help Date: Wed, 30 Oct 2002 06:56:11 +0900 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3DBF03FB.9040300@hananet.net> References: <3DB261D7.5060306@hananet.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------090900030204030003000709" X-Trace: main.gmane.org 1035929042 14430 80.91.224.249 (29 Oct 2002 22:04:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 29 Oct 2002 22:04:02 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 186eSr-0003jg-00 for ; Tue, 29 Oct 2002 23:03:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 186eQU-0000BN-00; Tue, 29 Oct 2002 17:01:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.dacom.co.kr!newsfeed.hananet.net!news.hananet.net!not-for-mail User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en, zh, zh-cn, zh-tw, ja Original-Newsgroups: gnu.emacs.help Original-Lines: 152 Original-NNTP-Posting-Host: 218.237.81.7 Original-X-Trace: news.hananet.net 1035928570 218.237.81.7 (Wed, 30 Oct 2002 06:56:10 KST) Original-NNTP-Posting-Date: Wed, 30 Oct 2002 06:56:10 KST Original-Xref: shelby.stanford.edu gnu.emacs.help:106532 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3083 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3083 --------------090900030204030003000709 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I Put three lines with data 19991201 19991202 19991203 Into another buffer loaded the below code into another buffer evaluated the code then switched to the other buffer The en ran the command M-x jh-iso-to-chinese Emacs just switched to the other buffer (C:\EMACS-21.2\BIN\EMACS.EXE) For information about the GNU Project and its goals, type C-h C-p. Loading image...done call-interactively: End of buffer Mark set mouse-minibuffer-check: Minibuffer window is not active [2 times] Loading calendar...done Loading mule-util...done Loading cal-move...done jh-iso-to-chinese This is what is in the messages buffer Is the cursor supposed to be before the dates to be converted or after? Jesper Harder wrote: >swk writes: > > > >>Each line starts with a modified ISO date e.g., 19991203 (YYYYMMDD) >> >>Is there any way to pull the ISO Dates to a file and then append the >>equivilant Chinese dates to a file? >> >> > >I don't think there's any predefined functionality for that. Here's a >suggestion for a way you could implement it. > >Evaluate the following, load the file with the ISO dates in a buffer and >do `M-x jh-iso-to-chinese', which will put the Chinese dates in another >buffer. > > >(defun jh-iso-to-chinese () > (interactive) > (goto-char (point-min)) > (while (re-search-forward "^\\([[:digit:]]\\{4\\}\\)\\([[:digit:]]\\{2\\}\\)\\([[:digit:]]\\{2\\}\\)" nil t) > (let ((str (format "%s\n" (calendar-chinese-date-string > (mapcar 'string-to-int > (list (match-string 1) > (match-string 2) > (match-string 3))))))) > (with-current-buffer (get-buffer-create "*chinese output*") > (insert str)))) > (switch-to-buffer "*chinese output*")) > > --------------090900030204030003000709 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I Put three lines with data

19991201
19991202
19991203

Into another buffer loaded the below code into another buffer
evaluated the code then switched to the other buffer
The en ran the command

M-x jh-iso-to-chinese

Emacs just switched to the other buffer

(C:\EMACS-21.2\BIN\EMACS.EXE)
For information about the GNU Project and its goals, type C-h C-p.
Loading image...done
call-interactively: End of buffer
Mark set
mouse-minibuffer-check: Minibuffer window is not active [2 times]
Loading calendar...done
Loading mule-util...done
Loading cal-move...done
jh-iso-to-chinese

This is what is in the messages buffer

Is the cursor supposed to be before the dates to be converted or after?

Jesper Harder wrote:
swk <sunwukong@hananet.net> writes:

  
Each line starts with a modified ISO date    e.g.,   19991203   (YYYYMMDD)

Is there any way to pull the ISO Dates to a file and then append the
equivilant Chinese dates to a file?
    

I don't think there's any predefined functionality for that.  Here's a
suggestion for a way you could implement it.  

Evaluate the following, load the file with the ISO dates in a buffer and
do `M-x jh-iso-to-chinese', which will put the Chinese dates in another
buffer.


(defun jh-iso-to-chinese ()
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "^\\([[:digit:]]\\{4\\}\\)\\([[:digit:]]\\{2\\}\\)\\([[:digit:]]\\{2\\}\\)" nil t)
    (let ((str (format "%s\n" (calendar-chinese-date-string 
			       (mapcar 'string-to-int 
				       (list (match-string 1) 
					     (match-string 2) 
					     (match-string 3)))))))
    (with-current-buffer (get-buffer-create "*chinese output*")
      (insert str))))
  (switch-to-buffer "*chinese output*"))
  

--------------090900030204030003000709--