Re: small indentation inside with-html from spinneret (Common Lisp)

[email protected] Mon, 08 Jun 2026 14:01:55 -0400
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Peter Münster <[email protected]> writes:

> On Mon, Jun 01 2026, Peter Münster wrote:
>
>> I’m trying to get such an indentation inside the with-html macro:
>>
>> (with-html
>>   (:div.name1 test
>>    (:div.name2 test
>>     (:div.name3 test
>>      (:div.name4 test
>>       (:div.name5 test))))))
>>
>> I’ve tried things like
>>
>> (put 'with-html 'common-lisp-indent-function
>>      '((&whole 2 (&whole 2 (&whole 2 (&whole 2 (&whole 2 &rest 1) &rest 1)
>>                                    &rest 1) &rest 1) &rest 1)))
>> ...
>> This is my test case:
>> --8<---------------cut here---------------start------------->8---
>> (with-clog-create body
>>   (gui-menu-bar ()
>>     (gui-menu-drop-down (...)
>>       (gui-menu-item (...)
>> 		     (gui-menu-drop-down (...)
>> 					 (gui-menu-item (...))
>> 					 (gui-menu-item (...)))))))
>> --8<---------------cut here---------------end--------------->8---
>> 

Something for you to try, either:

  (cl-map nil (lambda (fun-or-macro-name)
	              (put fun-or-macro-name 'common-lisp-indent-function '(nil &body)))
  	'(with-html with-clog-create gui-menu-bar gui-menu-drop-down gui-menu-item))

or,

  (mapc (lambda (fun-or-macro-name)
	        (put fun-or-macro-name 'common-lisp-indent-function '(nil &body)))
	'(with-html with-clog-create gui-menu-bar gui-menu-drop-down gui-menu-item))

depending on whether you want ‘nil’ or the sequence of
symbols as your result.

For your ‘with-clog-create’ form, this should yield:

(with-clog-create body
  (gui-menu-bar ()
    (gui-menu-drop-down (...)
      (gui-menu-item (...)
        (gui-menu-drop-down (...)
         (gui-menu-item (...))
         (gui-menu-item (...)))))))

For your ‘with-html’ form, if you move the ‘test’ "argument"
to separate lines, then it yields:

(with-html
 (:div.name1
  test
  (:div.name2 
   test
   (:div.name3 
    test
    (:div.name4 
     test
     (:div.name5 test))))))

which you might find acceptable.  These results are from
Emacs 30.2, started from ‘emacs -Q’.

-- 
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.