unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
@ 2021-01-03 16:14 Amin Bandali
  2021-01-03 17:30 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Amin Bandali @ 2021-01-03 16:14 UTC (permalink / raw)
  To: 45628

As the Subject says, scrolling using the mouse wheel on the echo area
causes Emacs to freeze/lock up (cursor is changed to spinning circle),
when pixel-scroll-mode is enabled.

I can reproduce in emacs -Q after evaluating the following in *scratch*:

(require 'pixel-scroll)
(pixel-scroll-mode 1)

In GNU Emacs 28.0.50 (build 17, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.10, Xaw3d scroll bars)
 of 2021-01-03 built on trisquel
Repository revision: 825b4ec338e82869dc656c7041ab2483b6c22479
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Trisquel GNU/Linux Etiona (9.0)

Configured using:
 'configure --without-gconf --without-gsettings --without-gpm
 --with-x-toolkit=lucid --with-xaw3d --with-mailutils'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  yas-global-mode: t
  yas-minor-mode: t
  global-hl-todo-mode: t
  hl-todo-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  recentf-mode: t
  display-battery-mode: t
  display-time-mode: t
  save-place-mode: t
  savehist-mode: t
  show-paren-mode: t
  icomplete-mode: t
  fido-mode: t
  server-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow orgalist org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs flyspell ispell emacsbug vc-git diff-mode sort smiley
ansi-color gnus-cite mail-extr gnus-async gnus-bcklg gnus-draft gnus-ml
gnus-topic nndraft nnmh gnutls utf-7 epa-file network-stream nsm
nnfolder nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp
gnus-cache ebdb-gnus gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win ebdb-message
sendmail message rmc puny dired-x dired dired-loaddefs rfc822 mml
mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 gmm-utils mailheader ebdb-mua ebdb-com crm
ebdb-format ebdb mailabbrev eieio-opt speedbar ezimage dframe find-func
eieio-base cal-menu calendar cal-loaddefs timezone gnus nnheader
gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr boxquote
rect yasnippet hl-todo pcase disp-table page-break-lines easy-mmode
delight recentf tree-widget wid-edit format-spec battery dbus time xml
finder-inf info package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse auth-source password-cache json subr-x map
url-vars cl-extra help-mode saveplace savehist paren bandali-erc
bandali-ebdb bandali-message bandali-gnus bandali-dired bandali-ibuffer
ibuf-macs bandali-eshell icomplete bandali-org bandali-exwm exwm-edit
exwm-systemtray xcb-systemtray xcb-xembed exwm-randr xcb-randr
exwm-config ido seq exwm exwm-input xcb-keysyms xcb-xkb exwm-manage
exwm-floating xcb-cursor xcb-render exwm-layout exwm-workspace exwm-core
easymenu xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types cl-seq xcb-debug
eieio byte-opt bytecomp byte-compile cconv eieio-core eieio-loaddefs
server edmacro kmacro advice winner ring autorevert filenotify cl-macs
gv cl-loaddefs cl-lib iso-transl 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 tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer 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 cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 332287 11838)
 (symbols 48 35073 4)
 (strings 32 103624 4194)
 (string-bytes 1 3551705)
 (vectors 16 68136)
 (vector-slots 8 1025323 12351)
 (floats 8 392 338)
 (intervals 56 825 0)
 (buffers 984 11))





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

* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
  2021-01-03 16:14 bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs Amin Bandali
@ 2021-01-03 17:30 ` Eli Zaretskii
  2021-01-04  8:57   ` Tak Kunihiro
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2021-01-03 17:30 UTC (permalink / raw)
  To: Amin Bandali, Tak Kunihiro; +Cc: 45628

> From: Amin Bandali <bandali@gnu.org>
> Date: Sun, 03 Jan 2021 11:14:35 -0500
> 
> As the Subject says, scrolling using the mouse wheel on the echo area
> causes Emacs to freeze/lock up (cursor is changed to spinning circle),
> when pixel-scroll-mode is enabled.
> 
> I can reproduce in emacs -Q after evaluating the following in *scratch*:
> 
> (require 'pixel-scroll)
> (pixel-scroll-mode 1)

Thanks.

Tak, can you please look into this?  The code infloops inside
pixel-scroll-down, here:

        (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
          (vertical-motion -1))              ; move point upward

because the mini-window is normally just one screen line high, so its
top and bottom coincide.

Shouldn't we exit the loop when vertical-motion returns zero, which
means it didn't move?

A similar loop exists in pixel-scroll-up, AFAICS.





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

* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
  2021-01-03 17:30 ` Eli Zaretskii
@ 2021-01-04  8:57   ` Tak Kunihiro
  2021-01-04 15:16     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Tak Kunihiro @ 2021-01-04  8:57 UTC (permalink / raw)
  To: 45628, Eli Zaretskii, Amin Bandali; +Cc: 国広卓也

>> As the Subject says, scrolling using the mouse wheel on the echo area
>> causes Emacs to freeze/lock up (cursor is changed to spinning circle),
>> when pixel-scroll-mode is enabled.
> 
> Tak, can you please look into this?  The code infloops inside
> pixel-scroll-down, here:
> 
>        (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
>          (vertical-motion -1))              ; move point upward
> 
> because the mini-window is normally just one screen line high, so its
> top and bottom coincide.
> 
> Shouldn't we exit the loop when vertical-motion returns zero, which
> means it didn't move?
> 
> A similar loop exists in pixel-scroll-up, AFAICS.

Thank you to shoot the problem. 
I confirmed the problem and Eli's suggestion solves it.

I think that following patch would work but usage of `while’
does not look cool.  If there can is better style, please
suggest me.



diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index cc0e159fae..c266c54a06 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -132,8 +132,8 @@ pixel-scroll-up
                    (pixel-line-height))))
         (if (pixel-eob-at-top-p)      ; when end-of-the-buffer is close
             (scroll-up 1)             ; relay on robust method
-          (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
-            (vertical-motion 1))            ; move point downward
+          (while (and (pixel-point-at-top-p amt) ; prevent too late (multi tries)
+                      (equal (vertical-motion 1) 1))) ; move point downward
           (pixel-scroll-pixel-up amt))))))  ; move scope downward
 
 (defun pixel-scroll-down (&optional arg)
@@ -149,8 +149,8 @@ pixel-scroll-down
                          pixel-resolution-fine-flag
                        (frame-char-height))
                    (pixel-line-height -1))))
-        (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
-          (vertical-motion -1))              ; move point upward
+        (while (and (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
+                    (equal (vertical-motion -1) -1))) ; move point upward
         (if (or (pixel-bob-at-top-p amt) ; when beginning-of-the-buffer is seen
                 (pixel-eob-at-top-p))    ; for file with a long line
             (scroll-down 1)              ; relay on robust method





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

* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
  2021-01-04  8:57   ` Tak Kunihiro
@ 2021-01-04 15:16     ` Eli Zaretskii
  2021-01-06  0:47       ` Tak Kunihiro
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2021-01-04 15:16 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: 45628, bandali

> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Mon, 4 Jan 2021 17:57:48 +0900
> Cc: 国広卓也 <tkk@misasa.okayama-u.ac.jp>
> 
> I think that following patch would work but usage of `while’
> does not look cool.  If there can is better style, please
> suggest me.

How about a normal while loop with catch before it and throw inside?

> -          (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
> -            (vertical-motion 1))            ; move point downward
> +          (while (and (pixel-point-at-top-p amt) ; prevent too late (multi tries)
> +                      (equal (vertical-motion 1) 1))) ; move point downward
>            (pixel-scroll-pixel-up amt))))))  ; move scope downward
>  
>  (defun pixel-scroll-down (&optional arg)
> @@ -149,8 +149,8 @@ pixel-scroll-down
>                           pixel-resolution-fine-flag
>                         (frame-char-height))
>                     (pixel-line-height -1))))
> -        (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
> -          (vertical-motion -1))              ; move point upward
> +        (while (and (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
> +                    (equal (vertical-motion -1) -1))) ; move point upward

I think equality to 1 or -1 is too stringent.  vertical-motion could
move more if you have overlay strings or display strings at point that
include embedded newlines.  So I think you should test >= 1 and <= -1
respectively.

Also, I believe this problem exists on the emacs-27 branch as well,
right?  Then we should install there first.

Thanks.





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

* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
  2021-01-04 15:16     ` Eli Zaretskii
@ 2021-01-06  0:47       ` Tak Kunihiro
  2021-01-09  9:22         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Tak Kunihiro @ 2021-01-06  0:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 45628, 国広卓也, Amin Bandali

> How about a normal while loop with catch before it and throw inside?
> 
> +          (while (and (pixel-point-at-top-p amt) ; prevent too late (multi tries)
> +                      (equal (vertical-motion 1) 1))) ; move point downward
> 
> +        (while (and (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
> +                    (equal (vertical-motion -1) -1))) ; move point upward
> 
> I think equality to 1 or -1 is too stringent.  vertical-motion could
> move more if you have overlay strings or display strings at point that
> include embedded newlines.  So I think you should test >= 1 and <= -1
> respectively.

I revised the patch and is attached on this message.


> Also, I believe this problem exists on the emacs-27 branch as well,
> right?  Then we should install there first.

Yes.  Can you install the patch with the commit message to emacs-27 branch?

TIA


commit message

    Avoid infloop on scrolling a window with one screen line height.
    
    * lisp/pixel-scroll.el (pixel-scroll-up, pixel-scroll-down): Escape
    while loop when point did not move by `vertical-motion'.  (Bug#45628)


diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index cc0e159fae..68dc0fb94b 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -132,8 +132,10 @@ pixel-scroll-up
                    (pixel-line-height))))
         (if (pixel-eob-at-top-p)      ; when end-of-the-buffer is close
             (scroll-up 1)             ; relay on robust method
-          (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
-            (vertical-motion 1))            ; move point downward
+          (catch 'no-movement
+            (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
+              (unless (>= (vertical-motion 1) 1) ; move point downward
+                (throw 'no-movement nil)))) ; exit loop when point did not move
           (pixel-scroll-pixel-up amt))))))  ; move scope downward
 
 (defun pixel-scroll-down (&optional arg)
@@ -149,8 +151,10 @@ pixel-scroll-down
                          pixel-resolution-fine-flag
                        (frame-char-height))
                    (pixel-line-height -1))))
-        (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
-          (vertical-motion -1))              ; move point upward
+        (catch 'no-movement
+          (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
+            (unless (<= (vertical-motion -1) -1) ; move point upward
+              (throw 'no-movement nil)))) ; exit loop when point did not move
         (if (or (pixel-bob-at-top-p amt) ; when beginning-of-the-buffer is seen
                 (pixel-eob-at-top-p))    ; for file with a long line
             (scroll-down 1)              ; relay on robust method







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

* bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs
  2021-01-06  0:47       ` Tak Kunihiro
@ 2021-01-09  9:22         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2021-01-09  9:22 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: 45628-done, bandali

> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Wed, 6 Jan 2021 09:47:26 +0900
> Cc: 国広卓也 <tkk@misasa.okayama-u.ac.jp>,
>  Amin Bandali <bandali@gnu.org>,
>  45628@debbugs.gnu.org
> 
> > How about a normal while loop with catch before it and throw inside?
> > 
> > +          (while (and (pixel-point-at-top-p amt) ; prevent too late (multi tries)
> > +                      (equal (vertical-motion 1) 1))) ; move point downward
> > 
> > +        (while (and (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
> > +                    (equal (vertical-motion -1) -1))) ; move point upward
> > 
> > I think equality to 1 or -1 is too stringent.  vertical-motion could
> > move more if you have overlay strings or display strings at point that
> > include embedded newlines.  So I think you should test >= 1 and <= -1
> > respectively.
> 
> I revised the patch and is attached on this message.
> 
> 
> > Also, I believe this problem exists on the emacs-27 branch as well,
> > right?  Then we should install there first.
> 
> Yes.  Can you install the patch with the commit message to emacs-27 branch?

Thanks, I installed this on the emacs-27 branch, and I'm closing this
bug report.





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

end of thread, other threads:[~2021-01-09  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03 16:14 bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs Amin Bandali
2021-01-03 17:30 ` Eli Zaretskii
2021-01-04  8:57   ` Tak Kunihiro
2021-01-04 15:16     ` Eli Zaretskii
2021-01-06  0:47       ` Tak Kunihiro
2021-01-09  9:22         ` Eli Zaretskii

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).