help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp: Using message to print two numbers


From: address@hidden
Subject: Re: Elisp: Using message to print two numbers
Date: Sun, 1 Nov 2020 22:48:49 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Nov 01, 2020 at 09:41:06PM +0000, jai-bholeki wrote:
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Sunday, 1 November 2020 22:20, <tomas@tuxteam.de> wrote:
> 
> > On Sun, Nov 01, 2020 at 08:46:19PM +0000, jai-bholeki via Users list for 
> > the GNU Emacs text editor wrote:
> >
> > > Any ideas on how to print two integers 'beg' and 'end'
> > > Have used the following to no avail
> > > (message "Prg-Bounds: %d %d" Beg End)
> >
> > "to no avail" isn't an Emacs error message ;-P
> 
> You will in a minute ;)
> 
> >
> > Uh. I mean: this works for me, put into the right context
> > (the variables Beg and End have to be bound to two integers
> > and some other things). For me:
> >
> > (let ((Beg 15)
> > (End 16))
> > (message "Prog-Bounds: %d %d" Beg End))
> >
> > issues the message
> >
> > Prog-Bounds: 15 16
> >
> > What happens in your case?
> 
> Problem starts when making a subtraction
> 
>          (let*
>             ( (Beg 20)
>               (End 30)
>               (Length (- Beg End))
>               (message "Region: (%d, %d) %s %d" Beg End "Length" Length)
>             )
>          )

Ah. The problem is in the (let* ...). It needs one more parenthesis. Like so:

         (let*
            ( (Beg 20)
              (End 30)
              (Length (- Beg End)))
            (message "Region: (%d, %d) %s %d" Beg End "Length" Length))

(the three parentheses are: one for closing the (- ...) form, one for
closing the (Length ...) pair, one for closing the whole let binding
list)

The way you wrote it, the (message ...) is in the binding list, and
this confuses (let* ...)

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]