GNU bug report logs - #79734
31.0.50; c-toggle-comment-style prevents elisp fontification in emacs-lisp mode and org-mode.

Previous Next

Package: emacs;

Reported by: ana <at> kigoth.pink

Date: Fri, 31 Oct 2025 06:30:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 79734 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79734; Package emacs. (Fri, 31 Oct 2025 06:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to ana <at> kigoth.pink:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 31 Oct 2025 06:30:03 GMT) Full text and rfc822 format available.

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

From: ana <at> kigoth.pink
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 31.0.50;
 c-toggle-comment-style prevents elisp fontification in emacs-lisp
 mode and org-mode.
Date: Fri, 31 Oct 2025 06:28:34 +0000
I am not subscribed to the list, please REPLY-ALL.

Heya,
While updating my cc-mode config, I added the submodes to my use-package
declaration, i.e, I added, amongst other things :
:config
(c-toggle-comment-style 1) ; Minor mode, commands insert block comments instead of line comments by default
(c-toggle-auto-newline 1) ; Minor mode on, this also enable electric.
(c-toggle-auto-hungry-state -1) ; Minor mode off, instead of using the minor, use C-c C-d and C-c C-DEL.
(subword-mode 1) ; Minor mode on, makes commands on words consider capitalization. M-f PascalCase = goes to Case instead of the end of PascalCase.

However, after Restarting, org-mode wouldn't fontify elisp src blocks, and code in elisp mode (namely, my init.el and code in scratch), were not fontified.

Reading *Messages* we have :
In init.org : "Org mode fontification error",
In init.el :  "Error during redisplay: (jit-lock-function 1) signaled (args-out-of-range "" 0 1)"

After commenting out all of my recent changes to see the cause, I concluded that the issue stems from "(c-toggle-comment-style 1)".
I tried to give it other values (-2, -1, 0, 1, t, nil). But none worked.
However, commenting the line away was enough to bring back the fontification

I also tried this on my gentoo, 31.0.50 on a head from this month and ran into the same issue.
I tried rebuilding emacs but it segfaults on cc-engine.el ATM, so this may have been fixed already, I cannot try.

org-version : 9.7.11
c-version : 5.35.2

In GNU Emacs 31.0.50 (build 1, aarch64-unknown-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2025-05-15 built on ana
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Ubuntu 24.04.3 LTS

Configured using:
 'configure --with-libsystemd --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars --with-pop=yes
 --without-gconf --with-mailutils --enable-autodepend
 --enable-gtk-deprecation-warnings --enable-check-lisp-object-type
 --with-modules --with-tree-sitter --with-sound=alsa 'CFLAGS=-g -O2
 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 -fstack-protector-strong -fstack-clash-protection -Wformat
 -Werror=format-security -mbranch-protection=standard'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=3'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM
XRANDR GTK3 ZLIB




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79734; Package emacs. (Fri, 31 Oct 2025 07:34:04 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: ana <at> kigoth.pink
Cc: 79734 <at> debbugs.gnu.org
Subject: Re: bug#79734: 31.0.50;
 c-toggle-comment-style prevents elisp fontification in emacs-lisp
 mode and org-mode.
Date: Fri, 31 Oct 2025 09:32:43 +0200
> Date: Fri, 31 Oct 2025 06:28:34 +0000
> From: ana--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I am not subscribed to the list, please REPLY-ALL.
> 
> Heya,
> While updating my cc-mode config, I added the submodes to my use-package
> declaration, i.e, I added, amongst other things :
> :config
> (c-toggle-comment-style 1) ; Minor mode, commands insert block comments instead of line comments by default
> (c-toggle-auto-newline 1) ; Minor mode on, this also enable electric.
> (c-toggle-auto-hungry-state -1) ; Minor mode off, instead of using the minor, use C-c C-d and C-c C-DEL.
> (subword-mode 1) ; Minor mode on, makes commands on words consider capitalization. M-f PascalCase = goes to Case instead of the end of PascalCase.
> 
> However, after Restarting, org-mode wouldn't fontify elisp src blocks, and code in elisp mode (namely, my init.el and code in scratch), were not fontified.
> 
> Reading *Messages* we have :
> In init.org : "Org mode fontification error",
> In init.el :  "Error during redisplay: (jit-lock-function 1) signaled (args-out-of-range "" 0 1)"
> 
> After commenting out all of my recent changes to see the cause, I concluded that the issue stems from "(c-toggle-comment-style 1)".
> I tried to give it other values (-2, -1, 0, 1, t, nil). But none worked.
> However, commenting the line away was enough to bring back the fontification
> 
> I also tried this on my gentoo, 31.0.50 on a head from this month and ran into the same issue.
> I tried rebuilding emacs but it segfaults on cc-engine.el ATM, so this may have been fixed already, I cannot try.
> 
> org-version : 9.7.11
> c-version : 5.35.2

Thanks.  However, I cannot reproduce this outside of Org, so
please report this to Org developers first.  If they decide this is a
core Emacs issue, they will tell us, together with a recipe which
would reproduce the problem without using Org.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79734; Package emacs. (Sun, 02 Nov 2025 07:22:02 GMT) Full text and rfc822 format available.

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

From: ana <at> kigoth.pink
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79734 <at> debbugs.gnu.org
Subject: Re: bug#79734: 31.0.50;
 c-toggle-comment-style prevents elisp fontification in emacs-lisp mode and
 org-mode.
Date: Sun, 02 Nov 2025 07:21:21 +0000
> Thanks. However, I cannot reproduce this outside of Org, so
> please report this to Org developers first. If they decide this is a
> core Emacs issue, they will tell us, together with a recipe which
> would reproduce the problem without using Org.

I do not think this is an org-only issue, using this .emacs (no org, no tangling, I made sure to remove the init.el, etc.)
```
;; -*- lexical-binding: t; -*-
(use-package cc-mode
  :ensure nil
  :config
  (c-toggle-comment-style 1))
```
I am able to reproduce, the bug. 
Simply boot emacs with the init above and go to any .el, the fontification is not present.

Interestingly enough, the following .emacs doesn't break fontification :
```
;; -*- lexical-binding: t; -*-
(setq c-toggle-comment-style 1)
```





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79734; Package emacs. (Sun, 02 Nov 2025 08:11:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: ana <at> kigoth.pink, Alan Mackenzie <acm <at> muc.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 79734 <at> debbugs.gnu.org
Subject: Re: bug#79734: 31.0.50;
 c-toggle-comment-style prevents elisp fontification in emacs-lisp mode and
 org-mode.
Date: Sun, 02 Nov 2025 10:10:35 +0200
> Date: Sun, 02 Nov 2025 07:21:21 +0000
> From: ana <at> kigoth.pink
> Cc: 79734 <at> debbugs.gnu.org
> 
> > Thanks. However, I cannot reproduce this outside of Org, so
> > please report this to Org developers first. If they decide this is a
> > core Emacs issue, they will tell us, together with a recipe which
> > would reproduce the problem without using Org.
> 
> I do not think this is an org-only issue, using this .emacs (no org, no tangling, I made sure to remove the init.el, etc.)
> ```
> ;; -*- lexical-binding: t; -*-
> (use-package cc-mode
>   :ensure nil
>   :config
>   (c-toggle-comment-style 1))
> ```
> I am able to reproduce, the bug. 
> Simply boot emacs with the init above and go to any .el, the fontification is not present.

From where I stand, that's a cockpit error: you are invoking
c-toggle-comment-style in a buffer that is not under CC Mode, but
under Emacs Lisp mode.  Just don't do that.  If you invoke
c-toggle-comment-style from a buffer under CC Mode, it has no such
effect.

I'm adding Alan and Stefan to the discussion, in case they see
something to fix here, but my tendency is to close this as not a bug.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79734; Package emacs. (Mon, 03 Nov 2025 13:02:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ana <at> kigoth.pink, acm <at> muc.de, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 79734 <at> debbugs.gnu.org
Subject: Re: bug#79734: 31.0.50; c-toggle-comment-style prevents elisp
 fontification in emacs-lisp mode and org-mode.
Date: Mon, 3 Nov 2025 13:01:13 +0000
Hello, Ana and Eli

On Sun, Nov 02, 2025 at 10:10:35 +0200, Eli Zaretskii wrote:
> > Date: Sun, 02 Nov 2025 07:21:21 +0000
> > From: ana <at> kigoth.pink
> > Cc: 79734 <at> debbugs.gnu.org

> > > Thanks. However, I cannot reproduce this outside of Org, so
> > > please report this to Org developers first. If they decide this is a
> > > core Emacs issue, they will tell us, together with a recipe which
> > > would reproduce the problem without using Org.

> > I do not think this is an org-only issue, using this .emacs (no org, no tangling, I made sure to remove the init.el, etc.)
> > ```
> > ;; -*- lexical-binding: t; -*-
> > (use-package cc-mode
> >   :ensure nil
> >   :config
> >   (c-toggle-comment-style 1))
> > ```
> > I am able to reproduce, the bug. 
> > Simply boot emacs with the init above and go to any .el, the fontification is not present.

> >From where I stand, that's a cockpit error: you are invoking
> c-toggle-comment-style in a buffer that is not under CC Mode, but
> under Emacs Lisp mode.  Just don't do that.  If you invoke
> c-toggle-comment-style from a buffer under CC Mode, it has no such
> effect.

> I'm adding Alan and Stefan to the discussion, in case they see
> something to fix here, but my tendency is to close this as not a bug.

Just to say that what Ana probably wants (untested) is the following in
her/his initialisation file:

(defun my-comment-style ()
  (c-toggle-comment-style 1))

(add-hook 'c-mode-common-hook #'my-comment-style)

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 2 days ago.

Previous Next


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