aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-08-13 22:11:36 -0700
committerPaul Eggert2011-08-13 22:11:36 -0700
commit358e1dd2b2e984069dc761ee4266efdad33a213f (patch)
tree24932c1e3dd81a084d9c0434868de7d72024f0ba /src
parent3019ceda0d720be62102bd76d52cfcab67ac012a (diff)
parent377538cbcf8c1f0aab9b40ed2ff3df414904272f (diff)
downloademacs-358e1dd2b2e984069dc761ee4266efdad33a213f.tar.gz
emacs-358e1dd2b2e984069dc761ee4266efdad33a213f.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog62
-rw-r--r--src/composite.c2
-rw-r--r--src/editfns.c11
-rw-r--r--src/fontset.c8
-rw-r--r--src/ftfont.c4
-rw-r--r--src/process.c94
-rw-r--r--src/unexmacosx.c37
-rw-r--r--src/xdisp.c92
8 files changed, 261 insertions, 49 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 039c225c1f6..899ee14686d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,65 @@
12011-08-13 Jan Djärv <jan.h.d@swipnet.se>
2
3 * process.c: Include ifaddrs.h and net/if_dl.h if available (Bug#8477).
4 (Fnetwork_interface_list): Allocate in increments of bytes instead
5 of sizeof (struct ifreq). Iterate over ifconf.ifc_req by counting
6 bytes (Bug#8477). Count bytes correctly when ifr_addr is a struct
7 sockaddr.
8 (struct ifflag_def): notrailers is smart on OSX.
9 (Fnetwork_interface_info): Handle case when ifr_flags is negative.
10 Get hardware address with getifaddrs if available.
11
122011-08-12 Eli Zaretskii <eliz@gnu.org>
13
14 * xdisp.c (iterate_out_of_display_property): xassert that
15 IT->position is set to within IT->object's boundaries. Break from
16 the loop as soon as EOB is reached; avoids infloops in redisplay
17 when IT->position is set up wrongly due to some bug. Set
18 IT->current to match the bidi iterator unconditionally.
19 (push_display_prop): Allow GET_FROM_STRING as IT->method on
20 entry. Force push_it to save on the stack the current
21 buffer/string position, to be restored by pop_it. Fix flags in
22 the iterator structure wrt the object coming from a display
23 property, as `line-prefix' and `wrap-prefix' are not ``replacing''
24 properties. (Bug#9284)
25
262011-08-09 Andreas Schwab <schwab@linux-m68k.org>
27
28 * fontset.c (fontset_get_font_group): Add proper type checks.
29 (Bug#9172)
30
312011-08-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
32
33 * unexmacosx.c (print_load_command_name): Add cases LC_FUNCTION_STARTS
34 and LC_VERSION_MIN_MACOSX.
35 (copy_linkedit_data) [LC_FUNCTION_STARTS]: New function.
36 (dump_it) [LC_FUNCTION_STARTS]: Use it.
37
382011-08-08 Eli Zaretskii <eliz@gnu.org>
39
40 * xdisp.c (forward_to_next_line_start): Allow to use the
41 no-display-properties-and-no-overlays under bidi display. Set
42 disp_pos in the bidi iterator to avoid searches for display
43 properties and overlays.
44
452011-08-08 Chong Yidong <cyd@stupidchicken.com>
46
47 * editfns.c (Fset_time_zone_rule): Document relationship with the
48 setenv function.
49
50 * ftfont.c (ftfont_pattern_entity): Copy the extras argument to
51 the font entity extracted from the cache (Bug#8109).
52
532011-08-07 Chong Yidong <cyd@stupidchicken.com>
54
55 * composite.c (autocmp_chars): Don't reset point. That is done by
56 restore_point_unwind (Bug#5984).
57
582011-08-07 Juri Linkov <juri@jurta.org>
59
60 * editfns.c (Fformat_time_string): Doc fix, add tag `usage:'
61 to show the arg `TIME' instead of `TIMEVAL'.
62
12011-08-06 Eli Zaretskii <eliz@gnu.org> 632011-08-06 Eli Zaretskii <eliz@gnu.org>
2 64
3 * xdisp.c (set_cursor_from_row): Fix cursor positioning when a 65 * xdisp.c (set_cursor_from_row): Fix cursor positioning when a
diff --git a/src/composite.c b/src/composite.c
index d402d5ad0c4..3308a028042 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -960,8 +960,6 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT
960 args[4] = font_object; 960 args[4] = font_object;
961 args[5] = string; 961 args[5] = string;
962 lgstring = safe_call (6, args); 962 lgstring = safe_call (6, args);
963 if (NILP (string))
964 TEMP_SET_PT_BOTH (pt, pt_byte);
965 } 963 }
966 return unbind_to (count, lgstring); 964 return unbind_to (count, lgstring);
967} 965}
diff --git a/src/editfns.c b/src/editfns.c
index 577263c5aea..297f7b6d7e4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1695,7 +1695,9 @@ The modifiers are `E' and `O'. For certain characters X,
1695%EX is a locale's alternative version of %X; 1695%EX is a locale's alternative version of %X;
1696%OX is like %X, but uses the locale's number symbols. 1696%OX is like %X, but uses the locale's number symbols.
1697 1697
1698For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) 1698For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".
1699
1700usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL) */)
1699 (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) 1701 (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal)
1700{ 1702{
1701 time_t value; 1703 time_t value;
@@ -2051,7 +2053,12 @@ static char *initial_tz;
2051DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, 2053DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0,
2052 doc: /* Set the local time zone using TZ, a string specifying a time zone rule. 2054 doc: /* Set the local time zone using TZ, a string specifying a time zone rule.
2053If TZ is nil, use implementation-defined default time zone information. 2055If TZ is nil, use implementation-defined default time zone information.
2054If TZ is t, use Universal Time. */) 2056If TZ is t, use Universal Time.
2057
2058Instead of calling this function, you typically want (setenv "TZ" TZ).
2059That changes both the environment of the Emacs process and the
2060variable `process-environment', whereas `set-time-zone-rule' affects
2061only the former. */)
2055 (Lisp_Object tz) 2062 (Lisp_Object tz)
2056{ 2063{
2057 const char *tzstring; 2064 const char *tzstring;
diff --git a/src/fontset.c b/src/fontset.c
index 74eb61d2665..c8ae1e74848 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -447,7 +447,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
447/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for 447/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for
448 character C in FONTSET. If C is -1, return a fallback font-group. 448 character C in FONTSET. If C is -1, return a fallback font-group.
449 If C is not -1, the value may be Qt (FONTSET doesn't have a font 449 If C is not -1, the value may be Qt (FONTSET doesn't have a font
450 for C even in the fallback group, or 0 (a font for C may be found 450 for C even in the fallback group), or 0 (a font for C may be found
451 only in the fallback group). */ 451 only in the fallback group). */
452 452
453static Lisp_Object 453static Lisp_Object
@@ -465,7 +465,9 @@ fontset_get_font_group (Lisp_Object fontset, int c)
465 if (! NILP (font_group)) 465 if (! NILP (font_group))
466 return font_group; 466 return font_group;
467 base_fontset = FONTSET_BASE (fontset); 467 base_fontset = FONTSET_BASE (fontset);
468 if (c >= 0) 468 if (NILP (base_fontset))
469 font_group = Qnil;
470 else if (c >= 0)
469 font_group = char_table_ref_and_range (base_fontset, c, &from, &to); 471 font_group = char_table_ref_and_range (base_fontset, c, &from, &to);
470 else 472 else
471 font_group = FONTSET_FALLBACK (base_fontset); 473 font_group = FONTSET_FALLBACK (base_fontset);
@@ -476,6 +478,8 @@ fontset_get_font_group (Lisp_Object fontset, int c)
476 char_table_set_range (fontset, from, to, font_group); 478 char_table_set_range (fontset, from, to, font_group);
477 return font_group; 479 return font_group;
478 } 480 }
481 if (!VECTORP (font_group))
482 return font_group;
479 font_group = Fcopy_sequence (font_group); 483 font_group = Fcopy_sequence (font_group);
480 for (i = 0; i < ASIZE (font_group); i++) 484 for (i = 0; i < ASIZE (font_group); i++)
481 if (! NILP (AREF (font_group, i))) 485 if (! NILP (AREF (font_group, i)))
diff --git a/src/ftfont.c b/src/ftfont.c
index 4e313a89021..5c98073057c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -214,6 +214,10 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
214 214
215 for (i = 0; i < FONT_OBJLIST_INDEX; i++) 215 for (i = 0; i < FONT_OBJLIST_INDEX; i++)
216 ASET (val, i, AREF (entity, i)); 216 ASET (val, i, AREF (entity, i));
217
218 ASET (val, FONT_EXTRA_INDEX, Fcopy_sequence (extra));
219 font_put_extra (val, QCfont_entity, key);
220
217 return val; 221 return val;
218 } 222 }
219 entity = font_make_entity (); 223 entity = font_make_entity ();
diff --git a/src/process.c b/src/process.c
index 236c27e5c3a..b3c295cecde 100644
--- a/src/process.c
+++ b/src/process.c
@@ -58,6 +58,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58#include <net/if.h> 58#include <net/if.h>
59#endif /* HAVE_NET_IF_H */ 59#endif /* HAVE_NET_IF_H */
60 60
61#if defined(HAVE_IFADDRS_H)
62/* Must be after net/if.h */
63#include <ifaddrs.h>
64
65/* We only use structs from this header when we use getifaddrs. */
66#if defined(HAVE_NET_IF_DL_H)
67#include <net/if_dl.h>
68#endif
69
70#endif
71
61#ifdef NEED_BSDTTY 72#ifdef NEED_BSDTTY
62#include <bsdtty.h> 73#include <bsdtty.h>
63#endif 74#endif
@@ -3557,9 +3568,9 @@ format; see the description of ADDRESS in `make-network-process'. */)
3557 (void) 3568 (void)
3558{ 3569{
3559 struct ifconf ifconf; 3570 struct ifconf ifconf;
3560 struct ifreq *ifreqs = NULL; 3571 struct ifreq *ifreq;
3561 int ifaces = 0; 3572 void *buf = NULL;
3562 int buf_size, s; 3573 int buf_size = 512, s, i;
3563 Lisp_Object res; 3574 Lisp_Object res;
3564 3575
3565 s = socket (AF_INET, SOCK_STREAM, 0); 3576 s = socket (AF_INET, SOCK_STREAM, 0);
@@ -3567,20 +3578,19 @@ format; see the description of ADDRESS in `make-network-process'. */)
3567 return Qnil; 3578 return Qnil;
3568 3579
3569 again: 3580 again:
3570 ifaces += 25; 3581 buf_size *= 2;
3571 buf_size = ifaces * sizeof (ifreqs[0]); 3582 buf = xrealloc(buf, buf_size);
3572 ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size); 3583 if (!buf)
3573 if (!ifreqs)
3574 { 3584 {
3575 close (s); 3585 close (s);
3576 return Qnil; 3586 return Qnil;
3577 } 3587 }
3578 3588
3579 ifconf.ifc_len = buf_size; 3589 ifconf.ifc_buf = buf;
3580 ifconf.ifc_req = ifreqs;
3581 if (ioctl (s, SIOCGIFCONF, &ifconf)) 3590 if (ioctl (s, SIOCGIFCONF, &ifconf))
3582 { 3591 {
3583 close (s); 3592 close (s);
3593 xfree (buf);
3584 return Qnil; 3594 return Qnil;
3585 } 3595 }
3586 3596
@@ -3588,15 +3598,29 @@ format; see the description of ADDRESS in `make-network-process'. */)
3588 goto again; 3598 goto again;
3589 3599
3590 close (s); 3600 close (s);
3591 ifaces = ifconf.ifc_len / sizeof (ifreqs[0]);
3592 3601
3593 res = Qnil; 3602 res = Qnil;
3594 while (--ifaces >= 0) 3603 for (ifreq = ifconf.ifc_req;
3604 (char *) ifreq < (char *) (ifconf.ifc_req) + ifconf.ifc_len;
3605 )
3595 { 3606 {
3596 struct ifreq *ifq = &ifreqs[ifaces]; 3607 struct ifreq *ifq = ifreq;
3608#ifdef HAVE_STRUCT_IFREQ_IFR_ADDR_SA_LEN
3609#define SIZEOF_IFREQ(sif) \
3610 ((sif)->ifr_addr.sa_len < sizeof(struct sockaddr) ? \
3611 sizeof((*sif)) : sizeof ((sif)->ifr_name) + sif->ifr_addr.sa_len)
3612
3613 int len = SIZEOF_IFREQ (ifq);
3614#else
3615 int len = sizeof (*ifreq);
3616#endif
3597 char namebuf[sizeof (ifq->ifr_name) + 1]; 3617 char namebuf[sizeof (ifq->ifr_name) + 1];
3618 i += len;
3619 ifreq = (struct ifreq*) ((char*) ifreq + len);
3620
3598 if (ifq->ifr_addr.sa_family != AF_INET) 3621 if (ifq->ifr_addr.sa_family != AF_INET)
3599 continue; 3622 continue;
3623
3600 memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name)); 3624 memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
3601 namebuf[sizeof (ifq->ifr_name)] = 0; 3625 namebuf[sizeof (ifq->ifr_name)] = 0;
3602 res = Fcons (Fcons (build_string (namebuf), 3626 res = Fcons (Fcons (build_string (namebuf),
@@ -3605,6 +3629,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
3605 res); 3629 res);
3606 } 3630 }
3607 3631
3632 xfree (buf);
3608 return res; 3633 return res;
3609} 3634}
3610#endif /* SIOCGIFCONF */ 3635#endif /* SIOCGIFCONF */
@@ -3642,8 +3667,13 @@ static const struct ifflag_def ifflag_table[] = {
3642 { IFF_PROMISC, "promisc" }, 3667 { IFF_PROMISC, "promisc" },
3643#endif 3668#endif
3644#ifdef IFF_NOTRAILERS 3669#ifdef IFF_NOTRAILERS
3670#ifdef NS_IMPL_COCOA
3671 /* Really means smart, notrailers is obsolete */
3672 { IFF_NOTRAILERS, "smart" },
3673#else
3645 { IFF_NOTRAILERS, "notrailers" }, 3674 { IFF_NOTRAILERS, "notrailers" },
3646#endif 3675#endif
3676#endif
3647#ifdef IFF_ALLMULTI 3677#ifdef IFF_ALLMULTI
3648 { IFF_ALLMULTI, "allmulti" }, 3678 { IFF_ALLMULTI, "allmulti" },
3649#endif 3679#endif
@@ -3696,6 +3726,9 @@ FLAGS is the current flags of the interface. */)
3696 Lisp_Object elt; 3726 Lisp_Object elt;
3697 int s; 3727 int s;
3698 int any = 0; 3728 int any = 0;
3729#if defined(HAVE_GETIFADDRS)
3730 struct ifaddrs *ifap;
3731#endif
3699 3732
3700 CHECK_STRING (ifname); 3733 CHECK_STRING (ifname);
3701 3734
@@ -3714,6 +3747,12 @@ FLAGS is the current flags of the interface. */)
3714 const struct ifflag_def *fp; 3747 const struct ifflag_def *fp;
3715 int fnum; 3748 int fnum;
3716 3749
3750 /* If flags is smaller than int (i.e. short) it may have the high bit set
3751 due to IFF_MULTICAST. In that case, sign extending it into
3752 an int is wrong. */
3753 if (flags < 0 && sizeof (rq.ifr_flags) < sizeof (flags))
3754 flags = (unsigned short) rq.ifr_flags;
3755
3717 any = 1; 3756 any = 1;
3718 for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++) 3757 for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++)
3719 { 3758 {
@@ -3747,7 +3786,38 @@ FLAGS is the current flags of the interface. */)
3747 p->contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); 3786 p->contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]);
3748 elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); 3787 elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr);
3749 } 3788 }
3789#elif defined(HAVE_GETIFADDRS) && defined(LLADDR)
3790 if (getifaddrs (&ifap) != -1)
3791 {
3792 Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
3793 register struct Lisp_Vector *p = XVECTOR (hwaddr);
3794 struct ifaddrs *it;
3795
3796 for (it = ifap; it != NULL; it = it->ifa_next)
3797 {
3798 struct sockaddr_dl *sdl = (struct sockaddr_dl*) it->ifa_addr;
3799 unsigned char linkaddr[6];
3800 int n;
3801
3802 if (it->ifa_addr->sa_family != AF_LINK
3803 || strcmp (it->ifa_name, SSDATA (ifname)) != 0
3804 || sdl->sdl_alen != 6)
3805 continue;
3806
3807 memcpy (linkaddr, LLADDR(sdl), sdl->sdl_alen);
3808 for (n = 0; n < 6; n++)
3809 p->contents[n] = make_number (linkaddr[n]);
3810
3811 elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr);
3812 break;
3813 }
3814 }
3815#ifdef HAVE_FREEIFADDRS
3816 freeifaddrs (ifap);
3750#endif 3817#endif
3818
3819#endif /* HAVE_GETIFADDRS && LLADDR */
3820
3751 res = Fcons (elt, res); 3821 res = Fcons (elt, res);
3752 3822
3753 elt = Qnil; 3823 elt = Qnil;
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 04e3edf463e..0751eeacb9b 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -599,6 +599,16 @@ print_load_command_name (int lc)
599 printf ("LC_DYLD_INFO_ONLY"); 599 printf ("LC_DYLD_INFO_ONLY");
600 break; 600 break;
601#endif 601#endif
602#ifdef LC_VERSION_MIN_MACOSX
603 case LC_VERSION_MIN_MACOSX:
604 printf ("LC_VERSION_MIN_MACOSX");
605 break;
606#endif
607#ifdef LC_FUNCTION_STARTS
608 case LC_FUNCTION_STARTS:
609 printf ("LC_FUNCTION_STARTS");
610 break;
611#endif
602 default: 612 default:
603 printf ("unknown "); 613 printf ("unknown ");
604 } 614 }
@@ -1135,6 +1145,28 @@ copy_dyld_info (struct load_command *lc, long delta)
1135} 1145}
1136#endif 1146#endif
1137 1147
1148#ifdef LC_FUNCTION_STARTS
1149/* Copy a LC_FUNCTION_STARTS load command from the input file to the
1150 output file, adjusting the data offset field. */
1151static void
1152copy_linkedit_data (struct load_command *lc, long delta)
1153{
1154 struct linkedit_data_command *ldp = (struct linkedit_data_command *) lc;
1155
1156 if (ldp->dataoff > 0)
1157 ldp->dataoff += delta;
1158
1159 printf ("Writing ");
1160 print_load_command_name (lc->cmd);
1161 printf (" command\n");
1162
1163 if (!unexec_write (curr_header_offset, lc, lc->cmdsize))
1164 unexec_error ("cannot write linkedit data command to header");
1165
1166 curr_header_offset += lc->cmdsize;
1167}
1168#endif
1169
1138/* Copy other kinds of load commands from the input file to the output 1170/* Copy other kinds of load commands from the input file to the output
1139 file, ones that do not require adjustments of file offsets. */ 1171 file, ones that do not require adjustments of file offsets. */
1140static void 1172static void
@@ -1207,6 +1239,11 @@ dump_it (void)
1207 copy_dyld_info (lca[i], linkedit_delta); 1239 copy_dyld_info (lca[i], linkedit_delta);
1208 break; 1240 break;
1209#endif 1241#endif
1242#ifdef LC_FUNCTION_STARTS
1243 case LC_FUNCTION_STARTS:
1244 copy_linkedit_data (lca[i], linkedit_delta);
1245 break;
1246#endif
1210 default: 1247 default:
1211 copy_other (lca[i]); 1248 copy_other (lca[i]);
1212 break; 1249 break;
diff --git a/src/xdisp.c b/src/xdisp.c
index 02683bad2f1..6173ef4ce74 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5328,6 +5328,8 @@ iterate_out_of_display_property (struct it *it)
5328 EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); 5328 EMACS_INT eob = (buffer_p ? ZV : it->end_charpos);
5329 EMACS_INT bob = (buffer_p ? BEGV : 0); 5329 EMACS_INT bob = (buffer_p ? BEGV : 0);
5330 5330
5331 xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob);
5332
5331 /* Maybe initialize paragraph direction. If we are at the beginning 5333 /* Maybe initialize paragraph direction. If we are at the beginning
5332 of a new paragraph, next_element_from_buffer may not have a 5334 of a new paragraph, next_element_from_buffer may not have a
5333 chance to do that. */ 5335 chance to do that. */
@@ -5336,7 +5338,8 @@ iterate_out_of_display_property (struct it *it)
5336 /* prev_stop can be zero, so check against BEGV as well. */ 5338 /* prev_stop can be zero, so check against BEGV as well. */
5337 while (it->bidi_it.charpos >= bob 5339 while (it->bidi_it.charpos >= bob
5338 && it->prev_stop <= it->bidi_it.charpos 5340 && it->prev_stop <= it->bidi_it.charpos
5339 && it->bidi_it.charpos < CHARPOS (it->position)) 5341 && it->bidi_it.charpos < CHARPOS (it->position)
5342 && it->bidi_it.charpos < eob)
5340 bidi_move_to_visually_next (&it->bidi_it); 5343 bidi_move_to_visually_next (&it->bidi_it);
5341 /* Record the stop_pos we just crossed, for when we cross it 5344 /* Record the stop_pos we just crossed, for when we cross it
5342 back, maybe. */ 5345 back, maybe. */
@@ -5345,14 +5348,11 @@ iterate_out_of_display_property (struct it *it)
5345 /* If we ended up not where pop_it put us, resync IT's 5348 /* If we ended up not where pop_it put us, resync IT's
5346 positional members with the bidi iterator. */ 5349 positional members with the bidi iterator. */
5347 if (it->bidi_it.charpos != CHARPOS (it->position)) 5350 if (it->bidi_it.charpos != CHARPOS (it->position))
5348 { 5351 SET_TEXT_POS (it->position, it->bidi_it.charpos, it->bidi_it.bytepos);
5349 SET_TEXT_POS (it->position, 5352 if (buffer_p)
5350 it->bidi_it.charpos, it->bidi_it.bytepos); 5353 it->current.pos = it->position;
5351 if (buffer_p) 5354 else
5352 it->current.pos = it->position; 5355 it->current.string_pos = it->position;
5353 else
5354 it->current.string_pos = it->position;
5355 }
5356} 5356}
5357 5357
5358/* Restore IT's settings from IT->stack. Called, for example, when no 5358/* Restore IT's settings from IT->stack. Called, for example, when no
@@ -5534,19 +5534,42 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
5534 5534
5535 xassert (!STRINGP (it->string)); 5535 xassert (!STRINGP (it->string));
5536 5536
5537 /* If we are not bidi-reordering, and there isn't any `display' 5537 /* If there isn't any `display' property in sight, and no
5538 property in sight, and no overlays, we can just use the 5538 overlays, we can just use the position of the newline in
5539 position of the newline in buffer text. */ 5539 buffer text. */
5540 if (!it->bidi_p 5540 if (it->stop_charpos >= limit
5541 && (it->stop_charpos >= limit 5541 || ((pos = Fnext_single_property_change (make_number (start),
5542 || ((pos = Fnext_single_property_change (make_number (start), 5542 Qdisplay, Qnil,
5543 Qdisplay, Qnil, 5543 make_number (limit)),
5544 make_number (limit)), 5544 NILP (pos))
5545 NILP (pos)) 5545 && next_overlay_change (start) == ZV))
5546 && next_overlay_change (start) == ZV))) 5546 {
5547 { 5547 if (!it->bidi_p)
5548 IT_CHARPOS (*it) = limit; 5548 {
5549 IT_BYTEPOS (*it) = CHAR_TO_BYTE (limit); 5549 IT_CHARPOS (*it) = limit;
5550 IT_BYTEPOS (*it) = CHAR_TO_BYTE (limit);
5551 }
5552 else
5553 {
5554 struct bidi_it bprev;
5555
5556 /* Help bidi.c avoid expensive searches for display
5557 properties and overlays, by telling it that there are
5558 none up to `limit'. */
5559 if (it->bidi_it.disp_pos < limit)
5560 {
5561 it->bidi_it.disp_pos = limit;
5562 it->bidi_it.disp_prop_p = 0;
5563 }
5564 do {
5565 bprev = it->bidi_it;
5566 bidi_move_to_visually_next (&it->bidi_it);
5567 } while (it->bidi_it.charpos != limit);
5568 IT_CHARPOS (*it) = limit;
5569 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
5570 if (bidi_it_prev)
5571 *bidi_it_prev = bprev;
5572 }
5550 *skipped_p = newline_found_p = 1; 5573 *skipped_p = newline_found_p = 1;
5551 } 5574 }
5552 else 5575 else
@@ -18035,16 +18058,25 @@ cursor_row_p (struct glyph_row *row)
18035 18058
18036 18059
18037 18060
18038/* Push the display property PROP so that it will be rendered at the 18061/* Push the property PROP so that it will be rendered at the current
18039 current position in IT. Return 1 if PROP was successfully pushed, 18062 position in IT. Return 1 if PROP was successfully pushed, 0
18040 0 otherwise. */ 18063 otherwise. Called from handle_line_prefix to handle the
18064 `line-prefix' and `wrap-prefix' properties. */
18041 18065
18042static int 18066static int
18043push_display_prop (struct it *it, Lisp_Object prop) 18067push_display_prop (struct it *it, Lisp_Object prop)
18044{ 18068{
18045 xassert (it->method == GET_FROM_BUFFER); 18069 struct text_pos pos =
18070 (it->method == GET_FROM_STRING) ? it->current.string_pos : it->current.pos;
18071
18072 xassert (it->method == GET_FROM_BUFFER
18073 || it->method == GET_FROM_STRING);
18046 18074
18047 push_it (it, NULL); 18075 /* We need to save the current buffer/string position, so it will be
18076 restored by pop_it, because iterate_out_of_display_property
18077 depends on that being set correctly, but some situations leave
18078 it->position not yet set when this function is called. */
18079 push_it (it, &pos);
18048 18080
18049 if (STRINGP (prop)) 18081 if (STRINGP (prop))
18050 { 18082 {
@@ -18063,11 +18095,9 @@ push_display_prop (struct it *it, Lisp_Object prop)
18063 it->stop_charpos = 0; 18095 it->stop_charpos = 0;
18064 it->prev_stop = 0; 18096 it->prev_stop = 0;
18065 it->base_level_stop = 0; 18097 it->base_level_stop = 0;
18066 it->string_from_display_prop_p = 1;
18067 it->from_disp_prop_p = 1;
18068 18098
18069 /* Force paragraph direction to be that of the parent 18099 /* Force paragraph direction to be that of the parent
18070 buffer. */ 18100 buffer/string. */
18071 if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) 18101 if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
18072 it->paragraph_embedding = it->bidi_it.paragraph_dir; 18102 it->paragraph_embedding = it->bidi_it.paragraph_dir;
18073 else 18103 else
@@ -18080,7 +18110,7 @@ push_display_prop (struct it *it, Lisp_Object prop)
18080 it->bidi_it.string.s = NULL; 18110 it->bidi_it.string.s = NULL;
18081 it->bidi_it.string.schars = it->end_charpos; 18111 it->bidi_it.string.schars = it->end_charpos;
18082 it->bidi_it.string.bufpos = IT_CHARPOS (*it); 18112 it->bidi_it.string.bufpos = IT_CHARPOS (*it);
18083 it->bidi_it.string.from_disp_str = 1; 18113 it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
18084 it->bidi_it.string.unibyte = !it->multibyte_p; 18114 it->bidi_it.string.unibyte = !it->multibyte_p;
18085 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 18115 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
18086 } 18116 }