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

Michael Heerdegen via Users list for the GNU Emacs text editor <[email protected]> Mon, 08 Jun 2026 15:29:18 +0200
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Peter Münster <[email protected]> writes:

> On Mon, Jun 08 2026, Michael Heerdegen via Users list for the GNU
> Emacs text editor wrote:
>
> > #+begin_src emacs-lisp
> > (advice-add
> >  'common-lisp-indent-function :after-until
> >  (defun my-common-lisp-indent-function--offset-fallback (indent-point state)
> >    (save-excursion
> >      (goto-char (elt state 1))
> >      (+ (current-column) 2))))
> > #+end_src
> >
> > This would change the algorithm to always do what you want for
> > `with-clog-create'.
>
> Great, thanks!  It seems to work for anything that starts with "(with-".
> How does this work please?
> My understanding is:
>
>   The :after-until advice is for all forms that start with "(with-".
>
> But I cannot believe that.

Good.  Please don't believe it - it's nonsense.

Adding an :after-until advice FUNCTION to OLDFUN replaces OLDFUN with

  (lambda (&rest r) (or (apply OLDFUN r) (apply FUNCTION r)))

So all that my advice does is: whenever `common-lisp-indent-function'
would return nil (which means semantically "dunno, nothing special here,
do the default"), I return an explicit value.  The effect is not
context aware at all!  It changes the "default":

At _every_ place where the algorithm would consult
`common-lisp-indent-function', it would return nil, and the algorithm
would fall back to an indentation like this:

(1)
|  (xxxxx yyyyy
|         zzzzz ...

you will get this

(2)
|  (xxxxx yyyyy
|    zzzzz ...

instead.  Always, unless `common-lisp-indent-function' would handle
`xxxxx' expression specially.  So, the effect is only that the fallback
(1) is replaced with a new fallback (2).  You get it.

And I have no clue (!) if this is always a good idea.  You might find
out it is not (of course we might still be able to tune the idea).  I
just guessed I personally would not like (1) so this idea came to my
mind.

Note that if you ever want to have the behavior to respect more levels
of outside context, you would have to increase
`lisp-indent-maximum-backtracking' accordingly and use a less naïve
approach.


Michael.