emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: Is this a bug in while-let or do I missunderstand i


From: Jens Schmidt
Subject: Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?
Date: Sat, 9 Nov 2024 21:02:12 +0100
User-agent: Mozilla Thunderbird

> If the bindings are to be reevaluated on each iteration, shouldn't B
> always be NIL, and that it would end up with (< NIL end) would be on
> each iteration causing an error?

I hope I don't miss anything important here, but I think the
first two elements in SPEC of below `while-let'

  (while-let ((b)
              ((< b end))
              (e (next-single-property-change (1+ b) 'erc--msg nil end)))
    ...)

do not actually bind anything, they only test.  The doc string of
`if-let' has:

  Each element of SPEC is a list (SYMBOL VALUEFORM) that binds
  SYMBOL to the value of VALUEFORM.  An element can additionally be
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  of the form (VALUEFORM), which is evaluated and checked for nil;
  ^^^^^^^^^^^^^^^^^^^^^^^
  i.e. SYMBOL can be omitted if only the test result is of
  interest.  It can also be of the form SYMBOL, then the binding of
  SYMBOL is checked for nil.

I'd align such clauses like this:

  (while-let ((  b)
              (  (< b end))
              (e (next-single-property-change (1+ b) 'erc--msg nil end)))
    ...)

to emphasize that.



reply via email to

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