diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 61 | ||||
| -rw-r--r-- | src/ChangeLog.11 | 2 | ||||
| -rw-r--r-- | src/bidi.c | 160 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/dbusbind.c | 15 | ||||
| -rw-r--r-- | src/dispnew.c | 4 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/indent.c | 101 | ||||
| -rw-r--r-- | src/minibuf.c | 4 | ||||
| -rw-r--r-- | src/window.c | 20 | ||||
| -rw-r--r-- | src/xdisp.c | 169 |
11 files changed, 390 insertions, 152 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 44a76068313..3282654ab06 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,64 @@ | |||
| 1 | 2011-09-25 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * dbusbind.c (Fdbus_register_signal): When service is not | ||
| 4 | registered, use nil in Vdbus_registered_objects_table. (Bug#9581) | ||
| 5 | |||
| 6 | 2011-09-25 Glenn Morris <rgm@gnu.org> | ||
| 7 | |||
| 8 | * buffer.c (truncate-lines): Doc fix. | ||
| 9 | |||
| 10 | 2011-09-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 11 | |||
| 12 | * window.c (Fwindow_prev_buffers, Fset_window_prev_buffers) | ||
| 13 | (Fset_window_next_buffers): Doc fix. | ||
| 14 | |||
| 15 | 2011-09-24 Glenn Morris <rgm@gnu.org> | ||
| 16 | |||
| 17 | * minibuf.c (read_minibuf): Disable line truncation. (Bug#5715) | ||
| 18 | |||
| 19 | 2011-09-24 Paul Eggert <eggert@cs.ucla.edu> | ||
| 20 | |||
| 21 | Fix minor problems found by static checking. | ||
| 22 | * xdisp.c (string_from_display_spec): Don't assume vecsize fits in int. | ||
| 23 | * indent.c (Fvertical_motion): Fix == vs = typo. | ||
| 24 | |||
| 25 | 2011-09-24 Eli Zaretskii <eliz@gnu.org> | ||
| 26 | |||
| 27 | * dispnew.c (syms_of_display) <redisplay-dont-pause>: Default | ||
| 28 | value is now t. Doc fix. | ||
| 29 | |||
| 30 | * indent.c (Fvertical_motion): Compute and apply the overshoot | ||
| 31 | logic when moving up, not only when moving down. Fix the | ||
| 32 | confusing name and values of the it_overshoot_expected variable; | ||
| 33 | logic changes accordingly. (Bug#9254) (Bug#9549) | ||
| 34 | |||
| 35 | * xdisp.c (pos_visible_p): Produce correct pixel coordinates when | ||
| 36 | CHARPOS is covered by a display string which includes newlines. | ||
| 37 | (move_it_vertically_backward): Avoid inflooping when START_CHARPOS | ||
| 38 | is covered by a display string with embedded newlines. | ||
| 39 | |||
| 40 | 2011-09-24 Michael Albinus <michael.albinus@gmx.de> | ||
| 41 | |||
| 42 | * dbusbind.c (Fdbus_register_signal): Add match rule to | ||
| 43 | Vdbus_registered_objects_table. (Bug#9581) | ||
| 44 | (Fdbus_register_method, Vdbus_registered_objects_table): Fix | ||
| 45 | docstring. | ||
| 46 | |||
| 47 | 2011-09-24 Jim Meyering <meyering@redhat.com> | ||
| 48 | |||
| 49 | do not ignore write error for any output size | ||
| 50 | The previous change was incomplete. | ||
| 51 | While it makes emacs --batch detect the vast majority of stdout | ||
| 52 | write failures, errors were still ignored whenever the output size is | ||
| 53 | k * (BUFSIZ+1) - 4. E.g., on a system with BUFSIZ of 4096, | ||
| 54 | $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \ | ||
| 55 | && echo FAIL: ignored write error | ||
| 56 | FAIL: ignored write error | ||
| 57 | $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \ | ||
| 58 | && echo FAIL: ignored write error | ||
| 59 | FAIL: ignored write error | ||
| 60 | * emacs.c (Fkill_emacs): Also test ferror. (Bug#9574) | ||
| 61 | |||
| 1 | 2011-09-23 Andreas Schwab <schwab@linux-m68k.org> | 62 | 2011-09-23 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 63 | ||
| 3 | * emacs.c (Fkill_emacs): In noninteractive mode exit | 64 | * emacs.c (Fkill_emacs): In noninteractive mode exit |
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index 6f462e32534..b64736459c8 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 | |||
| @@ -2927,7 +2927,7 @@ | |||
| 2927 | * nsimage.m (EmacsImage-setXBMColor:): Correct previous patch: | 2927 | * nsimage.m (EmacsImage-setXBMColor:): Correct previous patch: |
| 2928 | don't change the method signature, change the return. | 2928 | don't change the method signature, change the return. |
| 2929 | 2929 | ||
| 2930 | 2010-11-04 Ismail Donmez <ismail@namtrac.org> (tiny change) | 2930 | 2010-11-04 İsmail Dönmez <ismail@namtrac.org> (tiny change) |
| 2931 | 2931 | ||
| 2932 | * nsfont.m (nsfont_draw) | 2932 | * nsfont.m (nsfont_draw) |
| 2933 | * nsimage.m (EmacsImage-setXBMColor:) | 2933 | * nsimage.m (EmacsImage-setXBMColor:) |
diff --git a/src/bidi.c b/src/bidi.c index 3efdc1590df..599c00449b5 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -222,7 +222,7 @@ bidi_mirror_char (int c) | |||
| 222 | static inline void | 222 | static inline void |
| 223 | bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) | 223 | bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) |
| 224 | { | 224 | { |
| 225 | int higher_level = level_before > level_after ? level_before : level_after; | 225 | int higher_level = (level_before > level_after ? level_before : level_after); |
| 226 | 226 | ||
| 227 | /* The prev_was_pdf gork is required for when we have several PDFs | 227 | /* The prev_was_pdf gork is required for when we have several PDFs |
| 228 | in a row. In that case, we want to compute the sor type for the | 228 | 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) | |||
| 233 | level to which we descend after processing all the PDFs. */ | 233 | level to which we descend after processing all the PDFs. */ |
| 234 | if (!bidi_it->prev_was_pdf || level_before < level_after) | 234 | if (!bidi_it->prev_was_pdf || level_before < level_after) |
| 235 | /* FIXME: should the default sor direction be user selectable? */ | 235 | /* FIXME: should the default sor direction be user selectable? */ |
| 236 | bidi_it->sor = (higher_level & 1) != 0 ? R2L : L2R; | 236 | bidi_it->sor = ((higher_level & 1) != 0 ? R2L : L2R); |
| 237 | if (level_before > level_after) | 237 | if (level_before > level_after) |
| 238 | bidi_it->prev_was_pdf = 1; | 238 | bidi_it->prev_was_pdf = 1; |
| 239 | 239 | ||
| 240 | bidi_it->prev.type = UNKNOWN_BT; | 240 | bidi_it->prev.type = UNKNOWN_BT; |
| 241 | bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = | 241 | bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 |
| 242 | bidi_it->last_strong.orig_type = UNKNOWN_BT; | 242 | = bidi_it->last_strong.orig_type = UNKNOWN_BT; |
| 243 | bidi_it->prev_for_neutral.type = bidi_it->sor == R2L ? STRONG_R : STRONG_L; | 243 | bidi_it->prev_for_neutral.type = (bidi_it->sor == R2L ? STRONG_R : STRONG_L); |
| 244 | bidi_it->prev_for_neutral.charpos = bidi_it->charpos; | 244 | bidi_it->prev_for_neutral.charpos = bidi_it->charpos; |
| 245 | bidi_it->prev_for_neutral.bytepos = bidi_it->bytepos; | 245 | bidi_it->prev_for_neutral.bytepos = bidi_it->bytepos; |
| 246 | bidi_it->next_for_neutral.type = bidi_it->next_for_neutral.type_after_w1 = | 246 | bidi_it->next_for_neutral.type = bidi_it->next_for_neutral.type_after_w1 |
| 247 | bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; | 247 | = bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; |
| 248 | bidi_it->ignore_bn_limit = -1; /* meaning it's unknown */ | 248 | bidi_it->ignore_bn_limit = -1; /* meaning it's unknown */ |
| 249 | } | 249 | } |
| 250 | 250 | ||
| @@ -325,10 +325,10 @@ static int bidi_cache_sp; | |||
| 325 | /* Size of header used by bidi_shelve_cache. */ | 325 | /* Size of header used by bidi_shelve_cache. */ |
| 326 | enum | 326 | enum |
| 327 | { | 327 | { |
| 328 | bidi_shelve_header_size = | 328 | bidi_shelve_header_size |
| 329 | (sizeof (bidi_cache_idx) + sizeof (bidi_cache_start_stack) | 329 | = (sizeof (bidi_cache_idx) + sizeof (bidi_cache_start_stack) |
| 330 | + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) | 330 | + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) |
| 331 | + sizeof (bidi_cache_last_idx)) | 331 | + sizeof (bidi_cache_last_idx)) |
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| 334 | /* Reset the cache state to the empty state. We only reset the part | 334 | /* Reset the cache state to the empty state. We only reset the part |
| @@ -353,8 +353,8 @@ bidi_cache_shrink (void) | |||
| 353 | { | 353 | { |
| 354 | if (bidi_cache_size > BIDI_CACHE_CHUNK) | 354 | if (bidi_cache_size > BIDI_CACHE_CHUNK) |
| 355 | { | 355 | { |
| 356 | bidi_cache = | 356 | bidi_cache |
| 357 | (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); | 357 | = (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); |
| 358 | bidi_cache_size = BIDI_CACHE_CHUNK; | 358 | bidi_cache_size = BIDI_CACHE_CHUNK; |
| 359 | } | 359 | } |
| 360 | bidi_cache_reset (); | 360 | bidi_cache_reset (); |
| @@ -490,17 +490,17 @@ bidi_cache_ensure_space (ptrdiff_t idx) | |||
| 490 | { | 490 | { |
| 491 | /* The bidi cache cannot be larger than the largest Lisp string | 491 | /* The bidi cache cannot be larger than the largest Lisp string |
| 492 | or buffer. */ | 492 | or buffer. */ |
| 493 | ptrdiff_t string_or_buffer_bound = | 493 | ptrdiff_t string_or_buffer_bound |
| 494 | max (BUF_BYTES_MAX, STRING_BYTES_BOUND); | 494 | = max (BUF_BYTES_MAX, STRING_BYTES_BOUND); |
| 495 | 495 | ||
| 496 | /* Also, it cannot be larger than what C can represent. */ | 496 | /* Also, it cannot be larger than what C can represent. */ |
| 497 | ptrdiff_t c_bound = | 497 | ptrdiff_t c_bound |
| 498 | (min (PTRDIFF_MAX, SIZE_MAX) - bidi_shelve_header_size) / elsz; | 498 | = (min (PTRDIFF_MAX, SIZE_MAX) - bidi_shelve_header_size) / elsz; |
| 499 | 499 | ||
| 500 | bidi_cache = | 500 | bidi_cache |
| 501 | xpalloc (bidi_cache, &bidi_cache_size, | 501 | = xpalloc (bidi_cache, &bidi_cache_size, |
| 502 | max (BIDI_CACHE_CHUNK, idx - bidi_cache_size + 1), | 502 | max (BIDI_CACHE_CHUNK, idx - bidi_cache_size + 1), |
| 503 | min (string_or_buffer_bound, c_bound), elsz); | 503 | min (string_or_buffer_bound, c_bound), elsz); |
| 504 | } | 504 | } |
| 505 | } | 505 | } |
| 506 | 506 | ||
| @@ -708,8 +708,8 @@ bidi_unshelve_cache (void *databuf, int just_free) | |||
| 708 | ptrdiff_t idx; | 708 | ptrdiff_t idx; |
| 709 | 709 | ||
| 710 | memcpy (&idx, p, sizeof (bidi_cache_idx)); | 710 | memcpy (&idx, p, sizeof (bidi_cache_idx)); |
| 711 | bidi_cache_total_alloc -= | 711 | bidi_cache_total_alloc |
| 712 | bidi_shelve_header_size + idx * sizeof (struct bidi_it); | 712 | -= bidi_shelve_header_size + idx * sizeof (struct bidi_it); |
| 713 | } | 713 | } |
| 714 | else | 714 | else |
| 715 | { | 715 | { |
| @@ -737,8 +737,9 @@ bidi_unshelve_cache (void *databuf, int just_free) | |||
| 737 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) | 737 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) |
| 738 | + sizeof (bidi_cache_start), | 738 | + sizeof (bidi_cache_start), |
| 739 | sizeof (bidi_cache_last_idx)); | 739 | sizeof (bidi_cache_last_idx)); |
| 740 | bidi_cache_total_alloc -= | 740 | bidi_cache_total_alloc |
| 741 | bidi_shelve_header_size + bidi_cache_idx * sizeof (struct bidi_it); | 741 | -= (bidi_shelve_header_size |
| 742 | + bidi_cache_idx * sizeof (struct bidi_it)); | ||
| 742 | } | 743 | } |
| 743 | 744 | ||
| 744 | xfree (p); | 745 | xfree (p); |
| @@ -813,18 +814,18 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p, | |||
| 813 | bidi_it->type_after_w1 = NEUTRAL_B; | 814 | bidi_it->type_after_w1 = NEUTRAL_B; |
| 814 | bidi_it->orig_type = NEUTRAL_B; | 815 | bidi_it->orig_type = NEUTRAL_B; |
| 815 | bidi_it->prev_was_pdf = 0; | 816 | bidi_it->prev_was_pdf = 0; |
| 816 | bidi_it->prev.type = bidi_it->prev.type_after_w1 = | 817 | bidi_it->prev.type = bidi_it->prev.type_after_w1 |
| 817 | bidi_it->prev.orig_type = UNKNOWN_BT; | 818 | = bidi_it->prev.orig_type = UNKNOWN_BT; |
| 818 | bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 = | 819 | bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 |
| 819 | bidi_it->last_strong.orig_type = UNKNOWN_BT; | 820 | = bidi_it->last_strong.orig_type = UNKNOWN_BT; |
| 820 | bidi_it->next_for_neutral.charpos = -1; | 821 | bidi_it->next_for_neutral.charpos = -1; |
| 821 | bidi_it->next_for_neutral.type = | 822 | bidi_it->next_for_neutral.type |
| 822 | bidi_it->next_for_neutral.type_after_w1 = | 823 | = bidi_it->next_for_neutral.type_after_w1 |
| 823 | bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; | 824 | = bidi_it->next_for_neutral.orig_type = UNKNOWN_BT; |
| 824 | bidi_it->prev_for_neutral.charpos = -1; | 825 | bidi_it->prev_for_neutral.charpos = -1; |
| 825 | bidi_it->prev_for_neutral.type = | 826 | bidi_it->prev_for_neutral.type |
| 826 | bidi_it->prev_for_neutral.type_after_w1 = | 827 | = bidi_it->prev_for_neutral.type_after_w1 |
| 827 | bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; | 828 | = bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT; |
| 828 | bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */ | 829 | bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */ |
| 829 | bidi_it->disp_pos = -1; /* invalid/unknown */ | 830 | bidi_it->disp_pos = -1; /* invalid/unknown */ |
| 830 | bidi_it->disp_prop = 0; | 831 | bidi_it->disp_prop = 0; |
| @@ -848,7 +849,7 @@ bidi_line_init (struct bidi_it *bidi_it) | |||
| 848 | bidi_it->next_en_pos = -1; | 849 | bidi_it->next_en_pos = -1; |
| 849 | bidi_it->next_for_ws.type = UNKNOWN_BT; | 850 | bidi_it->next_for_ws.type = UNKNOWN_BT; |
| 850 | bidi_set_sor_type (bidi_it, | 851 | bidi_set_sor_type (bidi_it, |
| 851 | bidi_it->paragraph_dir == R2L ? 1 : 0, | 852 | (bidi_it->paragraph_dir == R2L ? 1 : 0), |
| 852 | bidi_it->level_stack[0].level); /* X10 */ | 853 | bidi_it->level_stack[0].level); /* X10 */ |
| 853 | 854 | ||
| 854 | bidi_cache_reset (); | 855 | bidi_cache_reset (); |
| @@ -925,8 +926,8 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 925 | int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars) | 926 | int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars) |
| 926 | { | 927 | { |
| 927 | int ch; | 928 | int ch; |
| 928 | EMACS_INT endpos = | 929 | EMACS_INT endpos |
| 929 | (string->s || STRINGP (string->lstring)) ? string->schars : ZV; | 930 | = (string->s || STRINGP (string->lstring)) ? string->schars : ZV; |
| 930 | struct text_pos pos; | 931 | struct text_pos pos; |
| 931 | 932 | ||
| 932 | /* If we got past the last known position of display string, compute | 933 | /* 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) | |||
| 1173 | we are potentially in a new paragraph that doesn't yet | 1174 | we are potentially in a new paragraph that doesn't yet |
| 1174 | exist. */ | 1175 | exist. */ |
| 1175 | pos = bidi_it->charpos; | 1176 | pos = bidi_it->charpos; |
| 1176 | s = STRINGP (bidi_it->string.lstring) ? | 1177 | s = (STRINGP (bidi_it->string.lstring) |
| 1177 | SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1178 | ? SDATA (bidi_it->string.lstring) |
| 1179 | : bidi_it->string.s); | ||
| 1178 | if (bytepos > begbyte | 1180 | if (bytepos > begbyte |
| 1179 | && bidi_char_at_pos (bytepos, s, bidi_it->string.unibyte) == '\n') | 1181 | && bidi_char_at_pos (bytepos, s, bidi_it->string.unibyte) == '\n') |
| 1180 | { | 1182 | { |
| @@ -1324,9 +1326,10 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) | |||
| 1324 | bidi_it->first_elt = 0; | 1326 | bidi_it->first_elt = 0; |
| 1325 | if (string_p) | 1327 | if (string_p) |
| 1326 | { | 1328 | { |
| 1327 | const unsigned char *p = | 1329 | const unsigned char *p |
| 1328 | STRINGP (bidi_it->string.lstring) | 1330 | = (STRINGP (bidi_it->string.lstring) |
| 1329 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1331 | ? SDATA (bidi_it->string.lstring) |
| 1332 | : bidi_it->string.s); | ||
| 1330 | 1333 | ||
| 1331 | if (bidi_it->charpos < 0) | 1334 | if (bidi_it->charpos < 0) |
| 1332 | bidi_it->charpos = 0; | 1335 | bidi_it->charpos = 0; |
| @@ -1509,8 +1512,10 @@ bidi_resolve_explicit (struct bidi_it *bidi_it) | |||
| 1509 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; | 1512 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; |
| 1510 | int new_level = bidi_resolve_explicit_1 (bidi_it); | 1513 | int new_level = bidi_resolve_explicit_1 (bidi_it); |
| 1511 | EMACS_INT eob = bidi_it->string.s ? bidi_it->string.schars : ZV; | 1514 | EMACS_INT eob = bidi_it->string.s ? bidi_it->string.schars : ZV; |
| 1512 | const unsigned char *s = STRINGP (bidi_it->string.lstring) | 1515 | const unsigned char *s |
| 1513 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1516 | = (STRINGP (bidi_it->string.lstring) |
| 1517 | ? SDATA (bidi_it->string.lstring) | ||
| 1518 | : bidi_it->string.s); | ||
| 1514 | 1519 | ||
| 1515 | if (prev_level < new_level | 1520 | if (prev_level < new_level |
| 1516 | && bidi_it->type == WEAK_BN | 1521 | && bidi_it->type == WEAK_BN |
| @@ -1594,9 +1599,9 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1594 | int next_char; | 1599 | int next_char; |
| 1595 | bidi_type_t type_of_next; | 1600 | bidi_type_t type_of_next; |
| 1596 | struct bidi_it saved_it; | 1601 | struct bidi_it saved_it; |
| 1597 | EMACS_INT eob = | 1602 | EMACS_INT eob |
| 1598 | (STRINGP (bidi_it->string.lstring) || bidi_it->string.s) | 1603 | = ((STRINGP (bidi_it->string.lstring) || bidi_it->string.s) |
| 1599 | ? bidi_it->string.schars : ZV; | 1604 | ? bidi_it->string.schars : ZV); |
| 1600 | 1605 | ||
| 1601 | type = bidi_it->type; | 1606 | type = bidi_it->type; |
| 1602 | override = bidi_it->level_stack[bidi_it->stack_idx].override; | 1607 | override = bidi_it->level_stack[bidi_it->stack_idx].override; |
| @@ -1663,15 +1668,15 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1663 | && bidi_it->prev.orig_type == WEAK_EN) | 1668 | && bidi_it->prev.orig_type == WEAK_EN) |
| 1664 | || bidi_it->prev.type_after_w1 == WEAK_AN))) | 1669 | || bidi_it->prev.type_after_w1 == WEAK_AN))) |
| 1665 | { | 1670 | { |
| 1666 | const unsigned char *s = | 1671 | const unsigned char *s |
| 1667 | STRINGP (bidi_it->string.lstring) | 1672 | = (STRINGP (bidi_it->string.lstring) |
| 1668 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1673 | ? SDATA (bidi_it->string.lstring) |
| 1669 | 1674 | : bidi_it->string.s); | |
| 1670 | next_char = | 1675 | |
| 1671 | bidi_it->charpos + bidi_it->nchars >= eob | 1676 | next_char = (bidi_it->charpos + bidi_it->nchars >= eob |
| 1672 | ? BIDI_EOB | 1677 | ? BIDI_EOB |
| 1673 | : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, | 1678 | : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, |
| 1674 | bidi_it->string.unibyte); | 1679 | s, bidi_it->string.unibyte)); |
| 1675 | type_of_next = bidi_get_type (next_char, override); | 1680 | type_of_next = bidi_get_type (next_char, override); |
| 1676 | 1681 | ||
| 1677 | if (type_of_next == WEAK_BN | 1682 | if (type_of_next == WEAK_BN |
| @@ -1720,17 +1725,17 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1720 | else /* W5: ET/BN with EN after it. */ | 1725 | else /* W5: ET/BN with EN after it. */ |
| 1721 | { | 1726 | { |
| 1722 | EMACS_INT en_pos = bidi_it->charpos + bidi_it->nchars; | 1727 | EMACS_INT en_pos = bidi_it->charpos + bidi_it->nchars; |
| 1723 | const unsigned char *s = | 1728 | const unsigned char *s = (STRINGP (bidi_it->string.lstring) |
| 1724 | STRINGP (bidi_it->string.lstring) | 1729 | ? SDATA (bidi_it->string.lstring) |
| 1725 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1730 | : bidi_it->string.s); |
| 1726 | 1731 | ||
| 1727 | if (bidi_it->nchars <= 0) | 1732 | if (bidi_it->nchars <= 0) |
| 1728 | abort (); | 1733 | abort (); |
| 1729 | next_char = | 1734 | next_char |
| 1730 | bidi_it->charpos + bidi_it->nchars >= eob | 1735 | = (bidi_it->charpos + bidi_it->nchars >= eob |
| 1731 | ? BIDI_EOB | 1736 | ? BIDI_EOB |
| 1732 | : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, | 1737 | : bidi_char_at_pos (bidi_it->bytepos + bidi_it->ch_len, s, |
| 1733 | bidi_it->string.unibyte); | 1738 | bidi_it->string.unibyte)); |
| 1734 | type_of_next = bidi_get_type (next_char, override); | 1739 | type_of_next = bidi_get_type (next_char, override); |
| 1735 | 1740 | ||
| 1736 | if (type_of_next == WEAK_ET | 1741 | if (type_of_next == WEAK_ET |
| @@ -1875,8 +1880,8 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) | |||
| 1875 | && bidi_get_category (type) != NEUTRAL) | 1880 | && bidi_get_category (type) != NEUTRAL) |
| 1876 | /* This is all per level run, so stop when we | 1881 | /* This is all per level run, so stop when we |
| 1877 | reach the end of this level run. */ | 1882 | reach the end of this level run. */ |
| 1878 | || bidi_it->level_stack[bidi_it->stack_idx].level != | 1883 | || (bidi_it->level_stack[bidi_it->stack_idx].level |
| 1879 | current_level)); | 1884 | != current_level))); |
| 1880 | 1885 | ||
| 1881 | bidi_remember_char (&saved_it.next_for_neutral, bidi_it); | 1886 | bidi_remember_char (&saved_it.next_for_neutral, bidi_it); |
| 1882 | 1887 | ||
| @@ -1971,9 +1976,9 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 1971 | 1976 | ||
| 1972 | if (bidi_it->scan_dir == 1) | 1977 | if (bidi_it->scan_dir == 1) |
| 1973 | { | 1978 | { |
| 1974 | EMACS_INT eob = | 1979 | EMACS_INT eob |
| 1975 | (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) | 1980 | = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) |
| 1976 | ? bidi_it->string.schars : ZV; | 1981 | ? bidi_it->string.schars : ZV); |
| 1977 | 1982 | ||
| 1978 | /* There's no sense in trying to advance if we hit end of text. */ | 1983 | /* There's no sense in trying to advance if we hit end of text. */ |
| 1979 | if (bidi_it->charpos >= eob) | 1984 | if (bidi_it->charpos >= eob) |
| @@ -2018,9 +2023,8 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 2018 | UNKNOWN_BT. */ | 2023 | UNKNOWN_BT. */ |
| 2019 | if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) | 2024 | if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) |
| 2020 | { | 2025 | { |
| 2021 | int bob = | 2026 | int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) |
| 2022 | (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) ? 0 : 1; | 2027 | ? 0 : 1); |
| 2023 | |||
| 2024 | if (bidi_it->scan_dir > 0) | 2028 | if (bidi_it->scan_dir > 0) |
| 2025 | { | 2029 | { |
| 2026 | if (bidi_it->nchars <= 0) | 2030 | if (bidi_it->nchars <= 0) |
| @@ -2345,9 +2349,9 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) | |||
| 2345 | bidi_it->separator_limit = bidi_it->string.schars; | 2349 | bidi_it->separator_limit = bidi_it->string.schars; |
| 2346 | else if (bidi_it->bytepos < ZV_BYTE) | 2350 | else if (bidi_it->bytepos < ZV_BYTE) |
| 2347 | { | 2351 | { |
| 2348 | EMACS_INT sep_len = | 2352 | EMACS_INT sep_len |
| 2349 | bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, | 2353 | = bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, |
| 2350 | bidi_it->bytepos + bidi_it->ch_len); | 2354 | bidi_it->bytepos + bidi_it->ch_len); |
| 2351 | if (bidi_it->nchars <= 0) | 2355 | if (bidi_it->nchars <= 0) |
| 2352 | abort (); | 2356 | abort (); |
| 2353 | if (sep_len >= 0) | 2357 | if (sep_len >= 0) |
| @@ -2355,8 +2359,8 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) | |||
| 2355 | bidi_it->new_paragraph = 1; | 2359 | bidi_it->new_paragraph = 1; |
| 2356 | /* Record the buffer position of the last character of the | 2360 | /* Record the buffer position of the last character of the |
| 2357 | paragraph separator. */ | 2361 | paragraph separator. */ |
| 2358 | bidi_it->separator_limit = | 2362 | bidi_it->separator_limit |
| 2359 | bidi_it->charpos + bidi_it->nchars + sep_len; | 2363 | = bidi_it->charpos + bidi_it->nchars + sep_len; |
| 2360 | } | 2364 | } |
| 2361 | } | 2365 | } |
| 2362 | } | 2366 | } |
diff --git a/src/buffer.c b/src/buffer.c index 37d2975c8c7..dffdeb536fc 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5493,7 +5493,9 @@ Instead, give each line of text just one screen line. | |||
| 5493 | 5493 | ||
| 5494 | Note that this is overridden by the variable | 5494 | Note that this is overridden by the variable |
| 5495 | `truncate-partial-width-windows' if that variable is non-nil | 5495 | `truncate-partial-width-windows' if that variable is non-nil |
| 5496 | and this buffer is not full-frame width. */); | 5496 | and this buffer is not full-frame width. |
| 5497 | |||
| 5498 | Minibuffers set this variable to nil. */); | ||
| 5497 | 5499 | ||
| 5498 | DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, | 5500 | DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, |
| 5499 | doc: /* *Non-nil means to use word-wrapping for continuation lines. | 5501 | doc: /* *Non-nil means to use word-wrapping for continuation lines. |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 227d4e647e9..52e08d8ee2a 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -2071,13 +2071,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG | |||
| 2071 | && (SBYTES (service) > 0) | 2071 | && (SBYTES (service) > 0) |
| 2072 | && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0) | 2072 | && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0) |
| 2073 | && (strncmp (SSDATA (service), ":", 1) != 0)) | 2073 | && (strncmp (SSDATA (service), ":", 1) != 0)) |
| 2074 | { | 2074 | uname = call2 (intern ("dbus-get-name-owner"), bus, service); |
| 2075 | uname = call2 (intern ("dbus-get-name-owner"), bus, service); | ||
| 2076 | /* When there is no unique name, we mark it with an empty | ||
| 2077 | string. */ | ||
| 2078 | if (NILP (uname)) | ||
| 2079 | uname = empty_unibyte_string; | ||
| 2080 | } | ||
| 2081 | else | 2075 | else |
| 2082 | uname = service; | 2076 | uname = service; |
| 2083 | 2077 | ||
| @@ -2145,7 +2139,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG | |||
| 2145 | 2139 | ||
| 2146 | /* Create a hash table entry. */ | 2140 | /* Create a hash table entry. */ |
| 2147 | key = list3 (bus, interface, signal); | 2141 | key = list3 (bus, interface, signal); |
| 2148 | key1 = list4 (uname, service, path, handler); | 2142 | key1 = list5 (uname, service, path, handler, build_string (rule)); |
| 2149 | value = Fgethash (key, Vdbus_registered_objects_table, Qnil); | 2143 | value = Fgethash (key, Vdbus_registered_objects_table, Qnil); |
| 2150 | 2144 | ||
| 2151 | if (NILP (Fmember (key1, value))) | 2145 | if (NILP (Fmember (key1, value))) |
| @@ -2177,7 +2171,7 @@ When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not | |||
| 2177 | registered. This means that other D-Bus clients have no way of | 2171 | registered. This means that other D-Bus clients have no way of |
| 2178 | noticing the newly registered method. When interfaces are constructed | 2172 | noticing the newly registered method. When interfaces are constructed |
| 2179 | incrementally by adding single methods or properties at a time, | 2173 | incrementally by adding single methods or properties at a time, |
| 2180 | DONT-REGISTER-SERVICE can be use to prevent other clients from | 2174 | DONT-REGISTER-SERVICE can be used to prevent other clients from |
| 2181 | discovering the still incomplete interface.*/) | 2175 | discovering the still incomplete interface.*/) |
| 2182 | (Lisp_Object bus, Lisp_Object service, Lisp_Object path, | 2176 | (Lisp_Object bus, Lisp_Object service, Lisp_Object path, |
| 2183 | Lisp_Object interface, Lisp_Object method, Lisp_Object handler, | 2177 | Lisp_Object interface, Lisp_Object method, Lisp_Object handler, |
| @@ -2319,6 +2313,9 @@ be called when a D-Bus message, which matches the key criteria, | |||
| 2319 | arrives (methods and signals), or a cons cell containing the value of | 2313 | arrives (methods and signals), or a cons cell containing the value of |
| 2320 | the property. | 2314 | the property. |
| 2321 | 2315 | ||
| 2316 | For signals, there is also a fifth element RULE, which keeps the match | ||
| 2317 | string the signal is registered with. | ||
| 2318 | |||
| 2322 | In the second case, the key in the hash table is the list (BUS | 2319 | In the second case, the key in the hash table is the list (BUS |
| 2323 | SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a | 2320 | SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a |
| 2324 | string denoting the bus address. SERIAL is the serial number of the | 2321 | string denoting the bus address. SERIAL is the serial number of the |
diff --git a/src/dispnew.c b/src/dispnew.c index 50b96b699f9..ccb24c8ceea 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -6507,8 +6507,8 @@ See `buffer-display-table' for more information. */); | |||
| 6507 | Vstandard_display_table = Qnil; | 6507 | Vstandard_display_table = Qnil; |
| 6508 | 6508 | ||
| 6509 | DEFVAR_BOOL ("redisplay-dont-pause", redisplay_dont_pause, | 6509 | DEFVAR_BOOL ("redisplay-dont-pause", redisplay_dont_pause, |
| 6510 | doc: /* *Non-nil means update isn't paused when input is detected. */); | 6510 | doc: /* *Non-nil means display update isn't paused when input is detected. */); |
| 6511 | redisplay_dont_pause = 0; | 6511 | redisplay_dont_pause = 1; |
| 6512 | 6512 | ||
| 6513 | #if PERIODIC_PREEMPTION_CHECKING | 6513 | #if PERIODIC_PREEMPTION_CHECKING |
| 6514 | DEFVAR_LISP ("redisplay-preemption-period", Vredisplay_preemption_period, | 6514 | DEFVAR_LISP ("redisplay-preemption-period", Vredisplay_preemption_period, |
diff --git a/src/emacs.c b/src/emacs.c index bf23643f3f6..a96ad1ae1cb 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2025,7 +2025,7 @@ all of which are called before Emacs is actually killed. */) | |||
| 2025 | unlink (SSDATA (Vauto_save_list_file_name)); | 2025 | unlink (SSDATA (Vauto_save_list_file_name)); |
| 2026 | 2026 | ||
| 2027 | exit_code = EXIT_SUCCESS; | 2027 | exit_code = EXIT_SUCCESS; |
| 2028 | if (noninteractive && fflush (stdout)) | 2028 | if (noninteractive && (fflush (stdout) || ferror (stdout))) |
| 2029 | exit_code = EXIT_FAILURE; | 2029 | exit_code = EXIT_FAILURE; |
| 2030 | exit (INTEGERP (arg) ? XINT (arg) : exit_code); | 2030 | exit (INTEGERP (arg) ? XINT (arg) : exit_code); |
| 2031 | } | 2031 | } |
diff --git a/src/indent.c b/src/indent.c index e00d2152577..a70b7971b96 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -2019,7 +2019,8 @@ whether or not it is currently displayed in some window. */) | |||
| 2019 | else | 2019 | else |
| 2020 | { | 2020 | { |
| 2021 | EMACS_INT it_start; | 2021 | EMACS_INT it_start; |
| 2022 | int first_x, it_overshoot_expected IF_LINT (= 0); | 2022 | int first_x, it_overshoot_count = 0; |
| 2023 | int overshoot_handled = 0; | ||
| 2023 | 2024 | ||
| 2024 | itdata = bidi_shelve_cache (); | 2025 | itdata = bidi_shelve_cache (); |
| 2025 | SET_TEXT_POS (pt, PT, PT_BYTE); | 2026 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| @@ -2028,22 +2029,23 @@ whether or not it is currently displayed in some window. */) | |||
| 2028 | it_start = IT_CHARPOS (it); | 2029 | it_start = IT_CHARPOS (it); |
| 2029 | 2030 | ||
| 2030 | /* See comments below for why we calculate this. */ | 2031 | /* See comments below for why we calculate this. */ |
| 2031 | if (XINT (lines) > 0) | 2032 | if (it.cmp_it.id >= 0) |
| 2033 | it_overshoot_count = 0; | ||
| 2034 | else if (it.method == GET_FROM_STRING) | ||
| 2032 | { | 2035 | { |
| 2033 | if (it.cmp_it.id >= 0) | 2036 | const char *s = SSDATA (it.string); |
| 2034 | it_overshoot_expected = 1; | 2037 | const char *e = s + SBYTES (it.string); |
| 2035 | else if (it.method == GET_FROM_STRING) | 2038 | while (s < e) |
| 2036 | { | 2039 | { |
| 2037 | const char *s = SSDATA (it.string); | 2040 | if (*s++ == '\n') |
| 2038 | const char *e = s + SBYTES (it.string); | 2041 | it_overshoot_count++; |
| 2039 | while (s < e && *s != '\n') | ||
| 2040 | ++s; | ||
| 2041 | it_overshoot_expected = (s == e) ? -1 : 0; | ||
| 2042 | } | 2042 | } |
| 2043 | else | 2043 | if (!it_overshoot_count) |
| 2044 | it_overshoot_expected = (it.method == GET_FROM_IMAGE | 2044 | it_overshoot_count = -1; |
| 2045 | || it.method == GET_FROM_STRETCH); | ||
| 2046 | } | 2045 | } |
| 2046 | else | ||
| 2047 | it_overshoot_count = | ||
| 2048 | !(it.method == GET_FROM_IMAGE || it.method == GET_FROM_STRETCH); | ||
| 2047 | 2049 | ||
| 2048 | /* Scan from the start of the line containing PT. If we don't | 2050 | /* Scan from the start of the line containing PT. If we don't |
| 2049 | do this, we start moving with IT->current_x == 0, while PT is | 2051 | do this, we start moving with IT->current_x == 0, while PT is |
| @@ -2057,6 +2059,25 @@ whether or not it is currently displayed in some window. */) | |||
| 2057 | tell, and it causes Bug#2694 . -- cyd */ | 2059 | tell, and it causes Bug#2694 . -- cyd */ |
| 2058 | move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); | 2060 | move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
| 2059 | 2061 | ||
| 2062 | /* IT may move too far if truncate-lines is on and PT lies | ||
| 2063 | beyond the right margin. IT may also move too far if the | ||
| 2064 | starting point is on a Lisp string that has embedded | ||
| 2065 | newlines. In these cases, backtrack. */ | ||
| 2066 | if (IT_CHARPOS (it) > it_start) | ||
| 2067 | { | ||
| 2068 | /* We need to backtrack also if the Lisp string contains no | ||
| 2069 | newlines, but there is a newline right after it. In this | ||
| 2070 | case, IT overshoots if there is an after-string just | ||
| 2071 | before the newline. */ | ||
| 2072 | if (it_overshoot_count < 0 | ||
| 2073 | && it.method == GET_FROM_BUFFER | ||
| 2074 | && it.c == '\n') | ||
| 2075 | it_overshoot_count = 1; | ||
| 2076 | if (it_overshoot_count > 0) | ||
| 2077 | move_it_by_lines (&it, -it_overshoot_count); | ||
| 2078 | |||
| 2079 | overshoot_handled = 1; | ||
| 2080 | } | ||
| 2060 | if (XINT (lines) <= 0) | 2081 | if (XINT (lines) <= 0) |
| 2061 | { | 2082 | { |
| 2062 | it.vpos = 0; | 2083 | it.vpos = 0; |
| @@ -2065,47 +2086,31 @@ whether or not it is currently displayed in some window. */) | |||
| 2065 | if (XINT (lines) == 0 || IT_CHARPOS (it) > 0) | 2086 | if (XINT (lines) == 0 || IT_CHARPOS (it) > 0) |
| 2066 | move_it_by_lines (&it, max (INT_MIN, XINT (lines))); | 2087 | move_it_by_lines (&it, max (INT_MIN, XINT (lines))); |
| 2067 | } | 2088 | } |
| 2089 | else if (overshoot_handled) | ||
| 2090 | { | ||
| 2091 | it.vpos = 0; | ||
| 2092 | move_it_by_lines (&it, min (INT_MAX, XINT (lines))); | ||
| 2093 | } | ||
| 2068 | else | 2094 | else |
| 2069 | { | 2095 | { |
| 2070 | if (IT_CHARPOS (it) > it_start) | 2096 | /* Otherwise, we are at the first row occupied by PT, which |
| 2071 | { | 2097 | might span multiple screen lines (e.g., if it's on a |
| 2072 | /* IT may move too far if truncate-lines is on and PT | 2098 | multi-line display string). We want to start from the |
| 2073 | lies beyond the right margin. In that case, | 2099 | last line that it occupies. */ |
| 2074 | backtrack unless the starting point is on an image, | 2100 | if (it_start < ZV) |
| 2075 | stretch glyph, composition, or Lisp string. */ | ||
| 2076 | if (!it_overshoot_expected | ||
| 2077 | /* Also, backtrack if the Lisp string contains no | ||
| 2078 | newline, but there is a newline right after it. | ||
| 2079 | In this case, IT overshoots if there is an | ||
| 2080 | after-string just before the newline. */ | ||
| 2081 | || (it_overshoot_expected < 0 | ||
| 2082 | && it.method == GET_FROM_BUFFER | ||
| 2083 | && it.c == '\n')) | ||
| 2084 | move_it_by_lines (&it, -1); | ||
| 2085 | it.vpos = 0; | ||
| 2086 | move_it_by_lines (&it, min (INT_MAX, XINT (lines))); | ||
| 2087 | } | ||
| 2088 | else | ||
| 2089 | { | 2101 | { |
| 2090 | /* Otherwise, we are at the first row occupied by PT, | 2102 | while (IT_CHARPOS (it) <= it_start) |
| 2091 | which might span multiple screen lines (e.g., if it's | ||
| 2092 | on a multi-line display string). We want to start | ||
| 2093 | from the last line that it occupies. */ | ||
| 2094 | if (it_start < ZV) | ||
| 2095 | { | ||
| 2096 | while (IT_CHARPOS (it) <= it_start) | ||
| 2097 | { | ||
| 2098 | it.vpos = 0; | ||
| 2099 | move_it_by_lines (&it, 1); | ||
| 2100 | } | ||
| 2101 | if (XINT (lines) > 1) | ||
| 2102 | move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1)); | ||
| 2103 | } | ||
| 2104 | else | ||
| 2105 | { | 2103 | { |
| 2106 | it.vpos = 0; | 2104 | it.vpos = 0; |
| 2107 | move_it_by_lines (&it, min (INT_MAX, XINT (lines))); | 2105 | move_it_by_lines (&it, 1); |
| 2108 | } | 2106 | } |
| 2107 | if (XINT (lines) > 1) | ||
| 2108 | move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1)); | ||
| 2109 | } | ||
| 2110 | else | ||
| 2111 | { | ||
| 2112 | it.vpos = 0; | ||
| 2113 | move_it_by_lines (&it, min (INT_MAX, XINT (lines))); | ||
| 2109 | } | 2114 | } |
| 2110 | } | 2115 | } |
| 2111 | 2116 | ||
diff --git a/src/minibuf.c b/src/minibuf.c index d3f43b06254..341d544ef51 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -559,6 +559,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 559 | minibuffer = get_minibuffer (minibuf_level); | 559 | minibuffer = get_minibuffer (minibuf_level); |
| 560 | Fset_buffer (minibuffer); | 560 | Fset_buffer (minibuffer); |
| 561 | 561 | ||
| 562 | /* Defeat (setq-default truncate-lines t), since truncated lines do | ||
| 563 | not work correctly in minibuffers. (Bug#5715, etc) */ | ||
| 564 | BVAR (current_buffer, truncate_lines) = Qnil; | ||
| 565 | |||
| 562 | /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ | 566 | /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ |
| 563 | if (inherit_input_method) | 567 | if (inherit_input_method) |
| 564 | BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte; | 568 | BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte; |
diff --git a/src/window.c b/src/window.c index 0f5aeb0cda9..94b9f8a451f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1667,8 +1667,9 @@ DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, | |||
| 1667 | doc: /* Return buffers previously shown in WINDOW. | 1667 | doc: /* Return buffers previously shown in WINDOW. |
| 1668 | WINDOW must be a live window and defaults to the selected one. | 1668 | WINDOW must be a live window and defaults to the selected one. |
| 1669 | 1669 | ||
| 1670 | The return value is either nil or a list of <buffer, window-start, | 1670 | The return value is a list of elements (BUFFER WINDOW-START POS), |
| 1671 | window-point> triples where buffer was previously shown in WINDOW. */) | 1671 | where BUFFER is a buffer, WINDOW-START is the start position of the |
| 1672 | window for that buffer, and POS is a window-specific point value. */) | ||
| 1672 | (Lisp_Object window) | 1673 | (Lisp_Object window) |
| 1673 | { | 1674 | { |
| 1674 | return decode_window (window)->prev_buffers; | 1675 | return decode_window (window)->prev_buffers; |
| @@ -1677,11 +1678,11 @@ window-point> triples where buffer was previously shown in WINDOW. */) | |||
| 1677 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, | 1678 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, |
| 1678 | Sset_window_prev_buffers, 2, 2, 0, | 1679 | Sset_window_prev_buffers, 2, 2, 0, |
| 1679 | doc: /* Set WINDOW's previous buffers to PREV-BUFFERS. | 1680 | doc: /* Set WINDOW's previous buffers to PREV-BUFFERS. |
| 1680 | WINDOW must be a live window and defaults to the selected one. Return | 1681 | WINDOW must be a live window and defaults to the selected one. |
| 1681 | PREV-BUFFERS. | ||
| 1682 | 1682 | ||
| 1683 | PREV-BUFFERS should be either nil or a list of <buffer, window-start, | 1683 | PREV-BUFFERS should be a list of elements (BUFFER WINDOW-START POS), |
| 1684 | window-point> triples where buffer was previously shown in WINDOW. */) | 1684 | where BUFFER is a buffer, WINDOW-START is the start position of the |
| 1685 | window for that buffer, and POS is a window-specific point value. */) | ||
| 1685 | (Lisp_Object window, Lisp_Object prev_buffers) | 1686 | (Lisp_Object window, Lisp_Object prev_buffers) |
| 1686 | { | 1687 | { |
| 1687 | return decode_window (window)->prev_buffers = prev_buffers; | 1688 | return decode_window (window)->prev_buffers = prev_buffers; |
| @@ -1699,11 +1700,8 @@ WINDOW must be a live window and defaults to the selected one. */) | |||
| 1699 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, | 1700 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, |
| 1700 | Sset_window_next_buffers, 2, 2, 0, | 1701 | Sset_window_next_buffers, 2, 2, 0, |
| 1701 | doc: /* Set WINDOW's next buffers to NEXT-BUFFERS. | 1702 | doc: /* Set WINDOW's next buffers to NEXT-BUFFERS. |
| 1702 | WINDOW must be a live window and defaults to the selected one. Return | 1703 | WINDOW must be a live window and defaults to the selected one. |
| 1703 | NEXT-BUFFERS. | 1704 | NEXT-BUFFERS should be a list of buffers. */) |
| 1704 | |||
| 1705 | NEXT-BUFFERS should be either nil or a list of buffers that have been | ||
| 1706 | recently re-shown in WINDOW. */) | ||
| 1707 | (Lisp_Object window, Lisp_Object next_buffers) | 1705 | (Lisp_Object window, Lisp_Object next_buffers) |
| 1708 | { | 1706 | { |
| 1709 | return decode_window (window)->next_buffers = next_buffers; | 1707 | return decode_window (window)->next_buffers = next_buffers; |
diff --git a/src/xdisp.c b/src/xdisp.c index 44255c96468..d5a7c1ca595 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1215,6 +1215,34 @@ line_bottom_y (struct it *it) | |||
| 1215 | return line_top_y + line_height; | 1215 | return line_top_y + line_height; |
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| 1218 | /* Subroutine of pos_visible_p below. Extracts a display string, if | ||
| 1219 | any, from the display spec given as its argument. */ | ||
| 1220 | static Lisp_Object | ||
| 1221 | string_from_display_spec (Lisp_Object spec) | ||
| 1222 | { | ||
| 1223 | if (CONSP (spec)) | ||
| 1224 | { | ||
| 1225 | while (CONSP (spec)) | ||
| 1226 | { | ||
| 1227 | if (STRINGP (XCAR (spec))) | ||
| 1228 | return XCAR (spec); | ||
| 1229 | spec = XCDR (spec); | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | else if (VECTORP (spec)) | ||
| 1233 | { | ||
| 1234 | ptrdiff_t i; | ||
| 1235 | |||
| 1236 | for (i = 0; i < ASIZE (spec); i++) | ||
| 1237 | { | ||
| 1238 | if (STRINGP (AREF (spec, i))) | ||
| 1239 | return AREF (spec, i); | ||
| 1240 | } | ||
| 1241 | return Qnil; | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | return spec; | ||
| 1245 | } | ||
| 1218 | 1246 | ||
| 1219 | /* Return 1 if position CHARPOS is visible in window W. | 1247 | /* Return 1 if position CHARPOS is visible in window W. |
| 1220 | CHARPOS < 0 means return info about WINDOW_END position. | 1248 | CHARPOS < 0 means return info about WINDOW_END position. |
| @@ -1309,6 +1337,136 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y, | |||
| 1309 | } | 1337 | } |
| 1310 | } | 1338 | } |
| 1311 | } | 1339 | } |
| 1340 | else if (IT_CHARPOS (it) != charpos) | ||
| 1341 | { | ||
| 1342 | Lisp_Object cpos = make_number (charpos); | ||
| 1343 | Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil); | ||
| 1344 | Lisp_Object string = string_from_display_spec (spec); | ||
| 1345 | int newline_in_string = 0; | ||
| 1346 | |||
| 1347 | if (STRINGP (string)) | ||
| 1348 | { | ||
| 1349 | const char *s = SSDATA (string); | ||
| 1350 | const char *e = s + SBYTES (string); | ||
| 1351 | while (s < e) | ||
| 1352 | { | ||
| 1353 | if (*s++ == '\n') | ||
| 1354 | { | ||
| 1355 | newline_in_string = 1; | ||
| 1356 | break; | ||
| 1357 | } | ||
| 1358 | } | ||
| 1359 | } | ||
| 1360 | /* The tricky code below is needed because there's a | ||
| 1361 | discrepancy between move_it_to and how we set cursor | ||
| 1362 | when the display line ends in a newline from a | ||
| 1363 | display string. move_it_to will stop _after_ such | ||
| 1364 | display strings, whereas set_cursor_from_row | ||
| 1365 | conspires with cursor_row_p to place the cursor on | ||
| 1366 | the first glyph produced from the display string. */ | ||
| 1367 | |||
| 1368 | /* We have overshoot PT because it is covered by a | ||
| 1369 | display property whose value is a string. If the | ||
| 1370 | string includes embedded newlines, we are also in the | ||
| 1371 | wrong display line. Backtrack to the correct line, | ||
| 1372 | where the display string begins. */ | ||
| 1373 | if (newline_in_string) | ||
| 1374 | { | ||
| 1375 | Lisp_Object startpos, endpos; | ||
| 1376 | EMACS_INT start, end; | ||
| 1377 | struct it it3; | ||
| 1378 | |||
| 1379 | /* Find the first and the last buffer positions | ||
| 1380 | covered by the display string. */ | ||
| 1381 | endpos = | ||
| 1382 | Fnext_single_char_property_change (cpos, Qdisplay, | ||
| 1383 | Qnil, Qnil); | ||
| 1384 | startpos = | ||
| 1385 | Fprevious_single_char_property_change (endpos, Qdisplay, | ||
| 1386 | Qnil, Qnil); | ||
| 1387 | start = XFASTINT (startpos); | ||
| 1388 | end = XFASTINT (endpos); | ||
| 1389 | /* Move to the last buffer position before the | ||
| 1390 | display property. */ | ||
| 1391 | start_display (&it3, w, top); | ||
| 1392 | move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); | ||
| 1393 | /* Move forward one more line if the position before | ||
| 1394 | the display string is a newline or if it is the | ||
| 1395 | rightmost character on a line that is | ||
| 1396 | continued or word-wrapped. */ | ||
| 1397 | if (it3.method == GET_FROM_BUFFER | ||
| 1398 | && it3.c == '\n') | ||
| 1399 | move_it_by_lines (&it3, 1); | ||
| 1400 | else if (move_it_in_display_line_to (&it3, -1, | ||
| 1401 | it3.current_x | ||
| 1402 | + it3.pixel_width, | ||
| 1403 | MOVE_TO_X) | ||
| 1404 | == MOVE_LINE_CONTINUED) | ||
| 1405 | { | ||
| 1406 | move_it_by_lines (&it3, 1); | ||
| 1407 | /* When we are under word-wrap, the #$@%! | ||
| 1408 | move_it_by_lines moves 2 lines, so we need to | ||
| 1409 | fix that up. */ | ||
| 1410 | if (it3.line_wrap == WORD_WRAP) | ||
| 1411 | move_it_by_lines (&it3, -1); | ||
| 1412 | } | ||
| 1413 | |||
| 1414 | /* Record the vertical coordinate of the display | ||
| 1415 | line where we wound up. */ | ||
| 1416 | top_y = it3.current_y; | ||
| 1417 | if (it3.bidi_p) | ||
| 1418 | { | ||
| 1419 | /* When characters are reordered for display, | ||
| 1420 | the character displayed to the left of the | ||
| 1421 | display string could be _after_ the display | ||
| 1422 | property in the logical order. Use the | ||
| 1423 | smallest vertical position of these two. */ | ||
| 1424 | start_display (&it3, w, top); | ||
| 1425 | move_it_to (&it3, end + 1, -1, -1, -1, MOVE_TO_POS); | ||
| 1426 | if (it3.current_y < top_y) | ||
| 1427 | top_y = it3.current_y; | ||
| 1428 | } | ||
| 1429 | /* Move from the top of the window to the beginning | ||
| 1430 | of the display line where the display string | ||
| 1431 | begins. */ | ||
| 1432 | start_display (&it3, w, top); | ||
| 1433 | move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y); | ||
| 1434 | /* Finally, advance the iterator until we hit the | ||
| 1435 | first display element whose character position is | ||
| 1436 | CHARPOS, or until the first newline from the | ||
| 1437 | display string, which signals the end of the | ||
| 1438 | display line. */ | ||
| 1439 | while (get_next_display_element (&it3)) | ||
| 1440 | { | ||
| 1441 | PRODUCE_GLYPHS (&it3); | ||
| 1442 | if (IT_CHARPOS (it3) == charpos | ||
| 1443 | || ITERATOR_AT_END_OF_LINE_P (&it3)) | ||
| 1444 | break; | ||
| 1445 | set_iterator_to_next (&it3, 0); | ||
| 1446 | } | ||
| 1447 | top_x = it3.current_x - it3.pixel_width; | ||
| 1448 | /* Normally, we would exit the above loop because we | ||
| 1449 | found the display element whose character | ||
| 1450 | position is CHARPOS. For the contingency that we | ||
| 1451 | didn't, and stopped at the first newline from the | ||
| 1452 | display string, move back over the glyphs | ||
| 1453 | prfoduced from the string, until we find the | ||
| 1454 | rightmost glyph not from the string. */ | ||
| 1455 | if (IT_CHARPOS (it3) != charpos && EQ (it3.object, string)) | ||
| 1456 | { | ||
| 1457 | struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA] | ||
| 1458 | + it3.glyph_row->used[TEXT_AREA]; | ||
| 1459 | |||
| 1460 | while (EQ ((g - 1)->object, string)) | ||
| 1461 | { | ||
| 1462 | --g; | ||
| 1463 | top_x -= g->pixel_width; | ||
| 1464 | } | ||
| 1465 | xassert (g < it3.glyph_row->glyphs[TEXT_AREA] | ||
| 1466 | + it3.glyph_row->used[TEXT_AREA]); | ||
| 1467 | } | ||
| 1468 | } | ||
| 1469 | } | ||
| 1312 | 1470 | ||
| 1313 | *x = top_x; | 1471 | *x = top_x; |
| 1314 | *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); | 1472 | *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); |
| @@ -8575,7 +8733,16 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8575 | move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, | 8733 | move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, |
| 8576 | MOVE_TO_POS | MOVE_TO_VPOS); | 8734 | MOVE_TO_POS | MOVE_TO_VPOS); |
| 8577 | } | 8735 | } |
| 8578 | while (!IT_POS_VALID_AFTER_MOVE_P (&it2)); | 8736 | while (!(IT_POS_VALID_AFTER_MOVE_P (&it2) |
| 8737 | /* If we are in a display string which starts at START_POS, | ||
| 8738 | and that display string includes a newline, and we are | ||
| 8739 | right after that newline (i.e. at the beginning of a | ||
| 8740 | display line), exit the loop, because otherwise we will | ||
| 8741 | infloop, since move_it_to will see that it is already at | ||
| 8742 | START_POS and will not move. */ | ||
| 8743 | || (it2.method == GET_FROM_STRING | ||
| 8744 | && IT_CHARPOS (it2) == start_pos | ||
| 8745 | && SREF (it2.string, IT_STRING_BYTEPOS (it2) - 1) == '\n'))); | ||
| 8579 | xassert (IT_CHARPOS (*it) >= BEGV); | 8746 | xassert (IT_CHARPOS (*it) >= BEGV); |
| 8580 | SAVE_IT (it3, it2, it3data); | 8747 | SAVE_IT (it3, it2, it3data); |
| 8581 | 8748 | ||