Subject: 30.0.50; pixel-scroll-precision-mode won't scroll with scroll-margin 2 using macbook trackpad

From: Stefan Kangas <[email-masked]>
Date: Mon, 1 Jan 2024 15:05:17 -0800

Scrolling slowly with the trackpad in `pixel-scroll-precision-mode'
doesn't work as expected on my recent Macbook Pro with the below
settings.

Recipe to reproduce:

1. Evaluate this form in emacs -Q:

    (progn (setq scroll-step 0)
           (setq scroll-conservatively 500)
           (setq scroll-margin 2)
           (pixel-scroll-precision-mode))

2. Go to some sufficiently long buffer, scroll down a bit and move point
   to the top of the window: C-h i C-v

3. Scroll down slowly using the trackpad.

The window does not scroll down, instead it just bounces back and forth
at the top.

Note that if I scroll fast enough, the window does scroll down as
expected.

In GNU Emacs 30.0.50 (build 6, aarch64-apple-darwin23.2.0, NS
 appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2023-12-29 built on
 MyMachine.local
Repository revision: b0bead793f880a9434c38caeaa744f7d7a0e519b
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.2.1

Configured features:
ACL GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG
SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

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

Major mode: Info

Minor modes in effect:
  pixel-scroll-precision-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  isearch-fold-quotes-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
pixel-scroll cua-base ring subr-x info rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 54274 9442) (symbols 48 5645 0) (strings 32 15206 2309)
 (string-bytes 1 447111) (vectors 16 11483)
 (vector-slots 8 167422 14968) (floats 8 329 233)
 (intervals 56 2431 24) (buffers 992 11))