From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Simple lisp question - printing out file name Date: Wed, 11 Jan 2006 04:15:42 GMT Organization: EarthLink Inc. -- http://www.EarthLink.net Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1136953097 21526 80.91.229.2 (11 Jan 2006 04:18:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 11 Jan 2006 04:18:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 11 05:18:17 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EwXR9-00035u-CH for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jan 2006 05:18:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EwXT9-0003iZ-U2 for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Jan 2006 23:20:19 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!207.69.154.102.MISMATCH!elnk-atl-nf2!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!0847253b!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 75 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-NNTP-Posting-Host: 4.252.20.98 Original-X-Complaints-To: abuse@earthlink.net Original-X-Trace: newsread2.news.atl.earthlink.net 1136952942 4.252.20.98 (Tue, 10 Jan 2006 20:15:42 PST) Original-NNTP-Posting-Date: Tue, 10 Jan 2006 20:15:42 PST Original-Xref: shelby.stanford.edu gnu.emacs.help:136972 Original-To: help-gnu-emacs@gnu.org 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:32587 Archived-At: "B. T. Raven" wrote in message news:vz%wf.6400$%W1.5124@newsread2.news.atl.earthlink.net... > > --- Pascal Bourguignon wrote: Oops! Who's Stephen? I mean Pascal. > > > > > exits funnel writes: > > > > > > > Hello, > > > > > > > > I have added to several .el files something like > > > this: > > > > > > > > (message "In prj.el") > > > > > > > > to help me straighten out configuration issues. > > > I'd > > > > like to make it slightly more sophisicated by (a) > > > > replacing the hard coded string with some lisp to > > > read > > > > the fully qualified file name and (b) to prepend a > > > > timestamp. I'm sure this is trivial lisp, but > > > > apparently it's not quite trivial enough for me :) > > > It > > > > seems that buffer-file-name and > > > current-time-string > > > > should be of interest to me but I can't get them > > > to > > > > work inside my message call. Can anyone help me > > > out > > > > here? Thanks in advance. > > > > > > (message (format "On %s loading %s" > > > (time-stamp-string) load-file-name)) > > > > > > You can also specify the time-stamp-format: > > > > > > (time-stamp-string "%:y-%02m-%02d > > > %02H:%02M:%02S") > > > > > E.F.: > > I have the same set-up you do but that isn't the problem. To understand > what's going on type the following: > > C-h f time [tab] ;; this gives you completions for some > ;; functions starting with 'time...' > ;; time-stamp is the only one similar to what you're > ;; looking for. Click on it and you will see that it's > ;; defined in time-stamp.el. Before you look into this > ;; file, put (time-stamp) into the *scratch* buffer and > ;; with the cursor after the close paren, type > C-j. > ;; notice that this loads the time-stamp.el file. > ;; Now type C-h f time [tab] again and you will > ;; that many more functions are now available to > ;; the emacs. If you put (time-stamp-string) in the > ;; *scratch* buffer and evaluate it with > C-j > ;;you will see the current time and machine name printed > ;; on the next line. Evaluate again and you will see that > ;; the time has been updated. > > Now you can use it in a lisp function as indicated by Stephen. > You could also load the time-stamp.el by putting it in your > .emacs file but it is auto-loaded by calling the function. > > Ed > >