>From d7e1393e5d68fa4c6e279a8e7bc584be9bc506d3 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 21 Nov 2015 17:02:42 -0500 Subject: [PATCH v7 4/6] Ensure redisplay using variable watcher This replaces looking up the variable name in redisplay--variables when setting it. * lisp/frame.el: Replace redisplay--variables with add-variable-watcher calls. * src/xdisp.c (Fset_buffer_redisplay): Rename from maybe_set_redisplay, set the redisplay flag unconditionally. (Vredisplay__variables): Remove it. * src/data.c (set_internal): Remove maybe_set_redisplay call. --- lisp/frame.el | 3 +-- src/data.c | 2 -- src/window.h | 1 - src/xdisp.c | 17 +++++++---------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index a584567..1dffc6c 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2249,9 +2249,8 @@ 'automatic-hscrolling '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 (symbol-function 'set-buffer-redisplay))) '(line-spacing overline-margin line-prefix diff --git a/src/data.c b/src/data.c index 911789f..ff35315 100644 --- a/src/data.c +++ b/src/data.c @@ -1275,8 +1275,6 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, default: emacs_abort (); } - maybe_set_redisplay (symbol); - start: switch (sym->redirect) { diff --git a/src/window.h b/src/window.h index a124b33..4a102f2 100644 --- a/src/window.h +++ b/src/window.h @@ -1063,7 +1063,6 @@ void set_window_buffer (Lisp_Object window, Lisp_Object buffer, 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 6e8af8a..9d36ab6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -622,15 +622,15 @@ bset_update_mode_line (struct buffer *b) b->text->redisplay = true; } -void -maybe_set_redisplay (Lisp_Object symbol) -{ - if (HASH_TABLE_P (Vredisplay__variables) - && hash_lookup (XHASH_TABLE (Vredisplay__variables), symbol, NULL) >= 0) +DEFUN ("set-buffer-redisplay", Fset_buffer_redisplay, + Sset_buffer_redisplay, 4, 4, 0, + doc: /* Mark the current buffer for redisplay. +This function may be passed to `add-variable-watcher'. */) + (Lisp_Object symbol, Lisp_Object newval, Lisp_Object op, Lisp_Object where) { bset_update_mode_line (current_buffer); current_buffer->prevent_redisplay_optimizations_p = true; - } + return Qnil; } #ifdef GLYPH_DEBUG @@ -31319,6 +31319,7 @@ syms_of_xdisp (void) message_dolog_marker3 = Fmake_marker (); staticpro (&message_dolog_marker3); + defsubr (&Sset_buffer_redisplay); #ifdef GLYPH_DEBUG defsubr (&Sdump_frame_glyph_matrix); defsubr (&Sdump_glyph_matrix); @@ -31988,10 +31989,6 @@ 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; - DEFVAR_BOOL ("redisplay--inhibit-bidi", redisplay__inhibit_bidi, doc: /* Non-nil means it is not safe to attempt bidi reordering for display. */); /* Initialize to t, since we need to disable reordering until -- 2.9.3