unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* print line numbe
@ 2013-09-29  1:25 Harry Putnam
  2013-09-29  2:08 ` Bernardo
  0 siblings, 1 reply; 4+ messages in thread
From: Harry Putnam @ 2013-09-29  1:25 UTC (permalink / raw)
  To: help-gnu-emacs

How can I make a piece of elisp report the line number when it prints
a message?

Something along the line of the __LINE__ operator in perl, 
or the $LINENO operator in shell-scripting.

Something like:

   (message "Hello from line: " something-that-reports-line-number) 




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

* Re: print line numbe
  2013-09-29  1:25 print line numbe Harry Putnam
@ 2013-09-29  2:08 ` Bernardo
  2013-09-29  2:10   ` Bernardo
  0 siblings, 1 reply; 4+ messages in thread
From: Bernardo @ 2013-09-29  2:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

It was a dark and stormy night when Harry Putnam said  (29/09/13 11:25):
> How can I make a piece of elisp report the line number when it prints
> a message?
> 
> Something along the line of the __LINE__ operator in perl, 
> or the $LINENO operator in shell-scripting.
> 
> Something like:
> 
>    (message "Hello from line: " something-that-reports-line-number) 
> 
> 
> 

(message  (format "Hello from line: %d" (line-number-at-pos)))



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

* Re: print line numbe
  2013-09-29  2:08 ` Bernardo
@ 2013-09-29  2:10   ` Bernardo
  0 siblings, 0 replies; 4+ messages in thread
From: Bernardo @ 2013-09-29  2:10 UTC (permalink / raw)
  Cc: help-gnu-emacs

I>> Something like:
>>
>>    (message "Hello from line: " something-that-reports-line-number)
>>
>>
> 
> (message  (format "Hello from line: %d" (line-number-at-pos)))
> 
> 
or simpler
  (message  "Hello from line: %d" (line-number-at-pos) )



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

* Re: print line numbe
@ 2013-10-01 13:52 Barry OReilly
  0 siblings, 0 replies; 4+ messages in thread
From: Barry OReilly @ 2013-10-01 13:52 UTC (permalink / raw)
  To: help-gnu-emacs

>> Something along the line of the __LINE__ operator in perl, or
>> the $LINENO operator in shell-scripting.

> (message  "Hello from line: %d" (line-number-at-pos))

I thought he was asking for the line number of the message call in the .el,
not the position of point in the current buffer.

Something like __FILE__ and __LINE__ for Elisp would be nice to have.


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

end of thread, other threads:[~2013-10-01 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-29  1:25 print line numbe Harry Putnam
2013-09-29  2:08 ` Bernardo
2013-09-29  2:10   ` Bernardo
  -- strict thread matches above, loose matches on Subject: below --
2013-10-01 13:52 Barry OReilly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).