unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28003: 26.0.50; Auto fill broken in Message mode
@ 2017-08-07 19:56 Stephen Berman
  2017-08-09  3:33 ` Katsumi Yamaoka
  2017-08-27 16:55 ` bug#28003: done Tom Tromey
  0 siblings, 2 replies; 11+ messages in thread
From: Stephen Berman @ 2017-08-07 19:56 UTC (permalink / raw)
  To: 28003

This change:

commit 9b463fa8648b7baed95a44f4317cb7402fd8bf1c
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Aug 5 18:30:52 2017 -0600

  Respect comment-auto-fill-only-comments
  
  Respect comment-auto-fill-only-comments when auto-filling and a
  comment syntax is defined.
  
  * lisp/newcomment.el (comment-indent-new-line): Do not check
  comment-auto-fill-only-comments.
  * lisp/simple.el (internal-auto-fill): New defun.
  * src/cmds.c (internal_self_insert): Call Qinternal_auto_fill, not
  auto_fill_function.
  (syms_of_cmds): Define Qinternal_auto_fill.

broke auto filling in Message mode; the breakage is due specifically to
this change in comment-indent-new-line:

diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 8772b52376..e3ee4dfab1 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1382,10 +1382,9 @@ comment-indent-new-line
   (interactive)
   (comment-normalize-vars t)
   (let (compos comin)
-    ;; If we are not inside a comment and we only auto-fill comments,
-    ;; don't do anything (unless no comment syntax is defined).
+    ;; If we are not inside a comment don't do anything (unless no
+    ;; comment syntax is defined).
     (unless (and comment-start
-		 comment-auto-fill-only-comments
 		 (not (called-interactively-p 'interactive))
 		 (not (save-excursion
 			(prog1 (setq compos (comment-beginning))

To reproduce:

0. emacs -Q
1. Type `C-x m' to get a Message mode buffer, with a fill-column of 70.
2. Insert at point-max this text (all in one unbroken line):
   This is a test. This is a test. This is a test. This is a test. This is a test. 
3. Point is now in column 79; type SPC.
=> The line is not broken and filled.
4. Delete the last SPC, type `C-a > SPC C-e SPC'.
=> This line is now broken and filled.

Message mode sets "> " and comment-auto-fill-only-comments to nil by
default, but since the above change eliminated checking the latter,
after step 3 the unless condition evaluates to t, so there's no
auto-filling; while after step 4, (comment-beginning) is non-nil, so the
unless condition is nil and auto-filling occurs.

In GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.8)
 of 2017-08-07 built on rosalinde
Repository revision: 14ea76af5f3596d48747c2437006f6e1abcb67a7
Windowing system distributor 'The X.Org Foundation', version 11.0.11901000





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-07 19:56 bug#28003: 26.0.50; Auto fill broken in Message mode Stephen Berman
@ 2017-08-09  3:33 ` Katsumi Yamaoka
  2017-08-09  8:58   ` Stephen Berman
  2017-08-27 16:55 ` bug#28003: done Tom Tromey
  1 sibling, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2017-08-09  3:33 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 28003

On Mon, 07 Aug 2017 21:56:42 +0200, Stephen Berman wrote:
> This change:
[...]
> broke auto filling in Message mode; the breakage is due specifically to
> this change in comment-indent-new-line:

This will probably be no more than a workaround, though.

--- message.el~	2017-08-08 22:08:28.694840400 +0000
+++ message.el	2017-08-09 03:30:33.407170200 +0000
@@ -3451,7 +3451,7 @@
 (defun message-do-auto-fill ()
   "Like `do-auto-fill', but don't fill in message header."
   (unless (message-point-in-header-p)
-    (do-auto-fill)))
+    (let ((comment-start nil)) (do-auto-fill))))
 
 (defun message-insert-signature (&optional force)
   "Insert a signature.  See documentation for variable `message-signature'."





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09  3:33 ` Katsumi Yamaoka
@ 2017-08-09  8:58   ` Stephen Berman
  2017-08-09 12:37     ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2017-08-09  8:58 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Tom Tromey, 28003

On Wed, 09 Aug 2017 12:33:01 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote:

> On Mon, 07 Aug 2017 21:56:42 +0200, Stephen Berman wrote:
>> This change:
> [...]
>> broke auto filling in Message mode; the breakage is due specifically to
>> this change in comment-indent-new-line:
>
> This will probably be no more than a workaround, though.
>
> --- message.el~	2017-08-08 22:08:28.694840400 +0000
> +++ message.el	2017-08-09 03:30:33.407170200 +0000
> @@ -3451,7 +3451,7 @@
>  (defun message-do-auto-fill ()
>    "Like `do-auto-fill', but don't fill in message header."
>    (unless (message-point-in-header-p)
> -    (do-auto-fill)))
> +    (let ((comment-start nil)) (do-auto-fill))))
>  
>  (defun message-insert-signature (&optional force)
>    "Insert a signature.  See documentation for variable `message-signature'."

This change doesn't fix the problem.  I don't know what the motivation
for the change that caused this problem was, so I don't know how to fix
it; cc'ing Tom Tromey, who made the change.

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09  8:58   ` Stephen Berman
@ 2017-08-09 12:37     ` Tom Tromey
  2017-08-09 13:04       ` Stephen Berman
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2017-08-09 12:37 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Katsumi Yamaoka, Tom Tromey, 28003

>>>>> "Stephen" == Stephen Berman <stephen.berman@gmx.net> writes:

Stephen> On Wed, 09 Aug 2017 12:33:01 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote:
>> On Mon, 07 Aug 2017 21:56:42 +0200, Stephen Berman wrote:
>>> This change:
>> [...]
>>> broke auto filling in Message mode; the breakage is due specifically to
>>> this change in comment-indent-new-line:
>> 
>> This will probably be no more than a workaround, though.
>> 
>> --- message.el~	2017-08-08 22:08:28.694840400 +0000
>> +++ message.el	2017-08-09 03:30:33.407170200 +0000
>> @@ -3451,7 +3451,7 @@
>> (defun message-do-auto-fill ()
>> "Like `do-auto-fill', but don't fill in message header."
>> (unless (message-point-in-header-p)
>> -    (do-auto-fill)))
>> +    (let ((comment-start nil)) (do-auto-fill))))
>> 
>> (defun message-insert-signature (&optional force)
>> "Insert a signature.  See documentation for variable `message-signature'."

Stephen> This change doesn't fix the problem.  I don't know what the motivation
Stephen> for the change that caused this problem was, so I don't know how to fix
Stephen> it; cc'ing Tom Tromey, who made the change.

I've been discussing this off-list with another person who ran into this
problem, but I haven't managed to reproduce it myself.

I suspect the newcomment.el change is incorrect and should be reverted.
Could you try that?  The other changes should, I think, remain in place though.

The basic idea of my patch is to make comment-auto-fill-only-comments
work properly.  Without it, setting comment-auto-fill-only-comments and
enabling auto-fill in js-mode will cause auto-filling even when typing a
long line of code, which is clearly incorrect.

thanks,
Tom





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 12:37     ` Tom Tromey
@ 2017-08-09 13:04       ` Stephen Berman
  2017-08-09 14:54         ` Stephen Berman
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2017-08-09 13:04 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Katsumi Yamaoka, Stephen Berman, 28003

On Wed, 09 Aug 2017 06:37:42 -0600 Tom Tromey <tom@tromey.com> wrote:

>>>>>> "Stephen" == Stephen Berman <stephen.berman@gmx.net> writes:
>
> Stephen> On Wed, 09 Aug 2017 12:33:01 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote:
>>> On Mon, 07 Aug 2017 21:56:42 +0200, Stephen Berman wrote:
>>>> This change:
>>> [...]
>>>> broke auto filling in Message mode; the breakage is due specifically to
>>>> this change in comment-indent-new-line:
>>> 
>>> This will probably be no more than a workaround, though.
>>> 
>>> --- message.el~	2017-08-08 22:08:28.694840400 +0000
>>> +++ message.el	2017-08-09 03:30:33.407170200 +0000
>>> @@ -3451,7 +3451,7 @@
>>> (defun message-do-auto-fill ()
>>> "Like `do-auto-fill', but don't fill in message header."
>>> (unless (message-point-in-header-p)
>>> -    (do-auto-fill)))
>>> +    (let ((comment-start nil)) (do-auto-fill))))
>>> 
>>> (defun message-insert-signature (&optional force)
>>> "Insert a signature.  See documentation for variable `message-signature'."
>
> Stephen> This change doesn't fix the problem.  I don't know what the motivation
> Stephen> for the change that caused this problem was, so I don't know how to fix
> Stephen> it; cc'ing Tom Tromey, who made the change.
>
> I've been discussing this off-list with another person who ran into this
> problem, but I haven't managed to reproduce it myself.

Strange; you did try the recipe of my OP?  That shows the problem for me
every time (with emacs -Q and well as with my initializations).  But see
below...

> I suspect the newcomment.el change is incorrect and should be reverted.
> Could you try that?  The other changes should, I think, remain in place though.

Yes, restoring the variable comment-auto-fill-only-comments in
comment-indent-new-line restores auto-filling in Message mode.

> The basic idea of my patch is to make comment-auto-fill-only-comments
> work properly.  Without it, setting comment-auto-fill-only-comments and
> enabling auto-fill in js-mode will cause auto-filling even when typing a
> long line of code, which is clearly incorrect.

I haven't looked at js-mode, but it seems strange that setting
comment-auto-fill-only-comments to t there does auto-filling of
non-commented lines...

This prompted me to look closer at Katsumi Yamaoka's patch above, and it
turns out that message-do-auto-fill is not being called, although it is
the value of normal-auto-fill-function in the Message mode buffer I'm
typing in right now; instead, the default value do-auto-fill is called.
When you try my recipe is message-do-auto-fill being used?  That may
explain why you can't reproduce the problem.  I have no idea why
message-do-auto-fill isn't being called here...

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 13:04       ` Stephen Berman
@ 2017-08-09 14:54         ` Stephen Berman
  2017-08-09 15:41           ` Stephen Berman
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2017-08-09 14:54 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Katsumi Yamaoka, 28003

On Wed, 09 Aug 2017 15:04:56 +0200 Stephen Berman <stephen.berman@gmx.net> wrote:

> This prompted me to look closer at Katsumi Yamaoka's patch above, and it
> turns out that message-do-auto-fill is not being called, although it is
> the value of normal-auto-fill-function in the Message mode buffer I'm
> typing in right now; instead, the default value do-auto-fill is called.
> When you try my recipe is message-do-auto-fill being used?  That may
> explain why you can't reproduce the problem.  I have no idea why
> message-do-auto-fill isn't being called here...

It's not being called because internal-auto-fill calls do-auto-fill
instead of funcalling auto-fill-function.  But changing it to do the
latter makes no difference, since message-do-auto-fill also calls
do-auto-fill, unless point is on a message header.  (So it's still a
mystery to me why you can't reproduce the problem...)

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 14:54         ` Stephen Berman
@ 2017-08-09 15:41           ` Stephen Berman
  2017-08-09 22:08             ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2017-08-09 15:41 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Katsumi Yamaoka, Tom Tromey, 28003

On Wed, 09 Aug 2017 16:54:27 +0200 Stephen Berman <stephen.berman@gmx.net> wrote:

> On Wed, 09 Aug 2017 15:04:56 +0200 Stephen Berman <stephen.berman@gmx.net> wrote:
>
>> This prompted me to look closer at Katsumi Yamaoka's patch above, and it
>> turns out that message-do-auto-fill is not being called, although it is
>> the value of normal-auto-fill-function in the Message mode buffer I'm
>> typing in right now; instead, the default value do-auto-fill is called.
>> When you try my recipe is message-do-auto-fill being used?  That may
>> explain why you can't reproduce the problem.  I have no idea why
>> message-do-auto-fill isn't being called here...
>
> It's not being called because internal-auto-fill calls do-auto-fill
> instead of funcalling auto-fill-function.  But changing it to do the
> latter makes no difference, since message-do-auto-fill also calls
> do-auto-fill, unless point is on a message header.  (So it's still a
> mystery to me why you can't reproduce the problem...)

Well, I'm a bit slow today, but making internal-auto-fill funcall
auto-fill-function together with Yamaoka-san's patch does restore
auto-filling to non-comment lines in Message mode; though I can't judge
whether that's the right fix.

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 15:41           ` Stephen Berman
@ 2017-08-09 22:08             ` Tom Tromey
  2017-08-09 23:06               ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2017-08-09 22:08 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Katsumi Yamaoka, Tom Tromey, 28003

>>>>> "Stephen" == Stephen Berman <stephen.berman@gmx.net> writes:

Stephen> Well, I'm a bit slow today, but making internal-auto-fill funcall
Stephen> auto-fill-function together with Yamaoka-san's patch does restore
Stephen> auto-filling to non-comment lines in Message mode; though I can't judge
Stephen> whether that's the right fix.

Yes, I think so.  I found a way to reproduce the bug (thanks to Yuri
D'Elia) and I am going to push the fix now.

Tom





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 22:08             ` Tom Tromey
@ 2017-08-09 23:06               ` Katsumi Yamaoka
  2017-08-10  8:07                 ` Stephen Berman
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2017-08-09 23:06 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Stephen Berman, 28003

On Wed, 09 Aug 2017 16:08:31 -0600, Tom Tromey wrote:
> Yes, I think so.  I found a way to reproduce the bug (thanks to Yuri
> D'Elia) and I am going to push the fix now.

Works in the message mode as before.  Thank you!





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: 26.0.50; Auto fill broken in Message mode
  2017-08-09 23:06               ` Katsumi Yamaoka
@ 2017-08-10  8:07                 ` Stephen Berman
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Berman @ 2017-08-10  8:07 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Tom Tromey, 28003

On Thu, 10 Aug 2017 08:06:23 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote:

> On Wed, 09 Aug 2017 16:08:31 -0600, Tom Tromey wrote:
>> Yes, I think so.  I found a way to reproduce the bug (thanks to Yuri
>> D'Elia) and I am going to push the fix now.
>
> Works in the message mode as before.  Thank you!

Works again for me, too; thanks.

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#28003: done
  2017-08-07 19:56 bug#28003: 26.0.50; Auto fill broken in Message mode Stephen Berman
  2017-08-09  3:33 ` Katsumi Yamaoka
@ 2017-08-27 16:55 ` Tom Tromey
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2017-08-27 16:55 UTC (permalink / raw)
  To: 28003-done

The fix was checked in a while ago.

Tom





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-08-27 16:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 19:56 bug#28003: 26.0.50; Auto fill broken in Message mode Stephen Berman
2017-08-09  3:33 ` Katsumi Yamaoka
2017-08-09  8:58   ` Stephen Berman
2017-08-09 12:37     ` Tom Tromey
2017-08-09 13:04       ` Stephen Berman
2017-08-09 14:54         ` Stephen Berman
2017-08-09 15:41           ` Stephen Berman
2017-08-09 22:08             ` Tom Tromey
2017-08-09 23:06               ` Katsumi Yamaoka
2017-08-10  8:07                 ` Stephen Berman
2017-08-27 16:55 ` bug#28003: done Tom Tromey

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).