diff options
| author | Paul Eggert | 2017-12-15 09:07:52 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-12-15 09:08:27 -0800 |
| commit | e019c35df60a306750e1025db99c36701a726ecb (patch) | |
| tree | 1f7f35715aa20cbbb6c63ee1091161906f00980e | |
| parent | d64b88da2fcc23cb0676fca382b4ddc7d1b68020 (diff) | |
| download | emacs-e019c35df60a306750e1025db99c36701a726ecb.tar.gz emacs-e019c35df60a306750e1025db99c36701a726ecb.zip | |
FOR_EACH_FRAME no longer assumes frame-list
This cleans up a recent fix related to Bug#29661.
Suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2017-12/msg00544.html
* src/frame.c (next_frame, prev_frame, delete_frame):
Restore debugging checks that Vframe_list is non-nil,
as FOR_EACH_FRAME no longer has these checks.
(delete_frame): Remove no-longer-needed checks that Vframe_list is
non-nil, as FOR_EACH_FRAME no longer assumes that.
* src/frame.h (FOR_EACH_FRAME): Do not assume Vframe_list is non-nil.
| -rw-r--r-- | src/frame.c | 13 | ||||
| -rw-r--r-- | src/frame.h | 5 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/frame.c b/src/frame.c index 66d1b5c759e..63fa8abb7da 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1607,6 +1607,8 @@ next_frame (Lisp_Object frame, Lisp_Object minibuf) | |||
| 1607 | Lisp_Object f, tail; | 1607 | Lisp_Object f, tail; |
| 1608 | int passed = 0; | 1608 | int passed = 0; |
| 1609 | 1609 | ||
| 1610 | eassume (CONSP (Vframe_list)); | ||
| 1611 | |||
| 1610 | while (passed < 2) | 1612 | while (passed < 2) |
| 1611 | FOR_EACH_FRAME (tail, f) | 1613 | FOR_EACH_FRAME (tail, f) |
| 1612 | { | 1614 | { |
| @@ -1629,6 +1631,8 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf) | |||
| 1629 | { | 1631 | { |
| 1630 | Lisp_Object f, tail, prev = Qnil; | 1632 | Lisp_Object f, tail, prev = Qnil; |
| 1631 | 1633 | ||
| 1634 | eassume (CONSP (Vframe_list)); | ||
| 1635 | |||
| 1632 | FOR_EACH_FRAME (tail, f) | 1636 | FOR_EACH_FRAME (tail, f) |
| 1633 | { | 1637 | { |
| 1634 | if (EQ (frame, f) && !NILP (prev)) | 1638 | if (EQ (frame, f) && !NILP (prev)) |
| @@ -1914,6 +1918,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1914 | if (f == sf) | 1918 | if (f == sf) |
| 1915 | { | 1919 | { |
| 1916 | Lisp_Object tail; | 1920 | Lisp_Object tail; |
| 1921 | eassume (CONSP (Vframe_list)); | ||
| 1917 | 1922 | ||
| 1918 | /* Look for another visible frame on the same terminal. | 1923 | /* Look for another visible frame on the same terminal. |
| 1919 | Do not call next_frame here because it may loop forever. | 1924 | Do not call next_frame here because it may loop forever. |
| @@ -2058,7 +2063,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 2058 | 2063 | ||
| 2059 | /* If we've deleted the last_nonminibuf_frame, then try to find | 2064 | /* If we've deleted the last_nonminibuf_frame, then try to find |
| 2060 | another one. */ | 2065 | another one. */ |
| 2061 | if (f == last_nonminibuf_frame && !NILP (Vframe_list)) | 2066 | if (f == last_nonminibuf_frame) |
| 2062 | { | 2067 | { |
| 2063 | last_nonminibuf_frame = 0; | 2068 | last_nonminibuf_frame = 0; |
| 2064 | 2069 | ||
| @@ -2076,7 +2081,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 2076 | 2081 | ||
| 2077 | /* If there's no other frame on the same kboard, get out of | 2082 | /* If there's no other frame on the same kboard, get out of |
| 2078 | single-kboard state if we're in it for this kboard. */ | 2083 | single-kboard state if we're in it for this kboard. */ |
| 2079 | if (kb != NULL && !NILP (Vframe_list)) | 2084 | if (kb != NULL) |
| 2080 | { | 2085 | { |
| 2081 | /* Some frame we found on the same kboard, or nil if there are none. */ | 2086 | /* Some frame we found on the same kboard, or nil if there are none. */ |
| 2082 | Lisp_Object frame_on_same_kboard = Qnil; | 2087 | Lisp_Object frame_on_same_kboard = Qnil; |
| @@ -2093,9 +2098,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 2093 | /* If we've deleted this keyboard's default_minibuffer_frame, try to | 2098 | /* If we've deleted this keyboard's default_minibuffer_frame, try to |
| 2094 | find another one. Prefer minibuffer-only frames, but also notice | 2099 | find another one. Prefer minibuffer-only frames, but also notice |
| 2095 | frames with other windows. */ | 2100 | frames with other windows. */ |
| 2096 | if (kb != NULL | 2101 | if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) |
| 2097 | && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)) | ||
| 2098 | && !NILP (Vframe_list)) | ||
| 2099 | { | 2102 | { |
| 2100 | /* The last frame we saw with a minibuffer, minibuffer-only or not. */ | 2103 | /* The last frame we saw with a minibuffer, minibuffer-only or not. */ |
| 2101 | Lisp_Object frame_with_minibuf = Qnil; | 2104 | Lisp_Object frame_with_minibuf = Qnil; |
diff --git a/src/frame.h b/src/frame.h index a3b77636435..a5d4e4fc88b 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1149,8 +1149,7 @@ default_pixels_per_inch_y (void) | |||
| 1149 | /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a | 1149 | /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a |
| 1150 | `for' loop which iterates over the elements of Vframe_list. The | 1150 | `for' loop which iterates over the elements of Vframe_list. The |
| 1151 | loop will set FRAME_VAR, a Lisp_Object, to each frame in | 1151 | loop will set FRAME_VAR, a Lisp_Object, to each frame in |
| 1152 | Vframe_list in succession and execute the statement. Vframe_list | 1152 | Vframe_list in succession and execute the statement. LIST_VAR |
| 1153 | should be nonempty, so the body is executed at least once. LIST_VAR | ||
| 1154 | should be a Lisp_Object too; it is used to iterate through the | 1153 | should be a Lisp_Object too; it is used to iterate through the |
| 1155 | Vframe_list. Note that this macro walks over child frames and | 1154 | Vframe_list. Note that this macro walks over child frames and |
| 1156 | the tooltip frame as well. | 1155 | the tooltip frame as well. |
| @@ -1160,7 +1159,7 @@ default_pixels_per_inch_y (void) | |||
| 1160 | something which executes the statement once. */ | 1159 | something which executes the statement once. */ |
| 1161 | 1160 | ||
| 1162 | #define FOR_EACH_FRAME(list_var, frame_var) \ | 1161 | #define FOR_EACH_FRAME(list_var, frame_var) \ |
| 1163 | for ((list_var) = (eassume (CONSP (Vframe_list)), Vframe_list); \ | 1162 | for ((list_var) = Vframe_list; \ |
| 1164 | (CONSP (list_var) \ | 1163 | (CONSP (list_var) \ |
| 1165 | && (frame_var = XCAR (list_var), true)); \ | 1164 | && (frame_var = XCAR (list_var), true)); \ |
| 1166 | list_var = XCDR (list_var)) | 1165 | list_var = XCDR (list_var)) |