diff options
| author | Glenn Morris | 2018-10-03 09:23:16 -0700 |
|---|---|---|
| committer | Glenn Morris | 2018-10-03 09:23:16 -0700 |
| commit | 48adb87bcb0f27e2d18fc6523c472af4916d5884 (patch) | |
| tree | 0299f7ce336e0d21fe902af6809798e3bb2045a7 | |
| parent | 51f0cccdde9bd1679e20f35d30e39e872ce6513a (diff) | |
| parent | 7296b6fbf27aeae76ea63ab2d9d9f2e46491b971 (diff) | |
| download | emacs-48adb87bcb0f27e2d18fc6523c472af4916d5884.tar.gz emacs-48adb87bcb0f27e2d18fc6523c472af4916d5884.zip | |
Merge from origin/emacs-26
7296b6f Improve cl-do, cl-do* docstrings
d416109 Avoid returning early in 'while-no-input' due to subprocesses
e8a4d94 Cleanup when opening a new terminal fails. (Bug#32794)
# Conflicts:
# etc/NEWS
| -rw-r--r-- | etc/NEWS.26 | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 39 | ||||
| -rw-r--r-- | lisp/subr.el | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/term.c | 1 | ||||
| -rw-r--r-- | src/termhooks.h | 1 | ||||
| -rw-r--r-- | src/terminal.c | 9 |
7 files changed, 61 insertions, 4 deletions
diff --git a/etc/NEWS.26 b/etc/NEWS.26 index 19dd433cda4..94bb45c6feb 100644 --- a/etc/NEWS.26 +++ b/etc/NEWS.26 | |||
| @@ -110,6 +110,16 @@ be removed prior using the changed 'shadow-*' commands. | |||
| 110 | The old name is an alias of the new name. Future Emacs version will | 110 | The old name is an alias of the new name. Future Emacs version will |
| 111 | obsolete it. | 111 | obsolete it. |
| 112 | 112 | ||
| 113 | --- | ||
| 114 | ** 'while-no-input' does not return due to input from subprocesses. | ||
| 115 | Input that arrived from subprocesses while some code executed inside | ||
| 116 | the 'while-no-input' form injected an internal buffer-switch event | ||
| 117 | that counted as input and would cause 'while-no-input' to return, | ||
| 118 | perhaps prematurely. These buffer-switch events are now by default | ||
| 119 | ignored by 'while-no-input'; if you need to get the old behavior, | ||
| 120 | remove 'buffer-switch' from the list of events in | ||
| 121 | 'while-no-input-ignore-events'. | ||
| 122 | |||
| 113 | 123 | ||
| 114 | * Lisp Changes in Emacs 26.2 | 124 | * Lisp Changes in Emacs 26.2 |
| 115 | 125 | ||
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index d0d1c3b156a..29ddd491af0 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -1779,7 +1779,24 @@ such that COMBO is equivalent to (and . CLAUSES)." | |||
| 1779 | 1779 | ||
| 1780 | ;;;###autoload | 1780 | ;;;###autoload |
| 1781 | (defmacro cl-do (steps endtest &rest body) | 1781 | (defmacro cl-do (steps endtest &rest body) |
| 1782 | "The Common Lisp `do' loop. | 1782 | "Bind variables and run BODY forms until END-TEST returns non-nil. |
| 1783 | First, each VAR is bound to the associated INIT value as if by a `let' form. | ||
| 1784 | Then, in each iteration of the loop, the END-TEST is evaluated; if true, | ||
| 1785 | the loop is finished. Otherwise, the BODY forms are evaluated, then each | ||
| 1786 | VAR is set to the associated STEP expression (as if by a `cl-psetq' form) | ||
| 1787 | and the next iteration begins. | ||
| 1788 | |||
| 1789 | Once the END-TEST becomes true, the RESULT forms are evaluated (with | ||
| 1790 | the VARs still bound to their values) to produce the result | ||
| 1791 | returned by `cl-do'. | ||
| 1792 | |||
| 1793 | Note that the entire loop is enclosed in an implicit `nil' block, so | ||
| 1794 | that you can use `cl-return' to exit at any time. | ||
| 1795 | |||
| 1796 | Also note that END-TEST is checked before evaluating BODY. If END-TEST | ||
| 1797 | is initially non-nil, `cl-do' will exit without running BODY. | ||
| 1798 | |||
| 1799 | For more details, see `cl-do' description in Info node `(cl) Iteration'. | ||
| 1783 | 1800 | ||
| 1784 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" | 1801 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" |
| 1785 | (declare (indent 2) | 1802 | (declare (indent 2) |
| @@ -1791,7 +1808,25 @@ such that COMBO is equivalent to (and . CLAUSES)." | |||
| 1791 | 1808 | ||
| 1792 | ;;;###autoload | 1809 | ;;;###autoload |
| 1793 | (defmacro cl-do* (steps endtest &rest body) | 1810 | (defmacro cl-do* (steps endtest &rest body) |
| 1794 | "The Common Lisp `do*' loop. | 1811 | "Bind variables and run BODY forms until END-TEST returns non-nil. |
| 1812 | First, each VAR is bound to the associated INIT value as if by a `let*' form. | ||
| 1813 | Then, in each iteration of the loop, the END-TEST is evaluated; if true, | ||
| 1814 | the loop is finished. Otherwise, the BODY forms are evaluated, then each | ||
| 1815 | VAR is set to the associated STEP expression (as if by a `setq' | ||
| 1816 | form) and the next iteration begins. | ||
| 1817 | |||
| 1818 | Once the END-TEST becomes true, the RESULT forms are evaluated (with | ||
| 1819 | the VARs still bound to their values) to produce the result | ||
| 1820 | returned by `cl-do*'. | ||
| 1821 | |||
| 1822 | Note that the entire loop is enclosed in an implicit `nil' block, so | ||
| 1823 | that you can use `cl-return' to exit at any time. | ||
| 1824 | |||
| 1825 | Also note that END-TEST is checked before evaluating BODY. If END-TEST | ||
| 1826 | is initially non-nil, `cl-do*' will exit without running BODY. | ||
| 1827 | |||
| 1828 | This is to `cl-do' what `let*' is to `let'. | ||
| 1829 | For more details, see `cl-do*' description in Info node `(cl) Iteration'. | ||
| 1795 | 1830 | ||
| 1796 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" | 1831 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" |
| 1797 | (declare (indent 2) (debug cl-do)) | 1832 | (declare (indent 2) (debug cl-do)) |
diff --git a/lisp/subr.el b/lisp/subr.el index 4c05111f516..41dc9aa45f5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3570,7 +3570,7 @@ is allowed once again. (Immediately, if `inhibit-quit' is nil.)" | |||
| 3570 | ;; Don't throw `throw-on-input' on those events by default. | 3570 | ;; Don't throw `throw-on-input' on those events by default. |
| 3571 | (setq while-no-input-ignore-events | 3571 | (setq while-no-input-ignore-events |
| 3572 | '(focus-in focus-out help-echo iconify-frame | 3572 | '(focus-in focus-out help-echo iconify-frame |
| 3573 | make-frame-visible selection-request)) | 3573 | make-frame-visible selection-request buffer-switch)) |
| 3574 | 3574 | ||
| 3575 | (defmacro while-no-input (&rest body) | 3575 | (defmacro while-no-input (&rest body) |
| 3576 | "Execute BODY only as long as there's no pending input. | 3576 | "Execute BODY only as long as there's no pending input. |
diff --git a/src/keyboard.c b/src/keyboard.c index 1c1f1514ae8..35d74f4a795 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3554,6 +3554,7 @@ kbd_buffer_store_buffered_event (union buffered_input_event *event, | |||
| 3554 | case ICONIFY_EVENT: ignore_event = Qiconify_frame; break; | 3554 | case ICONIFY_EVENT: ignore_event = Qiconify_frame; break; |
| 3555 | case DEICONIFY_EVENT: ignore_event = Qmake_frame_visible; break; | 3555 | case DEICONIFY_EVENT: ignore_event = Qmake_frame_visible; break; |
| 3556 | case SELECTION_REQUEST_EVENT: ignore_event = Qselection_request; break; | 3556 | case SELECTION_REQUEST_EVENT: ignore_event = Qselection_request; break; |
| 3557 | case BUFFER_SWITCH_EVENT: ignore_event = Qbuffer_switch; break; | ||
| 3557 | default: ignore_event = Qnil; break; | 3558 | default: ignore_event = Qnil; break; |
| 3558 | } | 3559 | } |
| 3559 | 3560 | ||
| @@ -11082,6 +11083,8 @@ syms_of_keyboard (void) | |||
| 11082 | /* Menu and tool bar item parts. */ | 11083 | /* Menu and tool bar item parts. */ |
| 11083 | DEFSYM (Qmenu_enable, "menu-enable"); | 11084 | DEFSYM (Qmenu_enable, "menu-enable"); |
| 11084 | 11085 | ||
| 11086 | DEFSYM (Qbuffer_switch, "buffer-switch"); | ||
| 11087 | |||
| 11085 | #ifdef HAVE_NTGUI | 11088 | #ifdef HAVE_NTGUI |
| 11086 | DEFSYM (Qlanguage_change, "language-change"); | 11089 | DEFSYM (Qlanguage_change, "language-change"); |
| 11087 | DEFSYM (Qend_session, "end-session"); | 11090 | DEFSYM (Qend_session, "end-session"); |
diff --git a/src/term.c b/src/term.c index ce24f6915fc..852dc23bd60 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -4008,6 +4008,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) | |||
| 4008 | char const *diagnostic | 4008 | char const *diagnostic |
| 4009 | = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s"; | 4009 | = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s"; |
| 4010 | emacs_close (fd); | 4010 | emacs_close (fd); |
| 4011 | delete_terminal_internal (terminal); | ||
| 4011 | maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name); | 4012 | maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name); |
| 4012 | } | 4013 | } |
| 4013 | 4014 | ||
diff --git a/src/termhooks.h b/src/termhooks.h index 211429169ba..4e341055100 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -733,6 +733,7 @@ extern struct terminal *get_named_terminal (const char *); | |||
| 733 | extern struct terminal *create_terminal (enum output_method, | 733 | extern struct terminal *create_terminal (enum output_method, |
| 734 | struct redisplay_interface *); | 734 | struct redisplay_interface *); |
| 735 | extern void delete_terminal (struct terminal *); | 735 | extern void delete_terminal (struct terminal *); |
| 736 | extern void delete_terminal_internal (struct terminal *); | ||
| 736 | extern Lisp_Object terminal_glyph_code (struct terminal *, int); | 737 | extern Lisp_Object terminal_glyph_code (struct terminal *, int); |
| 737 | 738 | ||
| 738 | /* The initial terminal device, created by initial_term_init. */ | 739 | /* The initial terminal device, created by initial_term_init. */ |
diff --git a/src/terminal.c b/src/terminal.c index 18982fe7044..e4803592575 100644 --- a/src/terminal.c +++ b/src/terminal.c | |||
| @@ -314,7 +314,6 @@ create_terminal (enum output_method type, struct redisplay_interface *rif) | |||
| 314 | void | 314 | void |
| 315 | delete_terminal (struct terminal *terminal) | 315 | delete_terminal (struct terminal *terminal) |
| 316 | { | 316 | { |
| 317 | struct terminal **tp; | ||
| 318 | Lisp_Object tail, frame; | 317 | Lisp_Object tail, frame; |
| 319 | 318 | ||
| 320 | /* Protect against recursive calls. delete_frame calls the | 319 | /* Protect against recursive calls. delete_frame calls the |
| @@ -335,6 +334,14 @@ delete_terminal (struct terminal *terminal) | |||
| 335 | } | 334 | } |
| 336 | } | 335 | } |
| 337 | 336 | ||
| 337 | delete_terminal_internal (terminal); | ||
| 338 | } | ||
| 339 | |||
| 340 | void | ||
| 341 | delete_terminal_internal (struct terminal *terminal) | ||
| 342 | { | ||
| 343 | struct terminal **tp; | ||
| 344 | |||
| 338 | for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal) | 345 | for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal) |
| 339 | if (! *tp) | 346 | if (! *tp) |
| 340 | emacs_abort (); | 347 | emacs_abort (); |