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: Sean Whitton
Subject: Re: New for GNU ELPA: literate-scratch
Date: Thu, 20 Jun 2024 13:37:29 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

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



reply via email to

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