emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d3faef9 4/7: Ensure redisplay using variable watche


From: Noam Postavsky
Subject: [Emacs-diffs] master d3faef9 4/7: Ensure redisplay using variable watcher
Date: Sat, 3 Dec 2016 01:45:05 +0000 (UTC)

branch: master
commit d3faef9baedadc9eaec46814ba9bbe5168048328
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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   |   23 ++++++++++-------------
 4 files changed, 11 insertions(+), 18 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 @@ See also `toggle-frame-maximized'."
  '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 095b740..81846b5 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 @@ 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 2acdfa9..ad0b968 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)
-    {
-      bset_update_mode_line (current_buffer);
-      current_buffer->prevent_redisplay_optimizations_p = true;
-    }
+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
@@ -31322,6 +31322,7 @@ They are still logged to the *Messages* buffer.  */);
   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);
@@ -31991,10 +31992,6 @@ display table takes effect; in this case, Emacs does 
not consult
               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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]