bug#41965: 26.3; weird behaviour of 'scroll-down-line'

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#41965: 26.3; weird behaviour of 'scroll-down-line'

cage
Hi!

I got  a strange issue  with the command  mentioned in the  subject, not
sure it  is an actual  bug but seems at  least an inconsistency  in this
command.

to reproduce this issue

1. paste the following code in a buffer:

-----8<----8<---------8<----8<----
(let ((prefix-first " \n")
        (stopper      "\n"))
    (list 'face 'default 'display
          (concat prefix-first
                  (propertize "foo"
                              'face '(:background "red" :foreground "yellow"))
                  stopper))))

(defun scroll-note ()
  (add-text-properties 31 32 (scroll-note-property)))

(scroll-note)
-----8<----8<---------8<----8<----

2. move the cursor at the beginning of the buffer (position 1)

3. eval the buffer's content
   - a "note" 'foo' with red background should be shown on the second
   line (as a display property of the first newline character)

4. M-x scroll-up-line -> scroll up two lines (i.e. jump to line 3
   starting from 1)

5. M-x scroll-down-line -> scroll down one line (i.e. jump to line 2
   starting from 1) and get stuck there, any subsequent call to
   scroll-down-line does nothing and the line 1 is never shown
   (using that command)

for context, this is related to the package annotate.el

Thank you!
C.

In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2020-05-17, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
user-error: Beginning of history; no preceding item
user-error: End of history; no default available
Making completion list...
user-error: Beginning of history; no preceding item
Making completion list... [2 times]
user-error: Beginning of history; no preceding item

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-mHAik2/emacs-26.3+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: it_IT.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

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 dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec 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 ffap thingatpt
url-parse auth-source cl-seq eieio byte-opt bytecomp byte-compile cconv
eieio-core cl-macs gv eieio-loaddefs cl-loaddefs cl-lib password-cache
url-vars 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 threads 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 103678 6591)
 (symbols 48 21169 1)
 (miscs 40 46 166)
 (strings 32 30831 944)
 (string-bytes 1 812929)
 (vectors 16 15798)
 (vector-slots 8 519276 9326)
 (floats 8 52 69)
 (intervals 56 317 8)
 (buffers 992 14))



Reply | Threaded
Open this post in threaded view
|

bug#41965: 26.3; weird behaviour of 'scroll-down-line'

Eli Zaretskii
> Date: Sat, 20 Jun 2020 13:36:18 +0200
> From: cage <[hidden email]>
>
> 1. paste the following code in a buffer:
>
> -----8<----8<---------8<----8<----
> (let ((prefix-first " \n")
>         (stopper      "\n"))
>     (list 'face 'default 'display
>           (concat prefix-first
>                   (propertize "foo"
>                               'face '(:background "red" :foreground "yellow"))
>                   stopper))))
>
> (defun scroll-note ()
>   (add-text-properties 31 32 (scroll-note-property)))
>
> (scroll-note)
> -----8<----8<---------8<----8<----

Thanks, but I couldn't use this recipe to try to reproduce the
problem.  First there are too many closing parentheses after
"stopper".  More importantly, I cannot find the function
scroll-note-property in Emacs, and no package called annotate.el.

So it seems like some details are missing from the recipe.



Reply | Threaded
Open this post in threaded view
|

bug#41965: 26.3; weird behaviour of 'scroll-down-line'

Eli Zaretskii
[Please use Reply All to keep the bug address on the CC line.]

> Date: Sat, 20 Jun 2020 20:48:10 +0200
> From: cage <[hidden email]>
>
> > Thanks, but I couldn't use this recipe to try to reproduce the
> > problem.  First there are too many closing parentheses after
> > "stopper".  More importantly, I cannot find the function
> > scroll-note-property in Emacs, and no package called annotate.el.
> >
> > So it seems like some details are missing from the recipe.
>
> I am deeply sorry, i missed a line from the original code! :(
>
> this is the correct one (or so I hope! ;-)):
>
> -----8<----8<---------8<----8<----
>
> (defun scroll-note-property ()
>   (let ((prefix-first " \n")
>         (stopper      "\n"))
>     (list 'face 'default 'display
>           (concat prefix-first
>                   (propertize "foo"
>                               'face '(:background "red" :foreground "yellow"))
>                   stopper))))
>
> (defun scroll-note ()
>   (add-text-properties 31 32 (scroll-note-property)))
>
> (scroll-note)
>
> -----8<----8<---------8<----8<----

OK, now I see what you see.

However, this is the expected behavior: Emacs cannot display a window
with the window-start position inside a display property.  If you
trick Emacs into doing that, you get what you describe.

Instead of "M-x scroll-down-line RET", you need to scroll 2 lines at
that point, as in "C-u 2 M-x scroll-down-line RET".  You need to make
the window start before the display property.

This is not a bug, just a known limitation of the current display
code.



Reply | Threaded
Open this post in threaded view
|

bug#41965: 26.3; weird behaviour of 'scroll-down-line'

cage
On Sat, Jun 20, 2020 at 09:59:47PM +0300, Eli Zaretskii wrote:

Hi Eli!

> [Please use Reply All to keep the bug address on the CC line.]

Sorry, again!

[...]

>
> OK, now I see what you see.
>
> However, this is the expected behavior: Emacs cannot display a window
> with the window-start position inside a display property.  If you
> trick Emacs into doing that, you get what you describe.
>
> Instead of "M-x scroll-down-line RET", you need to scroll 2 lines at
> that point, as in "C-u 2 M-x scroll-down-line RET".

Yes, that's what a clever user of annotate.el actually did! :)

> You need to make
> the window start before the display property.
>
> This is not a bug, just a known limitation of the current display
> code.

Thank you for  clarifying this, i suspected this could  not actually a
bug but  i needed  some more information  from people  with experience
with the Emacs internals to be sure what was happening.

Thank you again for your kind and quick reply and for your work! :)

Bye!
C.