From: Philip Kaludercic <philipk@posteo.net>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: Sean Whitton <spwhitton@spwhitton.name>,
Sean Whitton via "Emacs development discussions."
<emacs-devel@gnu.org>
Subject: Re: New for GNU ELPA: literate-scratch
Date: Wed, 19 Jun 2024 06:47:44 +0000 [thread overview]
Message-ID: <87frt9tomn.fsf@posteo.net> (raw)
In-Reply-To: <86a5jho2tl.fsf@fastmail.fm> (Joost Kremers's message of "Wed, 19 Jun 2024 08:37:42 +0200")
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
next prev parent reply other threads:[~2024-06-19 6:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 5:53 New for GNU ELPA: literate-scratch Sean Whitton via Emacs development discussions.
2024-06-10 6:16 ` CToID
2024-06-15 14:14 ` Philip Kaludercic
2024-06-15 13:12 ` Philip Kaludercic
2024-06-19 2:42 ` Sean Whitton via Emacs development discussions.
2024-06-19 5:44 ` Philip Kaludercic
2024-06-19 6:37 ` Joost Kremers
2024-06-19 6:47 ` Philip Kaludercic [this message]
2024-06-20 5:37 ` Sean Whitton via Emacs development discussions.
2024-06-20 23:12 ` Michael Heerdegen
2024-06-21 5:57 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frt9tomn.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=joostkremers@fastmail.fm \
--cc=spwhitton@spwhitton.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).