diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 38 | ||||
| -rw-r--r-- | src/xdisp.c | 75 |
2 files changed, 101 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5df0e83b364..c9db3f69cf2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,41 @@ | |||
| 1 | 2005-10-29 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_fontified_prop): Do nothing if memory full. | ||
| 4 | (format_mode_line_unwind_data): New arg SAVE_PROPTRANS | ||
| 5 | controls whether to save and restore mode_line_proptrans_alist. | ||
| 6 | Callers changed. | ||
| 7 | (unwind_format_mode_line): Work with that feature. | ||
| 8 | (redisplay_internal): Don't call prepare_menu_bars if memory full. | ||
| 9 | (move_elt_to_front): New function. | ||
| 10 | (display_mode_element): Use move_elt_to_front. | ||
| 11 | Don't bother munging text props on a null string. | ||
| 12 | Delete obsolete elts from mode_line_proptrans_alist. | ||
| 13 | (decode_mode_spec): Test Vmemory_full, not spare_memory. | ||
| 14 | |||
| 15 | * lisp.h (memory_full_cons_threshold): Declared. | ||
| 16 | (internal_lisp_condition_case): Declared. | ||
| 17 | |||
| 18 | * alloc.c (syms_of_alloc) <memory-full>: Doc fix. | ||
| 19 | (Fmemory_full_p): Function deleted. | ||
| 20 | (syms_of_alloc): Don't defsubr it. | ||
| 21 | (memory_full_cons_threshold): New variable. | ||
| 22 | (spare_memory): Now a vector of 7 elts. | ||
| 23 | (buffer_memory_full): Don't set Vmemory_full here. | ||
| 24 | (xfree): Don't try to refill here. | ||
| 25 | (emacs_blocked_free): Record BYTES_USED in local var. | ||
| 26 | (memory_full): Now free all the slots in spare_memory. | ||
| 27 | (refill_memory_reserve): Allocate each slot in spare_memory. | ||
| 28 | (init_alloc_once): Call refill_memory_reserve. | ||
| 29 | |||
| 30 | * keyboard.c (command_loop_1): Don't set Vmemory_full here. | ||
| 31 | |||
| 32 | * eval.c (internal_lisp_condition_case): New function. | ||
| 33 | (Fcondition_case): Use internal_lisp_condition_case. | ||
| 34 | (Feval): Test Vmemory_full and memory_full_cons_threshold. | ||
| 35 | (Ffuncall): Likewise. | ||
| 36 | |||
| 37 | * bytecode.c (Fbyte_code): Use internal_lisp_condition_case. | ||
| 38 | |||
| 1 | 2005-10-29 Stefan Monnier <monnier@iro.umontreal.ca> | 39 | 2005-10-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 40 | ||
| 3 | * syntax.c (Fparse_partial_sexp): Fix docstring. | 41 | * syntax.c (Fparse_partial_sexp): Fix docstring. |
diff --git a/src/xdisp.c b/src/xdisp.c index 973528bebf5..88090f7b212 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3176,6 +3176,9 @@ handle_fontified_prop (it) | |||
| 3176 | Lisp_Object prop, pos; | 3176 | Lisp_Object prop, pos; |
| 3177 | enum prop_handled handled = HANDLED_NORMALLY; | 3177 | enum prop_handled handled = HANDLED_NORMALLY; |
| 3178 | 3178 | ||
| 3179 | if (!NILP (Vmemory_full)) | ||
| 3180 | return handled; | ||
| 3181 | |||
| 3179 | /* Get the value of the `fontified' property at IT's current buffer | 3182 | /* Get the value of the `fontified' property at IT's current buffer |
| 3180 | position. (The `fontified' property doesn't have a special | 3183 | position. (The `fontified' property doesn't have a special |
| 3181 | meaning in strings.) If the value is nil, call functions from | 3184 | meaning in strings.) If the value is nil, call functions from |
| @@ -8616,7 +8619,7 @@ static Lisp_Object mode_line_string_face_prop; | |||
| 8616 | static Lisp_Object Vmode_line_unwind_vector; | 8619 | static Lisp_Object Vmode_line_unwind_vector; |
| 8617 | 8620 | ||
| 8618 | static Lisp_Object | 8621 | static Lisp_Object |
| 8619 | format_mode_line_unwind_data (obuf) | 8622 | format_mode_line_unwind_data (obuf, save_proptrans) |
| 8620 | struct buffer *obuf; | 8623 | struct buffer *obuf; |
| 8621 | { | 8624 | { |
| 8622 | Lisp_Object vector; | 8625 | Lisp_Object vector; |
| @@ -8632,7 +8635,7 @@ format_mode_line_unwind_data (obuf) | |||
| 8632 | AREF (vector, 0) = make_number (mode_line_target); | 8635 | AREF (vector, 0) = make_number (mode_line_target); |
| 8633 | AREF (vector, 1) = make_number (MODE_LINE_NOPROP_LEN (0)); | 8636 | AREF (vector, 1) = make_number (MODE_LINE_NOPROP_LEN (0)); |
| 8634 | AREF (vector, 2) = mode_line_string_list; | 8637 | AREF (vector, 2) = mode_line_string_list; |
| 8635 | AREF (vector, 3) = mode_line_proptrans_alist; | 8638 | AREF (vector, 3) = (save_proptrans ? mode_line_proptrans_alist : Qt); |
| 8636 | AREF (vector, 4) = mode_line_string_face; | 8639 | AREF (vector, 4) = mode_line_string_face; |
| 8637 | AREF (vector, 5) = mode_line_string_face_prop; | 8640 | AREF (vector, 5) = mode_line_string_face_prop; |
| 8638 | 8641 | ||
| @@ -8651,7 +8654,8 @@ unwind_format_mode_line (vector) | |||
| 8651 | mode_line_target = XINT (AREF (vector, 0)); | 8654 | mode_line_target = XINT (AREF (vector, 0)); |
| 8652 | mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1)); | 8655 | mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1)); |
| 8653 | mode_line_string_list = AREF (vector, 2); | 8656 | mode_line_string_list = AREF (vector, 2); |
| 8654 | mode_line_proptrans_alist = AREF (vector, 3); | 8657 | if (! EQ (AREF (vector, 3), Qt)) |
| 8658 | mode_line_proptrans_alist = AREF (vector, 3); | ||
| 8655 | mode_line_string_face = AREF (vector, 4); | 8659 | mode_line_string_face = AREF (vector, 4); |
| 8656 | mode_line_string_face_prop = AREF (vector, 5); | 8660 | mode_line_string_face_prop = AREF (vector, 5); |
| 8657 | 8661 | ||
| @@ -8774,7 +8778,7 @@ x_consider_frame_title (frame) | |||
| 8774 | mode_line_target so that display_mode_element will output into | 8778 | mode_line_target so that display_mode_element will output into |
| 8775 | mode_line_noprop_buf; then display the title. */ | 8779 | mode_line_noprop_buf; then display the title. */ |
| 8776 | record_unwind_protect (unwind_format_mode_line, | 8780 | record_unwind_protect (unwind_format_mode_line, |
| 8777 | format_mode_line_unwind_data (current_buffer)); | 8781 | format_mode_line_unwind_data (current_buffer, 0)); |
| 8778 | 8782 | ||
| 8779 | set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); | 8783 | set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); |
| 8780 | fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; | 8784 | fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; |
| @@ -10571,7 +10575,8 @@ redisplay_internal (preserve_echo_area) | |||
| 10571 | clear_garbaged_frames (); | 10575 | clear_garbaged_frames (); |
| 10572 | 10576 | ||
| 10573 | /* Build menubar and tool-bar items. */ | 10577 | /* Build menubar and tool-bar items. */ |
| 10574 | prepare_menu_bars (); | 10578 | if (NILP (Vmemory_full)) |
| 10579 | prepare_menu_bars (); | ||
| 10575 | 10580 | ||
| 10576 | if (windows_or_buffers_changed) | 10581 | if (windows_or_buffers_changed) |
| 10577 | update_mode_lines++; | 10582 | update_mode_lines++; |
| @@ -16159,7 +16164,7 @@ display_mode_line (w, face_id, format) | |||
| 16159 | it.base_face_id = it.face_id = DEFAULT_FACE_ID; | 16164 | it.base_face_id = it.face_id = DEFAULT_FACE_ID; |
| 16160 | 16165 | ||
| 16161 | record_unwind_protect (unwind_format_mode_line, | 16166 | record_unwind_protect (unwind_format_mode_line, |
| 16162 | format_mode_line_unwind_data (NULL)); | 16167 | format_mode_line_unwind_data (NULL, 0)); |
| 16163 | 16168 | ||
| 16164 | mode_line_target = MODE_LINE_DISPLAY; | 16169 | mode_line_target = MODE_LINE_DISPLAY; |
| 16165 | 16170 | ||
| @@ -16194,6 +16199,44 @@ display_mode_line (w, face_id, format) | |||
| 16194 | return it.glyph_row->height; | 16199 | return it.glyph_row->height; |
| 16195 | } | 16200 | } |
| 16196 | 16201 | ||
| 16202 | /* Move element ELT in LIST to the front of LIST. | ||
| 16203 | Return the updated list. */ | ||
| 16204 | |||
| 16205 | static Lisp_Object | ||
| 16206 | move_elt_to_front (elt, list) | ||
| 16207 | Lisp_Object elt, list; | ||
| 16208 | { | ||
| 16209 | register Lisp_Object tail, prev; | ||
| 16210 | register Lisp_Object tem; | ||
| 16211 | |||
| 16212 | tail = list; | ||
| 16213 | prev = Qnil; | ||
| 16214 | while (CONSP (tail)) | ||
| 16215 | { | ||
| 16216 | tem = XCAR (tail); | ||
| 16217 | |||
| 16218 | if (EQ (elt, tem)) | ||
| 16219 | { | ||
| 16220 | /* Splice out the link TAIL. */ | ||
| 16221 | if (NILP (prev)) | ||
| 16222 | list = XCDR (tail); | ||
| 16223 | else | ||
| 16224 | Fsetcdr (prev, XCDR (tail)); | ||
| 16225 | |||
| 16226 | /* Now make it the first. */ | ||
| 16227 | Fsetcdr (tail, list); | ||
| 16228 | return tail; | ||
| 16229 | } | ||
| 16230 | else | ||
| 16231 | prev = tail; | ||
| 16232 | tail = XCDR (tail); | ||
| 16233 | QUIT; | ||
| 16234 | } | ||
| 16235 | |||
| 16236 | /* Not found--return unchanged LIST. */ | ||
| 16237 | return list; | ||
| 16238 | } | ||
| 16239 | |||
| 16197 | /* Contribute ELT to the mode line for window IT->w. How it | 16240 | /* Contribute ELT to the mode line for window IT->w. How it |
| 16198 | translates into text depends on its data type. | 16241 | translates into text depends on its data type. |
| 16199 | 16242 | ||
| @@ -16243,7 +16286,8 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) | |||
| 16243 | unsigned char c; | 16286 | unsigned char c; |
| 16244 | int offset = 0; | 16287 | int offset = 0; |
| 16245 | 16288 | ||
| 16246 | if (!NILP (props) || risky) | 16289 | if (SCHARS (elt) > 0 |
| 16290 | && (!NILP (props) || risky)) | ||
| 16247 | { | 16291 | { |
| 16248 | Lisp_Object oprops, aelt; | 16292 | Lisp_Object oprops, aelt; |
| 16249 | oprops = Ftext_properties_at (make_number (0), elt); | 16293 | oprops = Ftext_properties_at (make_number (0), elt); |
| @@ -16274,14 +16318,22 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) | |||
| 16274 | aelt = Fassoc (elt, mode_line_proptrans_alist); | 16318 | aelt = Fassoc (elt, mode_line_proptrans_alist); |
| 16275 | if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt)))) | 16319 | if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt)))) |
| 16276 | { | 16320 | { |
| 16277 | mode_line_proptrans_alist | 16321 | /* AELT is what we want. Move it to the front |
| 16278 | = Fcons (aelt, Fdelq (aelt, mode_line_proptrans_alist)); | 16322 | without consing. */ |
| 16279 | elt = XCAR (aelt); | 16323 | elt = XCAR (aelt); |
| 16324 | mode_line_proptrans_alist | ||
| 16325 | = move_elt_to_front (aelt, mode_line_proptrans_alist); | ||
| 16280 | } | 16326 | } |
| 16281 | else | 16327 | else |
| 16282 | { | 16328 | { |
| 16283 | Lisp_Object tem; | 16329 | Lisp_Object tem; |
| 16284 | 16330 | ||
| 16331 | /* If AELT has the wrong props, it is useless. | ||
| 16332 | so get rid of it. */ | ||
| 16333 | if (! NILP (aelt)) | ||
| 16334 | mode_line_proptrans_alist | ||
| 16335 | = Fdelq (aelt, mode_line_proptrans_alist); | ||
| 16336 | |||
| 16285 | elt = Fcopy_sequence (elt); | 16337 | elt = Fcopy_sequence (elt); |
| 16286 | Fset_text_properties (make_number (0), Flength (elt), | 16338 | Fset_text_properties (make_number (0), Flength (elt), |
| 16287 | props, elt); | 16339 | props, elt); |
| @@ -16807,7 +16859,7 @@ are the selected window and the window's buffer). */) | |||
| 16807 | old_buffer = current_buffer; | 16859 | old_buffer = current_buffer; |
| 16808 | 16860 | ||
| 16809 | record_unwind_protect (unwind_format_mode_line, | 16861 | record_unwind_protect (unwind_format_mode_line, |
| 16810 | format_mode_line_unwind_data (old_buffer)); | 16862 | format_mode_line_unwind_data (old_buffer, 1)); |
| 16811 | 16863 | ||
| 16812 | if (old_buffer) | 16864 | if (old_buffer) |
| 16813 | set_buffer_internal_1 (XBUFFER (buffer)); | 16865 | set_buffer_internal_1 (XBUFFER (buffer)); |
| @@ -17195,8 +17247,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte) | |||
| 17195 | case 'e': | 17247 | case 'e': |
| 17196 | #ifndef SYSTEM_MALLOC | 17248 | #ifndef SYSTEM_MALLOC |
| 17197 | { | 17249 | { |
| 17198 | extern char *spare_memory; | 17250 | if (NILP (Vmemory_full)) |
| 17199 | if (spare_memory) | ||
| 17200 | return ""; | 17251 | return ""; |
| 17201 | else | 17252 | else |
| 17202 | return "!MEM FULL! "; | 17253 | return "!MEM FULL! "; |