From: Sean Whitton via "Emacs development discussions." <emacs-devel@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: Sean Whitton via "Emacs development discussions." <emacs-devel@gnu.org>
Subject: Re: New for GNU ELPA: literate-scratch
Date: Thu, 20 Jun 2024 13:37:29 +0800 [thread overview]
Message-ID: <87msngi38m.fsf@melete.silentflame.com> (raw)
In-Reply-To: <87le31a3lj.fsf@posteo.net> (Philip Kaludercic's message of "Wed, 19 Jun 2024 05:44:40 +0000")
Hello,
On Wed 19 Jun 2024 at 05:44am GMT, Philip Kaludercic wrote:
> Sean Whitton <spwhitton@spwhitton.name> writes:
>
>> Hello,
>>
>> On Sat 15 Jun 2024 at 01:12pm GMT, Philip Kaludercic wrote:
>>
>>>> ;;; Code:
>>>>
>>>> (defun literate-scratch--extend (start end)
>>>> (save-excursion
>>>> (let ((res1
>>>> (and (goto-char start)
>>>> (not (looking-at paragraph-separate))
>>>> (and-let* ((new (car (bounds-of-thing-at-point 'paragraph))))
>>>> (and (< new start)
>>>> (setq start new)))))
>>>
>>> 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. BTW., an alternative is to
> bind the symbol `_', which will also discard the value/bind it to a
> fresh variable.
Thanks. Tbh I am not sure the * versions of the macros should support
this, feels a bit too far away from ordinary 'let'.
(Common Lisp's when-let and if-let don't have this feature, at least the
most popular implementation, in Alexandria.)
--
Sean Whitton
next prev parent reply other threads:[~2024-06-20 5:37 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
2024-06-20 5:37 ` Sean Whitton via Emacs development discussions. [this message]
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=87msngi38m.fsf@melete.silentflame.com \
--to=emacs-devel@gnu.org \
--cc=philipk@posteo.net \
--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).