]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure redisplay after evaluation
authorEli Zaretskii <eliz@gnu.org>
Fri, 6 Nov 2015 19:21:52 +0000 (21:21 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 6 Nov 2015 19:21:52 +0000 (21:21 +0200)
* 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
lisp/progmodes/elisp-mode.el
src/data.c
src/window.h
src/xdisp.c

index f5508517dc6ee9e1b3254af3d55e5c625baeb1ff..4b23cb20ac46e76ab8ee4b711cfd9fe9aca816a9 100644 (file)
@@ -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
index daf5e41d288b1038c8330adc058d118ef7bf6902..8ea17b74ddb80a40487a01f3a24b833af5036857 100644 (file)
@@ -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))
index 5382b01066eef2ec4a153342dfce273cdf387ecd..4db93f5625f01698b023304da883f57cb3162809 100644 (file)
@@ -1240,6 +1240,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
        return;
     }
 
+  maybe_set_redisplay (symbol);
   sym = XSYMBOL (symbol);
 
  start:
index eaff57eaedfb35f9330f7bcc226e00cb5a001e03..135f5de7d8aaa953233b4cda3e9c73b3a5679800 100644 (file)
@@ -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.  */
index bdf2d09179e05f4b3dd3046d1a53fc73c5c5bbf6..f6d63ea702fa849c5fa2d87bd2d514f17315d22c 100644 (file)
@@ -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;
 }