From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: kamo Newsgroups: gmane.emacs.help Subject: Re: how to do it a command automatically Date: Thu, 08 Feb 2007 20:41:28 +0100 Organization: Guest of ProXad - France Message-ID: <45cb7ce7$0$451$426a74cc@news.free.fr> References: <45c494b8$0$431$426a34cc@news.free.fr> <1170516489.691490.18460@p10g2000cwp.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1170967317 5265 80.91.229.12 (8 Feb 2007 20:41:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Feb 2007 20:41:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 08 21:41:50 2007 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 1HFG5V-0001Ov-13 for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Feb 2007 21:41:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HFG5U-0004y4-GY for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Feb 2007 15:41:48 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!cleanfeed2-b.proxad.net!nnrp13-2.free.fr!not-for-mail User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) Original-Newsgroups: gnu.emacs.help In-Reply-To: Original-Lines: 58 Original-NNTP-Posting-Date: 08 Feb 2007 20:41:27 MET Original-NNTP-Posting-Host: 82.230.64.4 Original-X-Trace: 1170963687 news-1.free.fr 451 82.230.64.4:1075 Original-X-Complaints-To: abuse@proxad.net Original-Xref: shelby.stanford.edu gnu.emacs.help:145370 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:40976 Archived-At: Kevin Rodgers a écrit : > collger wrote: >> define this new command, and then ...... >> >> (defun print-chinese-date-sh () >> "A silly way to print current chinese date.\nYou Can add other >> outputs after the 'set-buffer call" >> (interactive) ;become a command >> (save-excursion) >> (calendar) >> (set-buffer (get-buffer "*Calendar*")) >> (calendar-print-chinese-date) >> (kill-buffer-and-window) ;close the calendar, remove it if you want >> ) > > I think you meant > > (save-excursion > (save-window-excursion > (calendar) > ... > )) > > But since OP wants something to run from the shell: > > emacs --batch --funcall calendar other-buffer --funcall > calendar-print-chinese-date > > Hi ! this command doesn't work #bash $ emacs --batch --funcall calendar other-buffer --funcall calendar-print-chinese-date Loading 00debian-vars... Loading 50autoconf (source)... Loading 50dictionaries-common (source)... Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)... Computing Chinese date... Symbol's value as variable is void: displayed-month but if I strip "other-buffer", it works perfect Today for instance #bash $ emacs --batch --funcall calendar --funcall calendar-print-chinese-date Loading 00debian-vars... Loading 50autoconf (source)... Loading 50dictionaries-common (source)... Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)... Computing Chinese date... Chinese date: Cycle 78, year 23 (Bing-Xu), month 12 (Xin-Chou), day 21 (Gui-You) Thank you a lot Kevin! Kamo