all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74876@debbugs.gnu.org
Subject: bug#74876: 31.0.50; Force fringe refresh / force-window-update not affecting fringes
Date: Mon, 16 Dec 2024 22:47:43 +0100	[thread overview]
Message-ID: <b7fu8e99z0+5up8t0m2cj+d3@mina86.com> (raw)
In-Reply-To: <86seqps9v4.fsf@gnu.org>

On Sun, Dec 15 2024, Eli Zaretskii wrote:
> Thanks.  I don't think what you want can possibly work, unless we
> completely redesign how the fringes are updated.

Well… there’s always the atomic option of calling redraw-frame.  Though
I’ve found that changing an attribute of a font is sufficient.
I believe what makes things work is setting f->face_change and calling
fset_redisplay.

---- >8 ----------------------------------------------------------------

(defvar-local adob-remapping nil)
(put 'adob-remapping 'permanent-local nil)

(defface adob-test '((t :background "red")) "Test")
(defface adob-hack '() "Test")

(defun adob-force-window-update (wnd)
  (force-window-update wnd)
  (let ((frame (window-frame wnd))
        (value (face-attribute 'adob-hack :inverse-video frame nil)))
    (internal-set-lisp-face-attribute
     'adob-hack :inverse-video (not value) frame)))

(defun adob-force-window-update (wnd)
  (force-window-update wnd)
  ; (redraw-frame (window-frame wnd))
  (let ((frame (window-frame wnd))
        (value (face-attribute 'adob-hack :inverse-video frame nil)))
    (internal-set-lisp-face-attribute
     'adob-hack :inverse-video (not value) frame)))

(defun adob-test-for-each-window (func)
  (save-current-buffer
    (dolist (frame (frame-list))
      (dolist (wnd (window-list frame))
        (set-buffer (window-buffer wnd))
        (when (funcall func wnd)
          (adob-force-window-update wnd))))))

(defun adob-test-update ()
  (let ((face '(:filtered (:window adob-test t) adob-test))
        (selected-window (selected-window)))
    (adob-test-for-each-window
     (lambda (wnd)
       (let ((val (eq wnd selected-window)) update)
         (unless adob-remapping
           (setq adob-remapping (face-remap-add-relative 'fringe face)
                 update t))
         (unless (eq val (window-parameter wnd 'adob-test))
           (set-window-parameter wnd 'adob-test val)
           (setq update t))
         update)))))

(defun adob-test-on ()
  (interactive)
  (adob-test-update)
  (add-hook 'post-command-hook #'adob-test-update))

(defun adob-test-off ()
  (interactive)
  (remove-hook 'post-command-hook #'adob-test-update)
  (adob-test-for-each-window
   (lambda (wnd)
     (when adob-remapping
       (face-remap-remove-relative adob-remapping)
       (setq adob-remapping nil)
       t))))

---- 8< ----------------------------------------------------------------

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





  reply	other threads:[~2024-12-16 21:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 19:31 bug#74876: 31.0.50; Force fringe refresh / force-window-update not affecting fringes Michal Nazarewicz
2024-12-14 20:28 ` Eli Zaretskii
2024-12-14 21:39   ` Michal Nazarewicz
2024-12-15  7:06     ` Eli Zaretskii
2024-12-16 21:47       ` Michal Nazarewicz [this message]
2024-12-17 12:16         ` Eli Zaretskii
2024-12-17 13:20           ` Michal Nazarewicz
2024-12-17 14:19             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7fu8e99z0+5up8t0m2cj+d3@mina86.com \
    --to=mina86@mina86.com \
    --cc=74876@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.