Subject: bug#76985: Invert when symbol syntax class is used for ##

From: Stefan Monnier <[email-masked]>
Date: Wed, 12 Mar 2025 18:15:14 -0400

> The `llama' package uses the `##' symbol and encourages not putting any
> space in between that and the following symbol.
>
> Since it was added three years ago, `elisp-mode-syntax-propertize'
> explicitly assigns the symbol syntax class to "##", which means that
> code that relies on the syntax alone (such as complete-symbol), thinks
> that ##foo is one symbol, when that are actually two symbols ## and foo.

Do you have specific behaviors w.r.t highlighting, navigation, or
indentation, that matter specifically?

To be "technically" more correct, I suspect `##` in code should be treated
in the syntax tables as some kind of "pair of an open-paren-like thingy
and close-paren-like thingy", so that navigation with M-C-f over `##foo`
skips it in two steps.

I suspect this will lead to indentation that's different from the
one you'd prefer, e.g.

    (list (##foo
             bar)
          (##foo bar
             baz))

instead of

    (list (##foo
           bar)
          (##foo bar
                 baz))

But I think this is specific to llama's use of ## so ideally, we'd fix
that on the `llama.el` side with some `list-indent-function` magic.

> For some reason [1: 6ccc4b6bc8a] limited assigning symbol syntax for ##
> to when that appears in code.  I propose we do the opposite: do NOT use
> symbol syntax in code, but DO use symbol syntax in strings and comments.
> Do the latter so that `##' is highlighted like other symbols would, when
> quoted like that.

Sounds good to me.  I think we left ## untouched in text/comments
because we assumed that ## in comments would usually not represent ELisp
code but something else.  With the use of ## for llama, this presumption
does not seem valid any more.

        Stefan