all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Elisp: Using message to print two numbers
@ 2020-11-01 20:46 jai-bholeki via Users list for the GNU Emacs text editor
  2020-11-01 21:20 ` tomas
  0 siblings, 1 reply; 4+ messages in thread
From: jai-bholeki via Users list for the GNU Emacs text editor @ 2020-11-01 20:46 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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)

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

* Re: Elisp: Using message to print two numbers
  2020-11-01 20:46 Elisp: Using message to print two numbers jai-bholeki via Users list for the GNU Emacs text editor
@ 2020-11-01 21:20 ` tomas
  2020-11-01 21:41   ` jai-bholeki
  0 siblings, 1 reply; 4+ messages in thread
From: tomas @ 2020-11-01 21:20 UTC (permalink / raw)
  To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

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

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?

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Elisp: Using message to print two numbers
  2020-11-01 21:20 ` tomas
@ 2020-11-01 21:41   ` jai-bholeki
  2020-11-01 21:48     ` tomas
  0 siblings, 1 reply; 4+ messages in thread
From: jai-bholeki @ 2020-11-01 21:41 UTC (permalink / raw)
  To: tomas@tuxteam.de; +Cc: help-gnu-emacs@gnu.org


‐‐‐‐‐‐‐ 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)
            )
         )


>
> Cheers
>
> -   t





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

* Re: Elisp: Using message to print two numbers
  2020-11-01 21:41   ` jai-bholeki
@ 2020-11-01 21:48     ` tomas
  0 siblings, 0 replies; 4+ messages in thread
From: tomas @ 2020-11-01 21:48 UTC (permalink / raw)
  To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2020-11-01 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-01 20:46 Elisp: Using message to print two numbers jai-bholeki via Users list for the GNU Emacs text editor
2020-11-01 21:20 ` tomas
2020-11-01 21:41   ` jai-bholeki
2020-11-01 21:48     ` tomas

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.