diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 89 | ||||
-rw-r--r-- | src/bidi.c | 160 | ||||
-rw-r--r-- | src/buffer.c | 4 | ||||
-rw-r--r-- | src/dbusbind.c | 7 | ||||
-rw-r--r-- | src/dispnew.c | 4 | ||||
-rw-r--r-- | src/emacs.c | 16 | ||||
-rw-r--r-- | src/indent.c | 105 | ||||
-rw-r--r-- | src/minibuf.c | 4 | ||||
-rw-r--r-- | src/window.c | 22 | ||||
-rw-r--r-- | src/xdisp.c | 169 |
10 files changed, 413 insertions, 167 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d3ab346a380..312951457e4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -164,8 +164,8 @@ (Fdefine_coding_system_internal): Don't assume fixnums fit in int. (decode_coding_gap, decode_coding_object, encode_coding_object) - (Fread_coding_system, Fdetect_coding_region, Funencodable_char_position) - (Fcheck_coding_systems_region): + (Fread_coding_system, Fdetect_coding_region) + (Funencodable_char_position, Fcheck_coding_systems_region): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Ffind_operation_coding_system): NATNUMP can eval its arg twice. (Fdefine_coding_system_internal): Check for charset-id overflow. @@ -199,7 +199,6 @@ (Frem): Don't assume arg is nonnegative. * dbusbind.c (xd_append_arg): Check for integers out of range. (Fdbus_call_method): Don't overflow the timeout int. - * dired.c (directory_files_internal, file_name_completion, scmp) (file_name_completion_stat): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. @@ -286,8 +285,8 @@ (Fdo_auto_save, Fset_buffer_auto_saved) (Fclear_buffer_auto_save_failure): Don't assume time_t is signed, or that it fits in int. - * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec) - (concat, string_char_byte_cache_charpos, string_char_byte_cache_bytepos) + * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec, concat) + (string_char_byte_cache_charpos, string_char_byte_cache_bytepos) (string_char_to_byte, string_byte_to_char) (string_make_multibyte, string_to_multibyte) (string_make_unibyte, Fstring_as_unibyte, Fstring_as_multibyte) @@ -364,7 +363,7 @@ (update_frame_tool_bar): Check that fixnums are in proper range for system types. * image.c (parse_image_spec): Redo count calculation to avoid overflow. - (lookup_image): Check that fixnums are in proper range for system types. + (lookup_image): Check that fixnums are in range for system types. * indent.c (last_known_column, last_known_column_point): (current_column_bol_cache): (skip_invisible, current_column, check_display_width): @@ -582,8 +581,8 @@ Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * syntax.c (ST_COMMENT_STYLE, ST_STRING_STYLE): In definitions, make it clearer that these values must be out of range - for the respective integer ranges. This fixes a bug with ST_STRING_STYLE - and non-ASCII characters. + for the respective integer ranges. This fixes a bug with + ST_STRING_STYLE and non-ASCII characters. (struct lisp_parse_state, find_start_modiff) (Finternal_describe_syntax_value, scan_lists, scan_sexps_forward): (Fparse_partial_sexp): @@ -628,7 +627,8 @@ (Fnext_single_char_property_change) (Fprevious_single_char_property_change): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. - (copy_text_properties): Check for integer overflow in index calculation. + (copy_text_properties): + Check for integer overflow in index calculation. * undo.c (last_boundary_position, record_point, record_insert) (record_delete, record_marker_adjustment, record_change) (record_property_change): @@ -646,7 +646,7 @@ Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fset_window_hscroll, run_window_configuration_change_hook) (set_window_buffer, temp_output_buffer_show, scroll_command) - (Fscroll_other_window): + (Fscroll_other_window, Frecenter): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fwindow_line_height, window_scroll, Fscroll_left, Fscroll_right): Don't assume fixnum fits in int. @@ -657,8 +657,8 @@ (in_ellipses_for_invisible_text_p, init_from_display_pos) (compute_stop_pos, next_overlay_change, compute_display_string_pos) (compute_display_string_end, handle_face_prop) - (face_before_or_after_it_pos, handle_invisible_prop, handle_display_prop) - (handle_display_spec, handle_single_display_spec) + (face_before_or_after_it_pos, handle_invisible_prop) + (handle_display_prop, handle_display_spec, handle_single_display_spec) (display_prop_intangible_p, string_buffer_position_lim) (string_buffer_position, handle_composition_prop, load_overlay_strings) (get_overlay_strings_1, get_overlay_strings) @@ -697,8 +697,8 @@ (display_echo_area, echo_area_display) (x_consider_frame_title, prepare_menu_bars, update_menu_bar) (update_tool_bar, hscroll_window_tree, redisplay_internal) - (redisplay_window, dump_glyph_row, display_mode_line, Fformat_mode_line) - (decode_mode_spec, on_hot_spot_p): + (redisplay_window, dump_glyph_row, display_mode_line) + (Fformat_mode_line, decode_mode_spec, on_hot_spot_p): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (handle_single_display_spec, build_desired_tool_bar_string) (redisplay_tool_bar, scroll_window_tree, Fdump_glyph_matrix) @@ -767,6 +767,67 @@ rather than rolling our own approximation. (SCROLL_BAR_VEC_SIZE): Remove; not used. +2011-09-25 Glenn Morris <rgm@gnu.org> + + * buffer.c (truncate-lines): Doc fix. + +2011-09-24 Chong Yidong <cyd@stupidchicken.com> + + * window.c (Fwindow_prev_buffers, Fset_window_prev_buffers) + (Fset_window_next_buffers): Doc fix. + +2011-09-24 Glenn Morris <rgm@gnu.org> + + * minibuf.c (read_minibuf): Disable line truncation. (Bug#5715) + +2011-09-24 Paul Eggert <eggert@cs.ucla.edu> + + Fix minor problems found by static checking. + * xdisp.c (string_from_display_spec): Don't assume vecsize fits in int. + * indent.c (Fvertical_motion): Fix == vs = typo. + +2011-09-24 Eli Zaretskii <eliz@gnu.org> + + * dispnew.c (syms_of_display) <redisplay-dont-pause>: Default + value is now t. Doc fix. + + * indent.c (Fvertical_motion): Compute and apply the overshoot + logic when moving up, not only when moving down. Fix the + confusing name and values of the it_overshoot_expected variable; + logic changes accordingly. (Bug#9254) (Bug#9549) + + * xdisp.c (pos_visible_p): Produce correct pixel coordinates when + CHARPOS is covered by a display string which includes newlines. + (move_it_vertically_backward): Avoid inflooping when START_CHARPOS + is covered by a display string with embedded newlines. + +2011-09-24 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (Fdbus_register_signal): Add match rule to + Vdbus_registered_objects_table. (Bug#9581) + (Fdbus_register_method, Vdbus_registered_objects_table): Fix + docstring. + +2011-09-24 Jim Meyering <meyering@redhat.com> + + do not ignore write error for any output size + The previous change was incomplete. + While it makes emacs --batch detect the vast majority of stdout + write failures, errors were still ignored whenever the output size is + k * (BUFSIZ+1) - 4. E.g., on a system with BUFSIZ of 4096, + $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \ + && echo FAIL: ignored write error + FAIL: ignored write error + $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \ + && echo FAIL: ignored write error + FAIL: ignored write error + * emacs.c (Fkill_emacs): Also test ferror. (Bug#9574) + +2011-09-23 Andreas Schwab <schwab@linux-m68k.org> + + * emacs.c (Fkill_emacs): In noninteractive mode exit + non-successfully if a write error occurred on stdout. (Bug#9574) + 2011-09-21 Eli Zaretskii <eliz@gnu.org> * xdisp.c (pop_it): Allow it->object that is a cons cell to pass diff --git a/src/bidi.c b/src/bidi.c index fc42a0f6bdb..c7b3a770597 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -222,7 +222,7 @@ bidi_mirror_char (int c) static inline void bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) { - int higher_level = level_before > level_after ? level_before : level_after; + int higher_level = (level_before > level_after ? level_before : level_after); /* The prev_was_pdf gork is required for when we have several PDFs in a row. In that case, we want to compute the sor type for the @@ -233,18 +233,18 @@ bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) level to which we descend after processing all the PDFs. */ if (!bidi_it->prev_was_pdf || level_before < level_after) /* FIXME: should the default sor direction be user selectable? */ - bidi_it->sor = (higher_level & 1) != 0 ? R2L : L2R; + bidi_it->sor = ((higher_level & 1) != 0 ? R2L : L2R); if (level_before > level_after) bidi_it->prev_was_pdf = 1; bidi_it->prev.type = UNKNOWN_BT; - bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = - bidi_it->last_strong.orig_type = UNKNOWN_BT; - bidi_it->prev_for_neutral.type = bidi_it->sor == R2L ? STRONG_R : STRONG_L; + bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 + = bidi_it->last_strong.orig_type = UNKNOWN_BT; + bidi_it->prev_for_neutral.type = (bidi_it->sor == R2L ? STRONG_R : STRONG_L); bidi_it->prev_for_neutral.charpos = bidi_it->charpos; bidi_it->prev_for_neutral.bytepos = bidi_it->bytepos; - bidi_it->next_for_neutral.type = bidi_it->next_for_neutral.type_after_w1 = - bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; + bidi_it->next_for_neutral.type = bidi_it->next_for_neutral.type_after_w1 + = bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; bidi_it->ignore_bn_limit = -1; /* meaning it's unknown */ } @@ -325,10 +325,10 @@ static int bidi_cache_sp; /* Size of header used by bidi_shelve_cache. */ enum { - bidi_shelve_header_size = - (sizeof (bidi_cache_idx) + sizeof (bidi_cache_start_stack) - + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) - + sizeof (bidi_cache_last_idx)) + bidi_shelve_header_size + = (sizeof (bidi_cache_idx) + sizeof (bidi_cache_start_stack) + + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) + + sizeof (bidi_cache_last_idx)) }; /* Reset the cache state to the empty state. We only reset the part @@ -353,8 +353,8 @@ bidi_cache_shrink (void) { if (bidi_cache_size > BIDI_CACHE_CHUNK) { - bidi_cache = - (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); + bidi_cache + = (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); bidi_cache_size = BIDI_CACHE_CHUNK; } bidi_cache_reset (); @@ -490,17 +490,17 @@ bidi_cache_ensure_space (ptrdiff_t idx) { /* The bidi cache cannot be larger than the largest Lisp string or buffer. */ - ptrdiff_t string_or_buffer_bound = - max (BUF_BYTES_MAX, STRING_BYTES_BOUND); + ptrdiff_t string_or_buffer_bound + = max (BUF_BYTES_MAX, STRING_BYTES_BOUND); /* Also, it cannot be larger than what C can represent. */ - ptrdiff_t c_bound = - (min (PTRDIFF_MAX, SIZE_MAX) - bidi_shelve_header_size) / elsz; + ptrdiff_t c_bound + = (min (PTRDIFF_MAX, SIZE_MAX) - bidi_shelve_header_size) / elsz; - bidi_cache = - xpalloc (bidi_cache, &bidi_cache_size, - max (BIDI_CACHE_CHUNK, idx - bidi_cache_size + 1), - min (string_or_buffer_bound, c_bound), elsz); + bidi_cache + = xpalloc (bidi_cache, &bidi_cache_size, + max (BIDI_CACHE_CHUNK, idx - bidi_cache_size + 1), + min (string_or_buffer_bound, c_bound), elsz); } } @@ -708,8 +708,8 @@ bidi_unshelve_cache (void *databuf, int just_free) ptrdiff_t idx; memcpy (&idx, p, sizeof (bidi_cache_idx)); - bidi_cache_total_alloc -= - bidi_shelve_header_size + idx * sizeof (struct bidi_it); + bidi_cache_total_alloc + -= bidi_shelve_header_size + idx * sizeof (struct bidi_it); } else { @@ -737,8 +737,9 @@ bidi_unshelve_cache (void *databuf, int just_free) + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start), sizeof (bidi_cache_last_idx)); - bidi_cache_total_alloc -= - bidi_shelve_header_size + bidi_cache_idx * sizeof (struct bidi_it); + bidi_cache_total_alloc + -= (bidi_shelve_header_size + + bidi_cache_idx * sizeof (struct bidi_it)); } xfree (p); @@ -813,18 +814,18 @@ bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p, bidi_it->type_after_w1 = NEUTRAL_B; bidi_it->orig_type = NEUTRAL_B; bidi_it->prev_was_pdf = 0; - bidi_it->prev.type = bidi_it->prev.type_after_w1 = - bidi_it->prev.orig_type = UNKNOWN_BT; - bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = - bidi_it->last_strong.orig_type = UNKNOWN_BT; + bidi_it->prev.type = bidi_it->prev.type_after_w1 + = bidi_it->prev.orig_type = UNKNOWN_BT; + bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 + = bidi_it->last_strong.orig_type = UNKNOWN_BT; bidi_it->next_for_neutral.charpos = -1; - bidi_it->next_for_neutral.type = - bidi_it->next_for_neutral.type_after_w1 = - bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; + bidi_it->next_for_neutral.type + = bidi_it->next_for_neutral.type_after_w1 + = bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; bidi_it->prev_for_neutral.charpos = -1; - bidi_it->prev_for_neutral.type = - bidi_it->prev_for_neutral.type_after_w1 = - bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; + bidi_it->prev_for_neutral.type + = bidi_it->prev_for_neutral.type_after_w1 + = bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */ bidi_it->disp_pos = -1; /* invalid/unknown */ bidi_it->disp_prop = 0; @@ -848,7 +849,7 @@ bidi_line_init (struct bidi_it *bidi_it) bidi_it->next_en_pos = -1; bidi_it->next_for_ws.type = UNKNOWN_BT; bidi_set_sor_type (bidi_it, - bidi_it->paragraph_dir == R2L ? 1 : 0, + (bidi_it->paragraph_dir == R2L ? 1 : 0), bidi_it->level_stack[0].level); /* X10 */ bidi_cache_reset (); @@ -925,8 +926,8 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, int frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) { int ch; - ptrdiff_t endpos = - (string->s || STRINGP (string->lstring)) ? string->schars : ZV; + ptrdiff_t endpos + = (string->s || STRINGP (string->lstring)) ? string->schars : ZV; struct text_pos pos; /* If we got past the last known position of display string, compute @@ -1173,8 +1174,9 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) we are potentially in a new paragraph that doesn't yet exist. */ pos = bidi_it->charpos; - s = STRINGP (bidi_it->string.lstring) ? - SDATA (bidi_it->string.lstring) : bidi_it->string.s; + s = (STRINGP (bidi_it->string.lstring) + ? SDATA (bidi_it->string.lstring) + : bidi_it->string.s); if (bytepos > begbyte && bidi_char_at_pos (bytepos, s, bidi_it->string.unibyte) == '\n') { @@ -1324,9 +1326,10 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) bidi_it->first_elt = 0; if (string_p) { - const unsigned char *p = - STRINGP (bidi_it->string.lstring) - ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; + const unsigned char *p + = (STRINGP (bidi_it->string.lstring) + ? SDATA (bidi_it->string.lstring) + : bidi_it->string.s); if (bidi_it->charpos < 0) bidi_it->charpos = 0; @@ -1509,8 +1512,10 @@ bidi_resolve_explicit (struct bidi_it *bidi_it) int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; int new_level = bidi_resolve_explicit_1 (bidi_it); ptrdiff_t eob = bidi_it->string.s ? bidi_it->string.schars : ZV; - const unsigned char *s = STRINGP (bidi_it->string.lstring) - ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; + const unsigned char *s + = (STRINGP (bidi_it->string.lstring) + ? SDATA (bidi_it->string.lstring) + : bidi_it->string.s); if (prev_level < new_level && bidi_it->type == WEAK_BN @@ -1594,9 +1599,9 @@ bidi_resolve_weak (struct bidi_it *bidi_it) int next_char; bidi_type_t type_of_next; struct bidi_it saved_it; - ptrdiff_t eob = - (STRINGP (bidi_it->string.lstring) || bidi_it->string.s) - ? bidi_it->string.schars : ZV; + ptrdiff_t eob + = ((STRINGP (bidi_it->string.lstring) || bidi_it->string.s) + ? bidi_it->string.schars : ZV); type = bidi_it->type; override = bidi_it->level_stack[bidi_it->stack_idx].override; @@ -1663,15 +1668,15 @@ bidi_resolve_weak (struct bidi_it *bidi_it) && bidi_it->prev.orig_type == WEAK_EN) || bidi_it->prev.type_after_w1 == WEAK_AN))) { - const unsigned char *s = - STRINGP (bidi_it->string.lstring) - ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; - - next_char = - bidi_it->charpos + bidi_it->nchars >= eob - ? BIDI_EOB - : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, - bidi_it->string.unibyte); + const unsigned char *s + = (STRINGP (bidi_it->string.lstring) + ? SDATA (bidi_it->string.lstring) + : bidi_it->string.s); + + next_char = (bidi_it->charpos + bidi_it->nchars >= eob + ? BIDI_EOB + : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, + s, bidi_it->string.unibyte)); type_of_next = bidi_get_type (next_char, override); if (type_of_next == WEAK_BN @@ -1720,17 +1725,17 @@ bidi_resolve_weak (struct bidi_it *bidi_it) else /* W5: ET/BN with EN after it. */ { ptrdiff_t en_pos = bidi_it->charpos + bidi_it->nchars; - const unsigned char *s = - STRINGP (bidi_it->string.lstring) - ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; + const unsigned char *s = (STRINGP (bidi_it->string.lstring) + ? SDATA (bidi_it->string.lstring) + : bidi_it->string.s); if (bidi_it->nchars <= 0) abort (); - next_char = - bidi_it->charpos + bidi_it->nchars >= eob - ? BIDI_EOB - : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, - bidi_it->string.unibyte); + next_char + = (bidi_it->charpos + bidi_it->nchars >= eob + ? BIDI_EOB + : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, + bidi_it->string.unibyte)); type_of_next = bidi_get_type (next_char, override); if (type_of_next == WEAK_ET @@ -1875,8 +1880,8 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) && bidi_get_category (type) != NEUTRAL) /* This is all per level run, so stop when we reach the end of this level run. */ - || bidi_it->level_stack[bidi_it->stack_idx].level != - current_level)); + || (bidi_it->level_stack[bidi_it->stack_idx].level + != current_level))); bidi_remember_char (&saved_it.next_for_neutral, bidi_it); @@ -1971,9 +1976,9 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) if (bidi_it->scan_dir == 1) { - ptrdiff_t eob = - (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) - ? bidi_it->string.schars : ZV; + ptrdiff_t eob + = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) + ? bidi_it->string.schars : ZV); /* There's no sense in trying to advance if we hit end of text. */ if (bidi_it->charpos >= eob) @@ -2018,9 +2023,8 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) UNKNOWN_BT. */ if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) { - int bob = - (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) ? 0 : 1; - + int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) + ? 0 : 1); if (bidi_it->scan_dir > 0) { if (bidi_it->nchars <= 0) @@ -2345,9 +2349,9 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) bidi_it->separator_limit = bidi_it->string.schars; else if (bidi_it->bytepos < ZV_BYTE) { - ptrdiff_t sep_len = - bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, - bidi_it->bytepos + bidi_it->ch_len); + ptrdiff_t sep_len + = bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, + bidi_it->bytepos + bidi_it->ch_len); if (bidi_it->nchars <= 0) abort (); if (sep_len >= 0) @@ -2355,8 +2359,8 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) bidi_it->new_paragraph = 1; /* Record the buffer position of the last character of the paragraph separator. */ - bidi_it->separator_limit = - bidi_it->charpos + bidi_it->nchars + sep_len; + bidi_it->separator_limit + = bidi_it->charpos + bidi_it->nchars + sep_len; } } } diff --git a/src/buffer.c b/src/buffer.c index 564dab689cd..2c7b426be84 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5497,7 +5497,9 @@ Instead, give each line of text just one screen line. Note that this is overridden by the variable `truncate-partial-width-windows' if that variable is non-nil -and this buffer is not full-frame width. */); +and this buffer is not full-frame width. + +Minibuffers set this variable to nil. */); DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, doc: /* *Non-nil means to use word-wrapping for continuation lines. diff --git a/src/dbusbind.c b/src/dbusbind.c index e930ad16fe1..0b6d6929a4d 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -2145,7 +2145,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG /* Create a hash table entry. */ key = list3 (bus, interface, signal); - key1 = list4 (uname, service, path, handler); + key1 = list5 (uname, service, path, handler, build_string (rule)); value = Fgethash (key, Vdbus_registered_objects_table, Qnil); if (NILP (Fmember (key1, value))) @@ -2177,7 +2177,7 @@ When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not registered. This means that other D-Bus clients have no way of noticing the newly registered method. When interfaces are constructed incrementally by adding single methods or properties at a time, -DONT-REGISTER-SERVICE can be use to prevent other clients from +DONT-REGISTER-SERVICE can be used to prevent other clients from discovering the still incomplete interface.*/) (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler, @@ -2319,6 +2319,9 @@ be called when a D-Bus message, which matches the key criteria, arrives (methods and signals), or a cons cell containing the value of the property. +For signals, there is also a fifth element RULE, which keeps the match +string the signal is registered with. + In the second case, the key in the hash table is the list (BUS SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a string denoting the bus address. SERIAL is the serial number of the diff --git a/src/dispnew.c b/src/dispnew.c index 7e1273ac34b..264db3ce4f9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6503,8 +6503,8 @@ See `buffer-display-table' for more information. */); Vstandard_display_table = Qnil; DEFVAR_BOOL ("redisplay-dont-pause", redisplay_dont_pause, - doc: /* *Non-nil means update isn't paused when input is detected. */); - redisplay_dont_pause = 0; + doc: /* *Non-nil means display update isn't paused when input is detected. */); + redisplay_dont_pause = 1; #if PERIODIC_PREEMPTION_CHECKING DEFVAR_LISP ("redisplay-preemption-period", Vredisplay_preemption_period, diff --git a/src/emacs.c b/src/emacs.c index d9b60b27129..0f7aa94c24f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1993,7 +1993,7 @@ all of which are called before Emacs is actually killed. */) { struct gcpro gcpro1; Lisp_Object hook; - int status; + int exit_code; GCPRO1 (arg); @@ -2018,13 +2018,15 @@ all of which are called before Emacs is actually killed. */) if (STRINGP (Vauto_save_list_file_name)) unlink (SSDATA (Vauto_save_list_file_name)); - if (! INTEGERP (arg)) - status = EXIT_SUCCESS; - else if (XINT (arg) < 0) - status = XINT (arg) | INT_MIN; + if (INTEGERP (arg)) + exit_code = (XINT (arg) < 0 + ? XINT (arg) | INT_MIN + : XINT (arg) & INT_MAX); + else if (noninteractive && (fflush (stdout) || ferror (stdout))) + exit_code = EXIT_FAILURE; else - status = XINT (arg) & INT_MAX; - exit (status); + exit_code = EXIT_SUCCESS; + exit (exit_code); } diff --git a/src/indent.c b/src/indent.c index 96b6ea4fa18..7e2edc8713b 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2018,8 +2018,9 @@ whether or not it is currently displayed in some window. */) } else { - ptrdiff_t it_start; - int first_x, it_overshoot_expected IF_LINT (= 0); + ptrdiff_t it_start, it_overshoot_count = 0; + int first_x; + int overshoot_handled = 0; itdata = bidi_shelve_cache (); SET_TEXT_POS (pt, PT, PT_BYTE); @@ -2028,22 +2029,23 @@ whether or not it is currently displayed in some window. */) it_start = IT_CHARPOS (it); /* See comments below for why we calculate this. */ - if (XINT (lines) > 0) + if (it.cmp_it.id >= 0) + it_overshoot_count = 0; + else if (it.method == GET_FROM_STRING) { - if (it.cmp_it.id >= 0) - it_overshoot_expected = 1; - else if (it.method == GET_FROM_STRING) + const char *s = SSDATA (it.string); + const char *e = s + SBYTES (it.string); + while (s < e) { - const char *s = SSDATA (it.string); - const char *e = s + SBYTES (it.string); - while (s < e && *s != '\n') - ++s; - it_overshoot_expected = (s == e) ? -1 : 0; + if (*s++ == '\n') + it_overshoot_count++; } - else - it_overshoot_expected = (it.method == GET_FROM_IMAGE - || it.method == GET_FROM_STRETCH); + if (!it_overshoot_count) + it_overshoot_count = -1; } + else + it_overshoot_count = + !(it.method == GET_FROM_IMAGE || it.method == GET_FROM_STRETCH); /* Scan from the start of the line containing PT. If we don't do this, we start moving with IT->current_x == 0, while PT is @@ -2057,55 +2059,58 @@ whether or not it is currently displayed in some window. */) tell, and it causes Bug#2694 . -- cyd */ move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); + /* IT may move too far if truncate-lines is on and PT lies + beyond the right margin. IT may also move too far if the + starting point is on a Lisp string that has embedded + newlines. In these cases, backtrack. */ + if (IT_CHARPOS (it) > it_start) + { + /* We need to backtrack also if the Lisp string contains no + newlines, but there is a newline right after it. In this + case, IT overshoots if there is an after-string just + before the newline. */ + if (it_overshoot_count < 0 + && it.method == GET_FROM_BUFFER + && it.c == '\n') + it_overshoot_count = 1; + if (it_overshoot_count > 0) + move_it_by_lines (&it, -it_overshoot_count); + + overshoot_handled = 1; + } if (XINT (lines) <= 0) { it.vpos = 0; /* Do this even if LINES is 0, so that we move back to the beginning of the current line as we ought. */ if (XINT (lines) == 0 || IT_CHARPOS (it) > 0) - move_it_by_lines (&it, max (INT_MIN, XINT (lines))); + move_it_by_lines (&it, max (PTRDIFF_MIN, XINT (lines))); + } + else if (overshoot_handled) + { + it.vpos = 0; + move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines))); } else { - if (IT_CHARPOS (it) > it_start) - { - /* IT may move too far if truncate-lines is on and PT - lies beyond the right margin. In that case, - backtrack unless the starting point is on an image, - stretch glyph, composition, or Lisp string. */ - if (!it_overshoot_expected - /* Also, backtrack if the Lisp string contains no - newline, but there is a newline right after it. - In this case, IT overshoots if there is an - after-string just before the newline. */ - || (it_overshoot_expected < 0 - && it.method == GET_FROM_BUFFER - && it.c == '\n')) - move_it_by_lines (&it, -1); - it.vpos = 0; - move_it_by_lines (&it, min (INT_MAX, XINT (lines))); - } - else + /* Otherwise, we are at the first row occupied by PT, which + might span multiple screen lines (e.g., if it's on a + multi-line display string). We want to start from the + last line that it occupies. */ + if (it_start < ZV) { - /* Otherwise, we are at the first row occupied by PT, - which might span multiple screen lines (e.g., if it's - on a multi-line display string). We want to start - from the last line that it occupies. */ - if (it_start < ZV) - { - while (IT_CHARPOS (it) <= it_start) - { - it.vpos = 0; - move_it_by_lines (&it, 1); - } - if (XINT (lines) > 1) - move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1)); - } - else + while (IT_CHARPOS (it) <= it_start) { it.vpos = 0; - move_it_by_lines (&it, min (INT_MAX, XINT (lines))); + move_it_by_lines (&it, 1); } + if (XINT (lines) > 1) + move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines) - 1)); + } + else + { + it.vpos = 0; + move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines))); } } diff --git a/src/minibuf.c b/src/minibuf.c index 66b9a8a1e49..76443fcf214 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -559,6 +559,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, minibuffer = get_minibuffer (minibuf_level); Fset_buffer (minibuffer); + /* Defeat (setq-default truncate-lines t), since truncated lines do + not work correctly in minibuffers. (Bug#5715, etc) */ + BVAR (current_buffer, truncate_lines) = Qnil; + /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ if (inherit_input_method) BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte; diff --git a/src/window.c b/src/window.c index 3014d90ff79..d567761f404 100644 --- a/src/window.c +++ b/src/window.c @@ -1666,8 +1666,9 @@ DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, doc: /* Return buffers previously shown in WINDOW. WINDOW must be a live window and defaults to the selected one. -The return value is either nil or a list of <buffer, window-start, -window-point> triples where buffer was previously shown in WINDOW. */) +The return value is a list of elements (BUFFER WINDOW-START POS), +where BUFFER is a buffer, WINDOW-START is the start position of the +window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window) { return decode_window (window)->prev_buffers; @@ -1676,11 +1677,11 @@ window-point> triples where buffer was previously shown in WINDOW. */) DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, Sset_window_prev_buffers, 2, 2, 0, doc: /* Set WINDOW's previous buffers to PREV-BUFFERS. -WINDOW must be a live window and defaults to the selected one. Return -PREV-BUFFERS. +WINDOW must be a live window and defaults to the selected one. -PREV-BUFFERS should be either nil or a list of <buffer, window-start, -window-point> triples where buffer was previously shown in WINDOW. */) +PREV-BUFFERS should be a list of elements (BUFFER WINDOW-START POS), +where BUFFER is a buffer, WINDOW-START is the start position of the +window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window, Lisp_Object prev_buffers) { return decode_window (window)->prev_buffers = prev_buffers; @@ -1698,11 +1699,8 @@ WINDOW must be a live window and defaults to the selected one. */) DEFUN ("set-window-next-buffers", Fset_window_next_buffers, Sset_window_next_buffers, 2, 2, 0, doc: /* Set WINDOW's next buffers to NEXT-BUFFERS. -WINDOW must be a live window and defaults to the selected one. Return -NEXT-BUFFERS. - -NEXT-BUFFERS should be either nil or a list of buffers that have been -recently re-shown in WINDOW. */) +WINDOW must be a live window and defaults to the selected one. +NEXT-BUFFERS should be a list of buffers. */) (Lisp_Object window, Lisp_Object next_buffers) { return decode_window (window)->next_buffers = next_buffers; @@ -5118,7 +5116,7 @@ and redisplay normally--don't erase and redraw the frame. */) { struct it it; struct text_pos pt; - int nlines = min (INT_MAX, -iarg); + ptrdiff_t nlines = min (PTRDIFF_MAX, -iarg); int extra_line_spacing; int h = window_box_height (w); void *itdata = bidi_shelve_cache (); diff --git a/src/xdisp.c b/src/xdisp.c index 7b174ff987b..c53c4d58168 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1210,6 +1210,34 @@ line_bottom_y (struct it *it) return line_top_y + line_height; } +/* Subroutine of pos_visible_p below. Extracts a display string, if + any, from the display spec given as its argument. */ +static Lisp_Object +string_from_display_spec (Lisp_Object spec) +{ + if (CONSP (spec)) + { + while (CONSP (spec)) + { + if (STRINGP (XCAR (spec))) + return XCAR (spec); + spec = XCDR (spec); + } + } + else if (VECTORP (spec)) + { + ptrdiff_t i; + + for (i = 0; i < ASIZE (spec); i++) + { + if (STRINGP (AREF (spec, i))) + return AREF (spec, i); + } + return Qnil; + } + + return spec; +} /* Return 1 if position CHARPOS is visible in window W. CHARPOS < 0 means return info about WINDOW_END position. @@ -1304,6 +1332,136 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, } } } + else if (IT_CHARPOS (it) != charpos) + { + Lisp_Object cpos = make_number (charpos); + Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil); + Lisp_Object string = string_from_display_spec (spec); + int newline_in_string = 0; + + if (STRINGP (string)) + { + const char *s = SSDATA (string); + const char *e = s + SBYTES (string); + while (s < e) + { + if (*s++ == '\n') + { + newline_in_string = 1; + break; + } + } + } + /* The tricky code below is needed because there's a + discrepancy between move_it_to and how we set cursor + when the display line ends in a newline from a + display string. move_it_to will stop _after_ such + display strings, whereas set_cursor_from_row + conspires with cursor_row_p to place the cursor on + the first glyph produced from the display string. */ + + /* We have overshoot PT because it is covered by a + display property whose value is a string. If the + string includes embedded newlines, we are also in the + wrong display line. Backtrack to the correct line, + where the display string begins. */ + if (newline_in_string) + { + Lisp_Object startpos, endpos; + EMACS_INT start, end; + struct it it3; + + /* Find the first and the last buffer positions + covered by the display string. */ + endpos = + Fnext_single_char_property_change (cpos, Qdisplay, + Qnil, Qnil); + startpos = + Fprevious_single_char_property_change (endpos, Qdisplay, + Qnil, Qnil); + start = XFASTINT (startpos); + end = XFASTINT (endpos); + /* Move to the last buffer position before the + display property. */ + start_display (&it3, w, top); + move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); + /* Move forward one more line if the position before + the display string is a newline or if it is the + rightmost character on a line that is + continued or word-wrapped. */ + if (it3.method == GET_FROM_BUFFER + && it3.c == '\n') + move_it_by_lines (&it3, 1); + else if (move_it_in_display_line_to (&it3, -1, + it3.current_x + + it3.pixel_width, + MOVE_TO_X) + == MOVE_LINE_CONTINUED) + { + move_it_by_lines (&it3, 1); + /* When we are under word-wrap, the #$@%! + move_it_by_lines moves 2 lines, so we need to + fix that up. */ + if (it3.line_wrap == WORD_WRAP) + move_it_by_lines (&it3, -1); + } + + /* Record the vertical coordinate of the display + line where we wound up. */ + top_y = it3.current_y; + if (it3.bidi_p) + { + /* When characters are reordered for display, + the character displayed to the left of the + display string could be _after_ the display + property in the logical order. Use the + smallest vertical position of these two. */ + start_display (&it3, w, top); + move_it_to (&it3, end + 1, -1, -1, -1, MOVE_TO_POS); + if (it3.current_y < top_y) + top_y = it3.current_y; + } + /* Move from the top of the window to the beginning + of the display line where the display string + begins. */ + start_display (&it3, w, top); + move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y); + /* Finally, advance the iterator until we hit the + first display element whose character position is + CHARPOS, or until the first newline from the + display string, which signals the end of the + display line. */ + while (get_next_display_element (&it3)) + { + PRODUCE_GLYPHS (&it3); + if (IT_CHARPOS (it3) == charpos + || ITERATOR_AT_END_OF_LINE_P (&it3)) + break; + set_iterator_to_next (&it3, 0); + } + top_x = it3.current_x - it3.pixel_width; + /* Normally, we would exit the above loop because we + found the display element whose character + position is CHARPOS. For the contingency that we + didn't, and stopped at the first newline from the + display string, move back over the glyphs + prfoduced from the string, until we find the + rightmost glyph not from the string. */ + if (IT_CHARPOS (it3) != charpos && EQ (it3.object, string)) + { + struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA] + + it3.glyph_row->used[TEXT_AREA]; + + while (EQ ((g - 1)->object, string)) + { + --g; + top_x -= g->pixel_width; + } + xassert (g < it3.glyph_row->glyphs[TEXT_AREA] + + it3.glyph_row->used[TEXT_AREA]); + } + } + } *x = top_x; *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); @@ -8527,7 +8685,16 @@ move_it_vertically_backward (struct it *it, int dy) move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, MOVE_TO_POS | MOVE_TO_VPOS); } - while (!IT_POS_VALID_AFTER_MOVE_P (&it2)); + while (!(IT_POS_VALID_AFTER_MOVE_P (&it2) + /* If we are in a display string which starts at START_POS, + and that display string includes a newline, and we are + right after that newline (i.e. at the beginning of a + display line), exit the loop, because otherwise we will + infloop, since move_it_to will see that it is already at + START_POS and will not move. */ + || (it2.method == GET_FROM_STRING + && IT_CHARPOS (it2) == start_pos + && SREF (it2.string, IT_STRING_BYTEPOS (it2) - 1) == '\n'))); xassert (IT_CHARPOS (*it) >= BEGV); SAVE_IT (it3, it2, it3data); |