aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2018-02-05 07:50:22 -0800
committerGlenn Morris2018-02-05 07:50:22 -0800
commita0c7157a16481b0523ad20cda9115f9435188f73 (patch)
tree4e23a700da7c493f54f0afeb337fd963502115cb /src
parentc24c5dc4a4cc18e7f1ec949efcfe1d4bae541d02 (diff)
parentc787a4968273027960a20ced6d63bae0d1ffa87e (diff)
downloademacs-a0c7157a16481b0523ad20cda9115f9435188f73.tar.gz
emacs-a0c7157a16481b0523ad20cda9115f9435188f73.zip
Merge from origin/emacs-26
c787a49 (origin/emacs-26) * lisp/vc/vc-git.el (vc-git-print-log): Res... b654791 * doc/emacs/misc.texi (Interactive Shell): Refer to node "Min... f1102d2 Yet another round of fixing the Emacs manual 76b5a68 * etc/NEWS: Expunge the solecism "allow(s)" + infinitive b4ff8cc Two minor fixes in Antinews aafcd12 * etc/NEWS: Rename image-dired-thumb-job-limit a893924 * lisp/simple.el (async-shell-command, shell-command): Fix gr... 699081f Fix deferred display of async shell-command buffers d2d5e54 Mention remote file name completion in Emacs manual f589f5a Yest another round of manual copyedits 1ed4089 Update xdisp.c commentary e23de39 Fix Bug#30324 e1a9dc0 Recognize Org as builtin package (bug#30310) Conflicts: etc/NEWS
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 17a3cc3b89a..55f3151b4f2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -34,26 +34,41 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
34 in xdisp.c is the only entry into the inner redisplay code. 34 in xdisp.c is the only entry into the inner redisplay code.
35 35
36 The following diagram shows how redisplay code is invoked. As you 36 The following diagram shows how redisplay code is invoked. As you
37 can see, Lisp calls redisplay and vice versa. Under window systems 37 can see, Lisp calls redisplay and vice versa.
38 like X, some portions of the redisplay code are also called 38
39 asynchronously during mouse movement or expose events. It is very 39 Under window systems like X, some portions of the redisplay code
40 important that these code parts do NOT use the C library (malloc, 40 are also called asynchronously, due to mouse movement or expose
41 free) because many C libraries under Unix are not reentrant. They 41 events. "Asynchronously" in this context means that any C function
42 may also NOT call functions of the Lisp interpreter which could 42 which calls maybe_quit or process_pending_signals could enter
43 change the interpreter's state. If you don't follow these rules, 43 redisplay via expose_frame and/or note_mouse_highlight, if X events
44 you will encounter bugs which are very hard to explain. 44 were recently reported to Emacs about mouse movements or frame(s)
45 that were exposed. And such redisplay could invoke the Lisp
46 interpreter, e.g. via the :eval forms in mode-line-format, and as
47 result the global state could change. It is therefore very
48 important that C functions which might cause such "asynchronous"
49 redisplay, but cannot tolerate the results, use
50 block_input/unblock_input around code fragments which assume that
51 global Lisp state doesn't change. If you don't follow this rule,
52 you will encounter bugs which are very hard to explain. One place
53 that needs to take such precautions is timer_check, some of whose
54 code cannot tolerate changes in timer alists while it processes
55 timers.
45 56
46 +--------------+ redisplay +----------------+ 57 +--------------+ redisplay +----------------+
47 | Lisp machine |---------------->| Redisplay code |<--+ 58 | Lisp machine |---------------->| Redisplay code |<--+
48 +--------------+ (xdisp.c) +----------------+ | 59 +--------------+ (xdisp.c) +----------------+ |
49 ^ | | 60 ^ | |
50 +----------------------------------+ | 61 +----------------------------------+ |
51 Don't use this path when called | 62 Block input to prevent this when |
52 asynchronously! | 63 called asynchronously! |
53 | 64 |
54 expose_window (asynchronous) | 65 note_mouse_highlight (asynchronous) |
55 | 66 |
56 X expose events -----+ 67 X mouse events -----+
68 |
69 expose_frame (asynchronous) |
70 |
71 X expose events -----+
57 72
58 What does redisplay do? Obviously, it has to figure out somehow what 73 What does redisplay do? Obviously, it has to figure out somehow what
59 has been changed since the last time the display has been updated, 74 has been changed since the last time the display has been updated,