GNU bug report logs - #35659
26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.

Previous Next

Package: emacs;

Reported by: clemera <clemera <at> posteo.net>

Date: Thu, 9 May 2019 19:59:02 UTC

Severity: wishlist

Found in version 26.1

To reply to this bug, email your comments to 35659 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#35659; Package emacs. (Thu, 09 May 2019 19:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to clemera <clemera <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 09 May 2019 19:59:02 GMT) Full text and rfc822 format available.

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

From: clemera <clemera <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; Weird horizontal scroll behavior with certain settings for
 `auto-hscroll-mode' and `hscroll-step`.
Date: Thu, 9 May 2019 21:15:26 +0200
Hello,

After starting emacs -Q I set the following settings by evaluating them in *scratch*:

(setq auto-hscroll-mode 'current-line
      hscroll-step 1
      truncate-lines t)

Now after adding a long line right after the above code block (which exceeds the frame width)
go to the end of the long line. The line scrolls as expected but when you go from there to the lines above, those get
pushed to the left. I have recorded a gif which shows the described behavior:

https://imgur.com/a/lJYo4Od


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-01-03 built on clemera
Repository revision: ab525dd6b1c57cee7f26700f9656bb6c76a8ceba
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description:	Ubuntu 18.04.2 LTS

Recent messages:
Making completion list...
nil
t
Mark set [17 times]
funcall-interactively: End of buffer [7 times]
Quit
user-error: Beginning of history; no preceding item
Quit [3 times]
nil
t
Quit
Configured using:
 'configure --with-xft --with-x-toolkit=gtk3 --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LCMS2

Important settings:
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: de_DE.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 98229 13360)
 (symbols 48 20364 1)
 (miscs 40 78 244)
 (strings 32 28371 1265)
 (string-bytes 1 747151)
 (vectors 16 14656)
 (vector-slots 8 497062 7570)
 (floats 8 50 298)
 (intervals 56 551 9)
 (buffers 992 12))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 07:16:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: clemera <clemera <at> posteo.net>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1;
 Weird horizontal scroll behavior with certain settings for
 `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 10:14:45 +0300
tags 35659 notabug
thanks

> From: clemera <clemera <at> posteo.net>
> Date: Thu, 9 May 2019 21:15:26 +0200
> 
> After starting emacs -Q I set the following settings by evaluating them in *scratch*:
> 
> (setq auto-hscroll-mode 'current-line
>       hscroll-step 1
>       truncate-lines t)
> 
> Now after adding a long line right after the above code block (which exceeds the frame width)
> go to the end of the long line. The line scrolls as expected but when you go from there to the lines above, those get
> pushed to the left. I have recorded a gif which shows the described behavior:
> 
> https://imgur.com/a/lJYo4Od

This is the normal behavior of C-n and C-p (UP and DOWN arrow keys):
they try to move into the same column of the next/previous line as the
one of the line you started with.  The rationale is to allow you to
see the same horizontal region in the lines through which you
traverse.  Neither auto-hscroll-mode nor the current-line hscrolling
feature change that basic behavior.

If we were to disable this feature, typing C-n followed by C-p would
not return you back to the same column; you'd need to manually go to
the original column instead.  That'd be an annoyance, I think, as it
would effectively throw away your hscroll each time you move to
another line.

So I don't think there's a bug here.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 10 May 2019 07:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 12:39:02 GMT) Full text and rfc822 format available.

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

From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
To: 35659 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 14:37:59 +0200
> Neither auto-hscroll-mode nor the current-line hscrolling
> feature change that basic behavior.

When I do the described steps with hscroll-step set to 0 I don't get this
behavior. Then it is the way I would like it to be (just go to the end of the previous
line without scrolling it when it doesn't exceeds the window width). 

In my opinion the behavior in the gif is a bug,
the lines which do no exceed the window width should not be scrolled should they?


        Clemens




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 13:04:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clemens Radermacher <clemens.radermacher <at> posteo.de>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 16:02:43 +0300
> Cc: eliz <at> gnu.org
> From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
> Date: Fri, 10 May 2019 14:37:59 +0200
> 
> > Neither auto-hscroll-mode nor the current-line hscrolling
> > feature change that basic behavior.
> 
> When I do the described steps with hscroll-step set to 0 I don't get this
> behavior. Then it is the way I would like it to be (just go to the end of the previous
> line without scrolling it when it doesn't exceeds the window width). 

Then I guess you already have the solution that fits your needs,
right?

> In my opinion the behavior in the gif is a bug,
> the lines which do no exceed the window width should not be scrolled should they?

By default, they are scrolled, exactly as they are when
auto-hscroll-mode is t.  You are saying that the 'current-line' mode
should behave differently because of some different expectations in
that specific case.  That's debatable, but the fact is the code which
implements that mode was never meant to change this basic behavior of
horizontal scrolling.

If someone wants to write code to cater also to the behavior you want
to see, I promise to review it.  But I won't myself work on this, as
this area of the Emacs display is already quite tricky and full of
subtleties.  Sorry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 13:25:02 GMT) Full text and rfc822 format available.

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

From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 15:24:00 +0200
> By default, they are scrolled, exactly as they are when
> auto-hscroll-mode is t.

Thank you for looking into it again! I think you haven't looked closely enough:
This is not the behavior you get with auto-hscroll-mode set to t. 

> Then I guess you already have the solution that fits your needs,
> right?

No, because I would like hscroll-step to be set to 1. But doing that
will lead to the described pushing of lines over the screen (which is what you want
if the lines exceed the window width but not if they are shorter than the window-width!)

I would flag it as a bug because it does not happen with 
hscroll-step set to 0 (the default).
  
> If someone wants to write code to cater also to the behavior you want
> to see, I promise to review it.  But I won't myself work on this, as
> this area of the Emacs display is already quite tricky and full of
> subtleties.  Sorry.

If you don't want to touch that code, I as a newbie won't dare to touch it either ;)



        Clemens




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 13:35:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clemens Radermacher <clemens.radermacher <at> posteo.de>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 16:34:15 +0300
> Cc: 35659 <at> debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
> Date: Fri, 10 May 2019 15:24:00 +0200
> 
> > By default, they are scrolled, exactly as they are when
> > auto-hscroll-mode is t.
> 
> This is not the behavior you get with auto-hscroll-mode set to t. 

Maybe I'm confused: what is the "behavior you get with
auto-hscroll-mode set to t" to which you allude here?

> If you don't want to touch that code, I as a newbie won't dare to touch it either ;)

I definitely don't.  Someone challenged me to provide this "scroll
only the current line" mode in Emacs, so I coded it.  I definitely
don't want to make it messier than it is already.  Still, volunteers
are welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 13:45:02 GMT) Full text and rfc822 format available.

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

From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 15:44:01 +0200
>> > By default, they are scrolled, exactly as they are when
>> > auto-hscroll-mode is t.
>> 
>> This is not the behavior you get with auto-hscroll-mode set to t. 
> 
> Maybe I'm confused: what is the "behavior you get with
> auto-hscroll-mode set to t" to which you allude here?

Sorry, it seems I was wrong. The window stays scrolled for the shorter lines 
here, as well (unless it's an empty one, then the scrolling resets).  

Still I think when the shorter lines don't get pushed around
with hscroll-step 0, it shouldn't happen with hscroll-step set to another value.


>> If you don't want to touch that code, I as a newbie won't dare to touch it either ;)
> 
> I definitely don't.  Someone challenged me to provide this "scroll
> only the current line" mode in Emacs, so I coded it.  I definitely
> don't want to make it messier than it is already.  Still, volunteers
> are welcome.

Thank you for doing it, it's really a great feature and I like it. I guess
I have to live with the default setting for hscroll-step then.

        Clemens




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 14:05:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clemens Radermacher <clemens.radermacher <at> posteo.de>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 17:03:39 +0300
> Cc: 35659 <at> debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
> Date: Fri, 10 May 2019 15:44:01 +0200
> 
> Still I think when the shorter lines don't get pushed around
> with hscroll-step 0, it shouldn't happen with hscroll-step set to another value.

I think the fact that it happens for hscroll-step of zero is "by sheer
luck".  I certainly don't remember explicitly coding that.

> Thank you for doing it, it's really a great feature and I like it. I guess
> I have to live with the default setting for hscroll-step then.

Maybe someone will find an easy fix, volunteers are welcome.  Emacs
really shouldn't depend for its display code development on one old
curmudgeon such as myself...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 14:26:01 GMT) Full text and rfc822 format available.

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

From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 16:25:05 +0200
> I think the fact that it happens for hscroll-step of zero is "by sheer
> luck".  I certainly don't remember explicitly coding that.

Programmers need luck, too ;)

> Maybe someone will find an easy fix, volunteers are welcome.  Emacs
> really shouldn't depend for its display code development on one old
> curmudgeon such as myself...

I had some success with this workaround (ugly but it's enough for my use case):

    (defun my-temporary-change-hscroll (f &rest args)
      (setq hscroll-step 0)
      (apply f args)
      (run-at-time 0.1 nil
                   (lambda ()
                     (setq hscroll-step 1))))

    (advice-add #'previous-line :around 'my-temporary-change-hscroll)
    (advice-add #'next-line :around 'my-temporary-change-hscroll)

I would really like to dig into it but I hardly know any C and I have read several times
that the Emacs code base is reserved for advanced C programmers. Thank you for 
all the work you are doing, Emacs is such a great software!

        Clemens




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Fri, 10 May 2019 15:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clemens Radermacher <clemens.radermacher <at> posteo.de>
Cc: 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Fri, 10 May 2019 18:14:35 +0300
> Cc: 35659 <at> debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher <at> posteo.de>
> Date: Fri, 10 May 2019 16:25:05 +0200
> 
> I have read several times that the Emacs code base is reserved for
> advanced C programmers.

This is definitely not true.  Emacs's C code is not hard to read and
understand, and there are enough people on emacs-devel who will gladly
answer questions regarding why we do things like we do.

> Thank you for all the work you are doing, Emacs is such a great
> software!

You are welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35659; Package emacs. (Tue, 27 Aug 2019 00:07:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Clemens Radermacher <clemens.radermacher <at> posteo.de>, 35659 <at> debbugs.gnu.org
Subject: Re: bug#35659: 26.1; Weird horizontal scroll behavior with certain
 settings for `auto-hscroll-mode' and `hscroll-step`.
Date: Tue, 27 Aug 2019 02:06:33 +0200
[Message part 1 (text/plain, inline)]
tags 35659 - notabug
severity 35659 wishlist
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

> If someone wants to write code to cater also to the behavior you want
> to see, I promise to review it.  But I won't myself work on this, as
> this area of the Emacs display is already quite tricky and full of
> subtleties.  Sorry.

In other words, patches welcome.

I'm attaching for posterity also the gif from the original bug report
(it was only 57 KB).  I hope that's okay.

Thanks,
Stefan Kangas
[bug-35659.gif (image/gif, attachment)]

Removed tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 27 Aug 2019 00:48:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 27 Aug 2019 00:48:02 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 357 days ago.

Previous Next


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