emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 19e09cf: Ensure redisplay after evaluation


From: Eli Zaretskii
Subject: [Emacs-diffs] master 19e09cf: Ensure redisplay after evaluation
Date: Fri, 06 Nov 2015 19:23:13 +0000

branch: master
commit 19e09cfab61436cb4590303871a31ee07624f5ab
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Ensure redisplay after evaluation
    
    * lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp): Revert
    last change.
    * lisp/frame.el (redisplay--variables): Populate the
    redisplay--variables list.
    * src/xdisp.c (maybe_set_redisplay): New function.
    (syms_of_xdisp) <redisplay--variables>: New variable.
    * src/window.h (maybe_set_redisplay): Declare prototype.
    * src/data.c (set_internal): Call maybe_set_redisplay.  (Bug#21835)
---
 lisp/frame.el                |    7 +++++++
 lisp/progmodes/elisp-mode.el |   14 +++-----------
 src/data.c                   |    1 +
 src/window.h                 |    1 +
 src/xdisp.c                  |   14 ++++++++++++++
 5 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index f550851..4b23cb2 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2231,6 +2231,13 @@ See also `toggle-frame-maximized'."
 (make-obsolete-variable
  'window-system-version "it does not give useful information." "24.3")
 
+;; These variables should trigger redisplay of the current buffer.
+(setq redisplay--variables
+      '(line-spacing
+        overline-margin
+        line-prefix
+        wrap-prefix))
+
 (provide 'frame)
 
 ;;; frame.el ends here
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index daf5e41..8ea17b7 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1116,17 +1116,9 @@ include additional formats for integers \(octal, 
hexadecimal, and
 character)."
   (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
     ;; Setup the lexical environment if lexical-binding is enabled.
-    (prog1
-        (elisp--eval-last-sexp-print-value
-         (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
-         eval-last-sexp-arg-internal)
-      ;; If we are going to display the result in the echo area, force
-      ;; a more thorough redisplay, in case the sexp we evaluated
-      ;; changes something that should affect the display of the
-      ;; current window.  Otherwise, Emacs might decide that only the
-      ;; echo area needs to be redisplayed.
-      (if (eq standard-output t)
-          (force-mode-line-update 'all)))))
+    (elisp--eval-last-sexp-print-value
+     (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
+     eval-last-sexp-arg-internal)))
 
 (defun elisp--eval-last-sexp-print-value (value &optional 
eval-last-sexp-arg-internal)
   (let ((unabbreviated (let ((print-length nil) (print-level nil))
diff --git a/src/data.c b/src/data.c
index 5382b01..4db93f5 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1240,6 +1240,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, 
Lisp_Object where,
        return;
     }
 
+  maybe_set_redisplay (symbol);
   sym = XSYMBOL (symbol);
 
  start:
diff --git a/src/window.h b/src/window.h
index eaff57e..135f5de 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1056,6 +1056,7 @@ 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 bdf2d09..f6d63ea 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -620,6 +620,16 @@ bset_update_mode_line (struct buffer *b)
   b->text->redisplay = true;
 }
 
+void
+maybe_set_redisplay (Lisp_Object symbol)
+{
+  if (!NILP (Fassoc_string (symbol, Vredisplay__variables, Qnil)))
+    {
+      bset_update_mode_line (current_buffer);
+      current_buffer->prevent_redisplay_optimizations_p = true;
+    }
+}
+
 #ifdef GLYPH_DEBUG
 
 /* True means print traces of redisplay if compiled with
@@ -31465,6 +31475,10 @@ display table takes effect; in this case, Emacs does 
not consult
   DEFVAR_LISP ("redisplay--mode-lines-cause", Vredisplay__mode_lines_cause,
               doc: /*  */);
   Vredisplay__mode_lines_cause = Fmake_hash_table (0, NULL);
+
+  DEFVAR_LISP ("redisplay--variables", Vredisplay__variables,
+     doc: /* A list of variables changes to which trigger a thorough 
redisplay.  */);
+  Vredisplay__variables = Qnil;
 }
 
 



reply via email to

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