Subject: bug#74876: closed (Re: bug#75291: Redisplay not updating fringe when face filter changes)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 18 Jan 2025 09:30:02 +0000

Your bug report

#75291: 31.0.50; Force fringe refresh / force-window-update not affecting fringes

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
75291: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75291
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#75291: Redisplay not updating fringe when face filter changes
From: Eli Zaretskii <[email-masked]>
To: Daniel Colascione <[email-masked]>
Cc: [email-masked]
Date: Sat, 18 Jan 2025 11:29:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sat, 04 Jan 2025 15:24:43 -0500
> From: Daniel Colascione <[email-masked]>
> 
> On January 4, 2025 2:12:05 AM EST, Eli Zaretskii <[email-masked]> wrote:
> >> From: Daniel Colascione <[email-masked]>
> >> Cc: [email-masked],  [email-masked]
> >> Date: Fri, 03 Jan 2025 15:57:37 -0500
> >> 
> >> Eli Zaretskii <[email-masked]> writes:
> >> 
> >> >> > Doesn't that only support face remapping with :filtered attribute?
> >> >> > What about the more general case where the fringe face is remapped in
> >> >> > a way that's independent of the windows?
> >> >> 
> >> >> That seems to work already. It's only in the fringe that I see problems
> >> >> --- it just doesn't seem worth it to limit the redraw to the fringe.
> >> >
> >> > Sorry, I don't understand.  I _was_ talking about the fringe face.
> >> 
> >> I misread your question. To answer it: what are the circumstances in
> >> which the effective fringe face can change behind our backs?
> >
> >For example, face remapping via face-remapping-alist.
> 
> Directly, without going through face-remap? We already caution against that and should do so more
> strongly. I don't think it's worth supporting direct modification of the alist.
> 
> >
> >> Any change to a face attribute proper will cause a redraw anyway.
> >
> >Changes in face attributes set the frame's redisplay flag, but that
> >just tells the display engine to disable some radical optimizations,
> >like considering only the selected window and only the line where the
> >cursor is.  AFAIU, this will not necessarily cause all the fringes of
> >all the frame's windows to be redrawn, because we only redraw the
> >fringes of the glyph rows that we consider changed.
> >
> >> The face-remap.el functions call force-mode-line-update to make sure
> >> face remapping lists take effect
> >
> >force-mode-line-update sets a buffer-specific flag that disables some
> >redisplay optimizations, but I don't think that guarantees redrawing
> >of all the fringes of all the windows which show that buffer.
> 
> Somehow, the basic case we have in face-remap seems to work already. I've put a change in master to
> handle the window parameter filter case. Seems to work for me now without observable downsides. No extra
> flickering. There's also a way to turn it off.

No further comments, so I presume the bug is fixed, and I'm closing
it.

Subject: 31.0.50; Force fringe refresh / force-window-update not affecting fringes
From: Michal Nazarewicz <[email-masked]>
To: [email-masked]
Date: Sat, 14 Dec 2024 20:31:00 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I’m implementing fringe dimming in non-selected windows as an extension
of the NonGNU ELPA auto-dim-other-buffers package (see
<https://github.com/mina86/auto-dim-other-buffers.el/issues/27>).

<https://github.com/mina86/auto-dim-other-buffers.el/tree/fringes> is
a test code which tries to achieve it.  The expected behaviour is that
after enabling auto-dim-other-buffers-mode defined there, as you switch
between windows, the fringes of non-selected windows will be red.

Alas, it appears that fringes are redrawn lazily such that changing
window does not refresh the fringes.

For a bit more context, the package uses face-remap-add-relative and
:filtered faces, i.e. something like:

    (face-remap-add-relative
     'fringe
     '(:filtered (:window adob--dim t) auto-dim-other-buffers-fringe-face))

I’ve tried toggling fringe-mode when forcing window update with the
below code, but it did not do the trick.

    (defun adob--force-window-update (object)
      (force-window-update object)
      ;; Force fringes to be updated
      (when fringe-mode
        (dolist (wnd (if (windowp object)
                         (list object)
                       (get-buffer-window-list object nil t)))
          (let* ((frame  (window-frame wnd))
                 (params (frame-parameters frame))
                 (left   (alist-get 'left-fringe  params))
                 (right  (alist-get 'right-fringe params)))
            (when (and left right)
              (modify-frame-parameters
               frame '((left-fringe nil) (right-fringe nil)))
              (modify-frame-parameters
               frame `((left-fringe . ,left) (right-fringe . ,right))))))))

I think what I’d like is for force-window-update to force full fringe
redraw?  Honestly, I haven’t yet dug through all of the window and
fringe code so I’m not entirely sure where the main issue lays.

Configured using:
 'configure --prefix=/usr/local --enable-link-time-optimization
 --with-native-compilation=aot --without-dbus --without-gconf
 --without-gpm --without-gsettings --without-pop --without-selinux
 --without-systemd --without-toolkit-scroll-bars --with-x
 --with-x-toolkit=gtk3 --with-xinput2 --with-xml2 --with-tree-sitter
 'CFLAGS=-O2 -mtune=native -march=native -fstack-protector'
 'CPPFLAGS=-O2 -mtune=native -march=native -fstack-protector'
 'CXXFLAGS=-O2 -mtune=native -march=native -fstack-protector''

Configured features:
CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBSYSTEMD LIBXML2
MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS
TIFF TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_GB.utf8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  server-mode: t
  form-feed-mode: t
  auto-dim-other-buffers-mode: t
  global-auto-revert-mode: t
  icomplete-mode: t
  global-num3-mode: t
  num3-mode: t
  global-whitespace-mode: t
  whitespace-mode: t
  global-flyspell-mode: t
  remember-notes-mode: t
  delete-selection-mode: t
  windmove-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/mpn/.config/emacs/elpa/transient-20210525.1141/transient hides /usr/local/share/emacs/31.0.50/lisp/transient
~/.config/emacs/custom hides /usr/local/share/emacs/31.0.50/lisp/custom

Features:
(shadow emacsbug sort mail-extr notmuch notmuch-tree notmuch-jump
notmuch-hello notmuch-show notmuch-print notmuch-crypto notmuch-mua
notmuch-message notmuch-draft notmuch-maildir-fcc notmuch-address
notmuch-company notmuch-parser format-spec notmuch-wash diff-mode
track-changes coolj goto-addr icalendar notmuch-tag notmuch-lib
notmuch-compat pcase hl-line mm-view mml-smime smime gnutls dig
gnus-alias rot13 message sendmail yank-media puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
cus-edit wid-edit dabbrev checkdoc lisp-mnt shortdoc crm avy misearch
multi-isearch cus-start cus-load pulse color pp cl-print help-fns
radix-tree time-date auto-package-update easy-mmode dash descr-text
server flyspell form-feed init sgml-mode facemenu dom
auto-dim-other-buffers face-remap autorevert filenotify comp comp-cstr
cl-extra help-mode warnings comp-run comp-common rx icomplete num3-mode
disp-table whitespace compile text-property-search comint ansi-osc
ansi-color ring ispell remember advice browse-kill-ring delsel ffap
thingatpt windmove diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs auto-dim-other-buffers-autoloads avy-autoloads
browse-kill-ring-autoloads csv-mode-autoloads evil-autoloads
gnu-elpa-keyring-update-autoloads gnus-alias-autoloads finder-inf
markdown-mode-autoloads notmuch-autoloads protobuf-mode-autoloads
sed-mode-autoloads info vterm-autoloads package browse-url xdg url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
early-init rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen 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 inotify dynamic-setting font-render-setting cairo gtk x-toolkit
xinput2 x multi-tty move-toolbar make-network-process native-compile
emacs)

Memory information:
((conses 16 257215 704427) (symbols 48 34587 67)
 (strings 32 82254 29315) (string-bytes 1 2545384) (vectors 16 34779)
 (vector-slots 8 825430 881688) (floats 8 257 4262)
 (intervals 56 3296 6731) (buffers 992 19))

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»