GNU bug report logs - #77823
31.0.50; M-j regression since commit 4c6b1712a4d

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Tue, 15 Apr 2025 11:29:02 UTC

Severity: normal

Found in version 31.0.50

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


Message #42 received at 77823 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: eliz <at> gnu.org, 77823 <at> debbugs.gnu.org,
 Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#77823: 31.0.50; M-j regression since commit 4c6b1712a4d
Date: Sat, 19 Apr 2025 00:41:01 -0400
>  lisp/electric.el                     | 24 ++++++++++++++----------
>  lisp/emacs-lisp/lisp-mode.el         |  3 +--
>  lisp/newcomment.el                   |  9 ++++-----
>  lisp/nxml/nxml-mode.el               |  3 +--
>  lisp/progmodes/c-ts-common.el        |  6 ++----
>  lisp/progmodes/go-ts-mode.el         |  3 +--
>  lisp/progmodes/js.el                 |  3 +--
>  lisp/progmodes/json-ts-mode.el       |  3 +--
>  lisp/progmodes/lua-ts-mode.el        |  3 +--
>  lisp/progmodes/opascal.el            |  3 +--
>  lisp/progmodes/pascal.el             |  3 +--
>  lisp/progmodes/typescript-ts-mode.el |  3 +--
>  lisp/textmodes/css-mode.el           |  5 +----
>  lisp/textmodes/sgml-mode.el          |  3 +--
>  14 files changed, 31 insertions(+), 43 deletions(-)

IIRC, the recent changes also added setting to
`block-comment-start/end` in CC-modes, so there may need to be more reversals.

>  (define-minor-mode electric-block-comment-mode
>    "Toggle automatic closing of block comments (Electric Block Comment mode).
>  
> +When enabled, typing the beginning of a block comment closes it inserting their
> +corresponding block comment end."

So, IIUC what is meant by "block comment" here is a comment that's not
closed by the next EOL but by some other sequence of characters.

Interesting cases to consider:

- In SNMP mode, IIRC, comments take the shape of

       -- a comment --

  so you have to check `syntax-ppss` to figure out if the `--` that was
  just inserted was a comment starter or ender.

- In OPascal mode there is more than one kind of "block
  comment":

        { a comment }
        (* another comment *)
        /* yet another comment */

  so your `electric-block-comments` should probably support not just
  a single pair but a list of pairs.

- It might make sense to extend this to related constructs and/or to
  merge it into `electric-pair-mode`.
  By related constructs, I'm thinking of things like [OCaml's
  quotations](https://caml.inria.fr/pub/docs/tutorial-camlp4/tutorial004.html)
  that take the form `<:FOO<...>>` or [OCaml's quoted
  strings](https://ocaml.org/manual/5.2/lex.html#quoted-string-id)
  that look like `{FOO|...|FOO}`.


        Stefan





This bug report was last modified 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.