From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55716: 29.0.50; latex-mode overrides my `comment-style` choice Date: Tue, 31 May 2022 14:54:40 -0400 Message-ID: References: <87bkveanfi.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17936"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55716@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 31 20:55:13 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw71N-0004UE-Dp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 May 2022 20:55:13 +0200 Original-Received: from localhost ([::1]:57126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nw71M-0006de-FE for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 May 2022 14:55:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nw71D-0006cZ-0T for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 14:55:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nw71C-0002wR-Nh for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 14:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nw71C-000784-L3 for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 14:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 May 2022 18:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55716 X-GNU-PR-Package: emacs Original-Received: via spool by 55716-submit@debbugs.gnu.org id=B55716.165402329527387 (code B ref 55716); Tue, 31 May 2022 18:55:02 +0000 Original-Received: (at 55716) by debbugs.gnu.org; 31 May 2022 18:54:55 +0000 Original-Received: from localhost ([127.0.0.1]:48912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nw714-00077f-TY for submit@debbugs.gnu.org; Tue, 31 May 2022 14:54:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nw70z-00077O-64 for 55716@debbugs.gnu.org; Tue, 31 May 2022 14:54:53 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 42C30442C4B; Tue, 31 May 2022 14:54:43 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D63274403A5; Tue, 31 May 2022 14:54:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1654023281; bh=nb7/n/HP00rde7SFUtLdxDQhkpep7MYMjS3bZFmQJxU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=AeCrPeBVl2ROvoIq+D3C6mVdqYQk3NqP4bAZmbiHv1qeKC+FJtRabeK2b1l0V5QHJ w9CYy0eohA5YbxSIFh58PR9/IgS7vXD+vq8re3ptDNUMCNP8gqvV4/OzATGScde8qi iKXKSZPm17hW/jF/61bWyTxaS9NgUZBwfCF+8aYEyXMzqG6ZFTucIAlR9tRsl7Kt5R wXDY5GtaC8meU2mSNANDM1elCEBYAdkXG71fioydWmwo8HxAKF2vCXPI4LqVCVPY50 qooayYiuKz4jvEzQ3sn1n7EmTibMKeMSDYRpxUzlOwYKcx9gEwJeBqFUdw+YG+dPTV blzh0fW9Uzgrg== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 90D3E120371; Tue, 31 May 2022 14:54:41 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Tue, 31 May 2022 08:26:16 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233454 Archived-At: > Yes, it's a new problem introduced by the new functionality of > commenting out empty lines (and it probably affects more than just the > `indent` style, since most styles (other than `plain`) try to indent the > comment, IIRC). I suspect that the patch below would fix it. Stefan diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 95adf9f90a1..ebf4357f4fe 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1177,6 +1177,10 @@ comment-region-internal (setq max-indent (max max-indent (current-column))) (not (or (eobp) (progn (forward-line) nil))))) + ;; In case there's only whitespace, we could try to look at + ;; surrounding text for inspiration, but we'll just use 0 instead. + (when (eq min-indent (point-max)) (setq min-indent 0)) + (setq max-indent (+ max-indent (max (length cs) (length ccs)) ;; Inserting ccs can change max-indent by (1- tab-width) @@ -1297,9 +1301,9 @@ comment-region-default-1 ;; In Lisp and similar modes with one-character comment starters, ;; double it by default if `comment-add' says so. ;; If it isn't indented, triple it. - (if (and (null arg) (not multi-char)) - (setq numarg (* comment-add (if triple 2 1))) - (setq numarg (1- (prefix-numeric-value arg)))) + (setq numarg (if (and (null arg) (not multi-char)) + (* comment-add (if triple 2 1)) + (1- (prefix-numeric-value arg)))) (comment-region-internal beg end