From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.help Subject: Re: Anniversary in Chinese calendar date Date: Mon, 17 Nov 2008 17:28:43 +0000 Organization: University of Cambridge Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226942990 18795 80.91.229.12 (17 Nov 2008 17:29:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2008 17:29:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 17 18:30:49 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L27vf-0004GR-Oh for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Nov 2008 18:30:28 +0100 Original-Received: from localhost ([127.0.0.1]:55709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L27uX-0000LP-8p for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Nov 2008 12:29:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L27uD-0000LF-MZ for help-gnu-emacs@gnu.org; Mon, 17 Nov 2008 12:28:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L27uB-0000J6-TN for help-gnu-emacs@gnu.org; Mon, 17 Nov 2008 12:28:57 -0500 Original-Received: from [199.232.76.173] (port=59922 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L27uB-0000In-K2 for help-gnu-emacs@gnu.org; Mon, 17 Nov 2008 12:28:55 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:41489 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L27uB-000123-En for help-gnu-emacs@gnu.org; Mon, 17 Nov 2008 12:28:55 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1L27u8-0006Tb-V3 for help-gnu-emacs@gnu.org; Mon, 17 Nov 2008 17:28:52 +0000 Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Nov 2008 17:28:52 +0000 Original-Received: from sdl.web by smaug.linux.pwf.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Nov 2008 17:28:52 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: smaug.linux.pwf.cam.ac.uk Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAMFBMVEUaFRZLMy1dTENxVzKQ WiCrXQ97cmO/dSqSh3akjGTApXy5sJ7Sxo/Sz8Xo6eP9//xJbkruAAAAAWJLR0QAiAUdSAAAAAlw SFlzAAACxQAAAsUBidZ/7wAAAAd0SU1FB9cBBwMJOwHXewoAAAIBSURBVCjPVdNBiNNAFADQ6J4F x3hThHZBBC+WCFI8SS0iezRDcMHLHkLAg6gJH/fgYQ9xYlj2sLK4KHgqCgXFhda2Idmr4kkQPZQ0 nkQMbTypbMmMM2m7ZgYSmMef/5OZPwo7HFnx3uKPcmj0Dht1LWZJ+Hvr7dIFZXRUwl9VRTuuKDJ+ U44gjscknK4hhJaCkYRsWjmBtLqXlJAG2wipNe18OZJu1BBq1E8xafl4s6Jq2mUZGftU1y7CCxnp FVUDWJXx4C66BKBnErbuoaYNtoRTu6EZBsCbMn7W+5qOAR6WvxNOby9jHWC9hAf3n304CdiAByXs 3Nh9roLDkyb/sWV712vYwaLSAn8CPMHIAAzOPDKP2COAFm4Y4ODVWc6xG7KXsN7UeUJjjimx2uwd gCgNhr0i8C/xyCD5CiCKAMY3Bf5oDzx//w/fimscdcAZU2jv9sedx6+nYPPFIoWI/GK6QZ+EFGOR ErAjCnV3vPZ7XqlTIMbOLY7fLcvvmT7rXNWaGDexIY44N12TG2PDp7vqyl57dnCeuWwyNpnEURxk fTbDYeBnKRn4oejPYI4sH6WviBumEZ/GxX4X/x6EcURFZ7E071bjQGAxpcOAEOJuTiroDEea5Szv rVWLYfl7ZiQwSUToxrkux7OLixAWGz22+HIyWTRYcVfomOwvzusfjtVIGgLHf3MAAAAASUVORK5C YII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:esV9WvLsW8/2Jbm0IIws58gUSi4= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59869 Archived-At: On 2008-11-17 10:16 +0000, Leo wrote: > Hi there, > > In the south of China, people are still celebrating their birthdays in > Chinese calendar date. I would like to add all my friends there in this > way so that I can promptly send them my gifts. > > Any idea how to do this with Emacs calendar? > > Thank you. I have come up with this function to be used in the diary file. (defun diary-chinese-anniversary (lunar-month lunar-day &optional year mark) (let* ((ddate (diary-make-date lunar-month lunar-day year)) (dd (calendar-extract-day ddate)) (mm (calendar-extract-month ddate)) (yy (calendar-extract-year ddate)) (a-date (calendar-absolute-from-gregorian date)) (c-date (calendar-chinese-from-absolute a-date)) (mm2 (nth 2 c-date)) (dd2 (nth 3 c-date)) (y (calendar-extract-year date)) (diff (if year (- y year) 100))) (and (> diff 0) (= mm mm2) (= dd dd2) (cons mark (format entry diff (diary-ordinal-suffix diff)))))) Now you can use something like: %%(diary-chinese-anniversary 10 11 1983) Someone's %d%s Birthday -- .: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :. Use the better alternative -- http://www.openoffice.org/