Subject: 27.2; M-j broken when comment-auto-fill-only-comments is non-nil

From: Peter Jones <[email-masked]>
Date: Tue, 03 Aug 2021 09:22:24 -0700

When inside a comment, M-j will insert a newline then the
`comment-start' marker so you can continue writing a comment.  However,
if `comment-auto-fill-only-comments' is non-nil, M-j will insert a
newline but not `comment-start'.

To reproduce, in a fresh emacs -Q:

(progn
  (switch-to-buffer "*scratch*")
  (end-of-buffer)
  (insert "; ") ; one or more spaces after comment-start
  (setq comment-auto-fill-only-comments t)
  (default-indent-new-line) ; M-j
  (beginning-of-line)
  (cl-assert (looking-at-p ";")))

This assertion fails.  However, if you set
`comment-auto-fill-only-comments' to nil it will succeeded.

This behavior is exhibited regardless of the major mode.

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: NixOS 21.05 (Okapi)

Configured using:
 'configure
 --prefix=/nix/store/mf19iryz00nbykkfb8whyhx6ia7mb39y-emacs-27.2
 --disable-build-details --with-modules --with-x-toolkit=gtk3 --with-xft
 --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER GMP

Major mode: Emacs-Lisp