all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Simple lisp question - printing out file name
@ 2006-01-10 19:44 exits funnel
  2006-01-10 19:58 ` Peter Dyballa
  0 siblings, 1 reply; 6+ messages in thread
From: exits funnel @ 2006-01-10 19:44 UTC (permalink / raw)


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.

-exits

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Simple lisp question - printing out file name
  2006-01-10 19:44 exits funnel
@ 2006-01-10 19:58 ` Peter Dyballa
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2006-01-10 19:58 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 10.01.2006 um 20:44 schrieb exits funnel:

> I have added to several .el files something like this:
>
> (message "In prj.el")

Try this:

(defadvice load (before debug-log activate)
   (message "(Tipp von Kai G): Lade jetzt: %s" (ad-get-arg 0)))

--
Greetings

   Pete

The world would be a better place if Larry Wall had been born in
Iceland, or any other country where the native language actually
has syntax.
         -- Peter da Silva

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Simple lisp question - printing out file name
       [not found] <mailman.634.1136922414.26925.help-gnu-emacs@gnu.org>
@ 2006-01-10 20:15 ` Pascal Bourguignon
  2006-01-10 20:44   ` exits funnel
  0 siblings, 1 reply; 6+ messages in thread
From: Pascal Bourguignon @ 2006-01-10 20:15 UTC (permalink / raw)


exits funnel <exitsfunnel@yahoo.com> 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")



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

CAUTION: The mass of this product contains the energy equivalent of
85 million tons of TNT per net ounce of weight.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Simple lisp question - printing out file name
  2006-01-10 20:15 ` Simple lisp question - printing out file name Pascal Bourguignon
@ 2006-01-10 20:44   ` exits funnel
  0 siblings, 0 replies; 6+ messages in thread
From: exits funnel @ 2006-01-10 20:44 UTC (permalink / raw)


Hi Pascal,

This looks like exactly what I want except that it
doens't work :)  Is time-stamp-string availaible only
in cvs emacs?  I should have mentioned that I'm
running the precompiled emacs 21.3.1 on a windows box.
 Apropos doesn't show any hits for time-stamp-string. 
If the case is that your suggested code is only good
for cvs emacs, do you know of any older functions
which are roughly equivalent?  Thanks.

-exits

--- Pascal Bourguignon <spam@mouse-potato.com> wrote:

> exits funnel <exitsfunnel@yahoo.com> 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")
> 
> 
> 
> -- 
> __Pascal Bourguignon__                    
> http://www.informatimago.com/
> 
> CAUTION: The mass of this product contains the
> energy equivalent of
> 85 million tons of TNT per net ounce of weight.
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Simple lisp question - printing out file name
       [not found] <mailman.648.1136926006.26925.help-gnu-emacs@gnu.org>
@ 2006-01-11  4:11 ` B. T. Raven
  2006-01-11  4:15   ` B. T. Raven
  0 siblings, 1 reply; 6+ messages in thread
From: B. T. Raven @ 2006-01-11  4:11 UTC (permalink / raw)



"exits funnel" <exitsfunnel@yahoo.com> wrote in message
news:mailman.648.1136926006.26925.help-gnu-emacs@gnu.org...
> Hi Pascal,
>
> This looks like exactly what I want except that it
> doens't work :)  Is time-stamp-string availaible only
> in cvs emacs?  I should have mentioned that I'm
> running the precompiled emacs 21.3.1 on a windows box.
>  Apropos doesn't show any hits for time-stamp-string.
> If the case is that your suggested code is only good
> for cvs emacs, do you know of any older functions
> which are roughly equivalent?  Thanks.
>
> -exits
>
> --- Pascal Bourguignon <spam@mouse-potato.com> wrote:
>
> > exits funnel <exitsfunnel@yahoo.com> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Simple lisp question - printing out file name
  2006-01-11  4:11 ` B. T. Raven
@ 2006-01-11  4:15   ` B. T. Raven
  0 siblings, 0 replies; 6+ messages in thread
From: B. T. Raven @ 2006-01-11  4:15 UTC (permalink / raw)



"B. T. Raven" <ecinmn@peoplepc.com> wrote in message
news:vz%wf.6400$%W1.5124@newsread2.news.atl.earthlink.net...
> > --- Pascal Bourguignon <spam@mouse-potato.com> wrote:

Oops! Who's Stephen? I mean Pascal.


> >
> > > exits funnel <exitsfunnel@yahoo.com> 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
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-01-11  4:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.634.1136922414.26925.help-gnu-emacs@gnu.org>
2006-01-10 20:15 ` Simple lisp question - printing out file name Pascal Bourguignon
2006-01-10 20:44   ` exits funnel
     [not found] <mailman.648.1136926006.26925.help-gnu-emacs@gnu.org>
2006-01-11  4:11 ` B. T. Raven
2006-01-11  4:15   ` B. T. Raven
2006-01-10 19:44 exits funnel
2006-01-10 19:58 ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.