Subject: Re: bug#43835: 28.0.50; auto-hscroll-mode/current-line + show-paren-mode + gnus-summary-mode = bug

From: Stephen Berman <[email-masked]>
Date: Thu, 08 Oct 2020 10:39:38 +0200

On Thu, 08 Oct 2020 11:22:38 +0300 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: [email-masked]
>> Date: Wed, 07 Oct 2020 22:54:51 +0200
>>
>> 0. emacs -Q
>> 1. Evaluate the following sexp:
>>
>> (let ((buf (get-buffer-create "*test*")))
>>   (with-current-buffer buf
>>     (setq auto-hscroll-mode 'current-line
>> 	  truncate-lines t
>> 	  bidi-paragraph-direction 'left-to-right)
>>     (insert "Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument (this is a test)\n")
>>     (goto-char (point-min)))
>>   (show-paren-mode)
>>   (switch-to-buffer buf))
>>
>> 2. Now typing `C-e' shows the problem.
>
> bidi-paragraph-direction is set to left-to-right in any descendant of
> prog-mode, in particular in Emacs Lisp mode.  And yet I couldn't
> reproduce this in a Lisp buffer, no matter what I tried.  So that
> setting is not the only cause.

Strange, because when I replace the above sexp in step 1 by the
following, I see the same problem at step 2:

(let ((buf (get-buffer-create "*test*")))
  (with-current-buffer buf
    (setq auto-hscroll-mode 'current-line
	  truncate-lines t
	  bidi-paragraph-direction 'left-to-right)
    (insert "Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument (this is a test)\n")
    (emacs-lisp-mode)
    (goto-char (point-min)))
  (show-paren-mode)
  (switch-to-buffer buf))

> If you add a line of text before and after the Subject line you insert
> in the recipe, does the problem go away?  It does here.  But then I
> wonder whether this problem only happens in Gnus with the very first
> or the very last line of the summary buffer.  If that's not so, I'm
> probably missing something else.

I think I've only seen this on the last line in a Gnus summary buffer.
This also holds for the new test case (also in Emacs Lisp mode): after
evaluating the following sexp, I see the problem only on the last line:

(let ((buf (get-buffer-create "*test*")))
  (with-current-buffer buf
    (setq auto-hscroll-mode 'current-line
	  truncate-lines t
	  bidi-paragraph-direction 'left-to-right)
    (insert "Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument (this is a test)\nSubject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument (this is a test)\nSubject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument (this is a test)\n")
    (emacs-lisp-mode)
    (goto-char (point-min)))
  (show-paren-mode)
  (switch-to-buffer buf))

Steve Berman