From f3e82ab6d29dc0b673704dafd7e8c8c636bf0407 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 21 Nov 2015 17:02:42 -0500 Subject: [PATCH 3/3] Ensure redisplay using variable watchers Instead of looking up the variable name in redisplay--variables when setting. * lisp/frame.el: Replace redisplay--variables with add-variable-watcher calls. * src/data.c (set_internal): Remove maybe_set_redisplay call. * src/xdisp.c (Fset_redisplay): Rename from maybe_set_redisplay, set the redisplay flag unconditionally. --- lisp/frame.el | 3 +-- src/data.c | 2 -- src/window.h | 1 - src/xdisp.c | 19 ++++++++----------- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index f024065..95c514f 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2232,9 +2232,8 @@ (make-obsolete-variable 'window-system-version "it does not give useful information." "24.3") ;; Variables which should trigger redisplay of the current buffer. -(setq redisplay--variables (make-hash-table :test 'eq :size 10)) (mapc (lambda (var) - (puthash var 1 redisplay--variables)) + (add-variable-watcher var #'set-redisplay)) '(line-spacing overline-margin line-prefix diff --git a/src/data.c b/src/data.c index 7c6fc2c..a411cf5 100644 --- a/src/data.c +++ b/src/data.c @@ -1260,8 +1260,6 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, default: ; } - maybe_set_redisplay (symbol); - start: switch (sym->redirect) { diff --git a/src/window.h b/src/window.h index 135f5de..eaff57e 100644 --- a/src/window.h +++ b/src/window.h @@ -1056,7 +1056,6 @@ extern void wset_redisplay (struct window *w); extern void fset_redisplay (struct frame *f); extern void bset_redisplay (struct buffer *b); extern void bset_update_mode_line (struct buffer *b); -extern void maybe_set_redisplay (Lisp_Object); /* Call this to tell redisplay to look for other windows than selected-window that need to be redisplayed. Calling one of the *set_redisplay functions above already does it, so it's only needed in unusual cases. */ diff --git a/src/xdisp.c b/src/xdisp.c index 30dfac5..705f352 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -620,15 +620,14 @@ bset_update_mode_line (struct buffer *b) b->text->redisplay = true; } -void -maybe_set_redisplay (Lisp_Object symbol) +DEFUN ("set-redisplay", Fset_redisplay, Sset_redisplay, + 0, MANY, 0, + doc: /* Cause a full redisplay to happen. + usage: () */) + (ptrdiff_t nargs, Lisp_Object* rest) { - if (HASH_TABLE_P (Vredisplay__variables) - && hash_lookup (XHASH_TABLE (Vredisplay__variables), symbol, NULL) >= 0) - { - bset_update_mode_line (current_buffer); - current_buffer->prevent_redisplay_optimizations_p = true; - } + bset_update_mode_line (current_buffer); + current_buffer->prevent_redisplay_optimizations_p = true; } #ifdef GLYPH_DEBUG @@ -31478,9 +31477,7 @@ or t (meaning all windows). */); doc: /* */); Vredisplay__mode_lines_cause = Fmake_hash_table (0, NULL); - DEFVAR_LISP ("redisplay--variables", Vredisplay__variables, - doc: /* A hash-table of variables changing which triggers a thorough redisplay. */); - Vredisplay__variables = Qnil; + defsubr (&Sset_redisplay); } -- 2.6.2