diff options
| author | Karl Heuer | 1995-01-28 02:51:29 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-01-28 02:51:29 +0000 |
| commit | 329d527986b6c6ed0117fa09fcc39d176ebb03ab (patch) | |
| tree | 0060a308eb9d4b90fdfe8608a0a4eccbcaaf2e08 /src | |
| parent | aa341c40421358aa270377bd051344f1ba9a3162 (diff) | |
| download | emacs-329d527986b6c6ed0117fa09fcc39d176ebb03ab.tar.gz emacs-329d527986b6c6ed0117fa09fcc39d176ebb03ab.zip | |
(ECHOBUFSIZE): New constant, replaces sizeof (echobuf).
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index 6debf2c785e..d8175f1a580 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -483,6 +483,7 @@ typedef struct interval *INTERVAL; | |||
| 483 | 483 | ||
| 484 | #endif /* USE_TEXT_PROPERTIES */ | 484 | #endif /* USE_TEXT_PROPERTIES */ |
| 485 | 485 | ||
| 486 | #define ECHOBUFSIZE 300 | ||
| 486 | /* All of the per-display objects, packaged together in a struct. */ | 487 | /* All of the per-display objects, packaged together in a struct. */ |
| 487 | typedef struct | 488 | typedef struct |
| 488 | { | 489 | { |
| @@ -490,6 +491,33 @@ typedef struct | |||
| 490 | Lisp_Object current_prefix_arg; | 491 | Lisp_Object current_prefix_arg; |
| 491 | Lisp_Object this_command_keys; | 492 | Lisp_Object this_command_keys; |
| 492 | Lisp_Object internal_last_event_frame; | 493 | Lisp_Object internal_last_event_frame; |
| 494 | |||
| 495 | /* Vector to GCPRO the frames and windows mentioned in kbd_buffer. | ||
| 496 | |||
| 497 | The interrupt-level event handlers will never enqueue an event on a | ||
| 498 | frame which is not in Vframe_list, and once an event is dequeued, | ||
| 499 | internal_last_event_frame or the event itself points to the frame. | ||
| 500 | So that's all fine. | ||
| 501 | |||
| 502 | But while the event is sitting in the queue, it's completely | ||
| 503 | unprotected. Suppose the user types one command which will run for | ||
| 504 | a while and then delete a frame, and then types another event at | ||
| 505 | the frame that will be deleted, before the command gets around to | ||
| 506 | it. Suppose there are no references to this frame elsewhere in | ||
| 507 | Emacs, and a GC occurs before the second event is dequeued. Now we | ||
| 508 | have an event referring to a freed frame, which will crash Emacs | ||
| 509 | when it is dequeued. | ||
| 510 | |||
| 511 | Similar things happen when an event on a scroll bar is enqueued; the | ||
| 512 | window may be deleted while the event is in the queue. | ||
| 513 | |||
| 514 | So, we use this vector to protect the frame_or_window field in the | ||
| 515 | event queue. That way, they'll be dequeued as dead frames or | ||
| 516 | windows, but still valid lisp objects. | ||
| 517 | |||
| 518 | If perd->kbd_buffer[i].kind != no_event, then | ||
| 519 | (XVECTOR (perd->kbd_buffer_frame_or_window)->contents[i] | ||
| 520 | == perd->kbd_buffer[i].frame_or_window. */ | ||
| 493 | Lisp_Object kbd_buffer_frame_or_window; | 521 | Lisp_Object kbd_buffer_frame_or_window; |
| 494 | 522 | ||
| 495 | /* Circular buffer for pre-read keyboard input. */ | 523 | /* Circular buffer for pre-read keyboard input. */ |
| @@ -516,10 +544,20 @@ typedef struct | |||
| 516 | at inopportune times. */ | 544 | at inopportune times. */ |
| 517 | 545 | ||
| 518 | int this_command_key_count; | 546 | int this_command_key_count; |
| 547 | |||
| 548 | /* Nonzero means echo each character as typed. */ | ||
| 519 | int immediate_echo; | 549 | int immediate_echo; |
| 550 | |||
| 551 | /* If we have echoed a prompt string specified by the user, | ||
| 552 | this is its length. Otherwise this is -1. */ | ||
| 520 | int echo_after_prompt; | 553 | int echo_after_prompt; |
| 554 | |||
| 555 | /* Where to append more text to echobuf if we want to. */ | ||
| 521 | char *echoptr; | 556 | char *echoptr; |
| 522 | char echobuf[300]; | 557 | |
| 558 | /* The text we're echoing in the modeline - partial key sequences, | ||
| 559 | usually. '\0'-terminated. This really shouldn't have a fixed size. */ | ||
| 560 | char echobuf[ECHOBUFSIZE]; | ||
| 523 | } PERDISPLAY; | 561 | } PERDISPLAY; |
| 524 | extern PERDISPLAY the_only_perdisplay; | 562 | extern PERDISPLAY the_only_perdisplay; |
| 525 | #define get_perdisplay(f) (&the_only_perdisplay) | 563 | #define get_perdisplay(f) (&the_only_perdisplay) |