emacs-devel
[Top][All Lists]
Advanced

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

Re: New for GNU ELPA: literate-scratch


From: Philip Kaludercic
Subject: Re: New for GNU ELPA: literate-scratch
Date: Wed, 19 Jun 2024 06:47:44 +0000

Joost Kremers <joostkremers@fastmail.fm> writes:

> On Wed, Jun 19 2024, Philip Kaludercic wrote:
>> Sean Whitton <spwhitton@spwhitton.name> writes:
>>>> You should be able to merge the `and-let*' and `and' like
>>>>
>>>> --8<---------------cut here---------------start------------->8---
>>>> (and-let* ((new (car (bounds-of-thing-at-point 'paragraph)))
>>>>       ((< new start)))
>>>>   (setq start new))
>>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Very interesting!
>>> This seems to be undocumented behaviour of the macro, though?
>>> I don't think I can see anything which implies it in the docstring.
>>
>> Apparently so?  I thought it was documented under if-let* or when-let*,
>> but I couldn't find anything myself either.
>
> It's documented under if-let, where it says that "[a]n element can
> additionally be of the form (VALUEFORM) [...]":

True, and I figured out why I didn't see that.  Notice the first line of
my *Help* buffer: ^^

--8<---------------cut here---------------start------------->8---
if-let is a Lisp macro in โ€˜j-help.elโ€™.

(if-let BINDING THEN &optional ELSE)

Bind value according to BINDING and check for truthy-ness
If the test passes then eval THEN with the BINDING varlist bound
If no, eval ELSE with no binding
--8<---------------cut here---------------end--------------->8---

> ,----
> | 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.
> `----
>
> The doc string of and-let* points to when-let*, which points to when-let, 
> which
> points to if-let. ๐Ÿ˜„

I think that this is fair, before we have to start duplicating the
documentation in each ...-let* macro.

-- 
        Philip Kaludercic on peregrine



reply via email to

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