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)
This commit is contained in:
Eli Zaretskii 2015-11-06 21:21:52 +02:00
parent 8025fdbbea
commit 19e09cfab6
5 changed files with 26 additions and 11 deletions

View 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

View 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))

View 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:

View 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. */

View 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;
}