(rst-re-alist): Fix loading (bug#11462).
authorStefan Merten <smerten@oekonux.de>
Mon, 14 May 2012 20:39:14 +0000 (22:39 +0200)
committerStefan Merten <smerten@oekonux.de>
Mon, 14 May 2012 20:39:14 +0000 (22:39 +0200)
16 files changed:
doc/misc/ChangeLog
doc/misc/Makefile.in
doc/misc/cc-mode.texi
lisp/ChangeLog
lisp/erc/ChangeLog
lisp/erc/erc-dcc.el
lisp/mail/smtpmail.el
lisp/net/rlogin.el
lisp/shell.el
lisp/url/ChangeLog
lisp/url/url-expand.el
src/ChangeLog
src/keyboard.c
src/nsterm.m
src/unexaix.c
src/xdisp.c

index 915e85a..c7dd1d3 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-14  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * cc-mode.texi: Avoid space before macro in 4th argument of cross
+       reference commands.  (Bug#11461)
+
+       * Makefile.in (gnus.dvi): Use $@ instead of $*.dvi.
+
 2012-05-12  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (mostlyclean): Add more TeX intermediates.
index 0c0a4e0..c3bbfbb 100644 (file)
@@ -415,7 +415,7 @@ $(infodir)/gnus$(INFO_EXT): ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
 gnus.dvi: ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
        sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
        $(ENVADD) $(TEXI2DVI) gnustmp.texi
-       cp gnustmp.dvi $*.dvi
+       cp gnustmp.dvi $@
        rm gnustmp.*
 gnus.pdf: ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
        sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
index 58420bb..8c574be 100644 (file)
@@ -701,7 +701,7 @@ in some circumstances---@code{c-insert-tab-function} then defines
 precisely what sort of ``whitespace'' this will be.  Set the standard
 Emacs variable @code{indent-tabs-mode} to @code{t} if you want real
 @samp{tab} characters to be used in the indentation, to @code{nil} if
-you want only spaces.  @xref{Just Spaces,,, @emacsman{},
+you want only spaces.  @xref{Just Spaces,,,@emacsman{},
 @emacsmantitle{}}.
 
 @defopt c-tab-always-indent
@@ -1058,8 +1058,8 @@ set this up for you, so you probably won't have to bother.
 @cindex Auto Fill mode
 @cindex paragraph filling
 Line breaks are by default handled (almost) the same regardless of
-whether they are made by auto fill mode (@pxref{Auto Fill,,,
-@emacsman{}, @emacsmantitle{}}), by paragraph filling (e.g. with
+whether they are made by auto fill mode (@pxref{Auto
+Fill,,,@emacsman{}, @emacsmantitle{}}), by paragraph filling (e.g. with
 @kbd{M-q}), or explicitly with @kbd{M-j} or similar methods.  In
 string literals, the new line gets the same indentation as the
 previous nonempty line.@footnote{You can change this default by
@@ -1402,7 +1402,7 @@ continuation of the preceding @code{if}.
 @vindex abbrev-mode
 @findex abbrev-mode
 @cindex Abbrev mode
-@ccmode{} uses Abbrev mode (@pxref{Abbrevs,,, @emacsman{}, @emacsmantitle{}})
+@ccmode{} uses Abbrev mode (@pxref{Abbrevs,,,@emacsman{}, @emacsmantitle{}})
 to accomplish this. It's therefore turned on by default in all language
 modes except IDL mode, since CORBA IDL doesn't have any statements.
 @end deffn
@@ -2295,14 +2295,14 @@ to create them.
 A @dfn{file local variable setting} is a setting which applies to an
 individual source file.  You put this in a @dfn{local variables list},
 a special block at the end of the source file (@pxref{Specifying File
-Variables,,, @emacsman{}}).
+Variables,,,@emacsman{}}).
 
 @item File Styles
 A @dfn{file style} is a rarely used variant of the ``style'' mechanism
 described above, which applies to an individual source file.
 @xref{File Styles}.  You use this by setting certain special variables
-in a local variables list (@pxref{Specifying File Variables,,,
-@emacsman{}}).
+in a local variables list (@pxref{Specifying File
+Variables,,,@emacsman{}}).
 
 @item Hooks with Styles
 For ultimate flexibility, you can use hooks and styles together.  For
@@ -2897,7 +2897,7 @@ these offsets or the parent style name.
 
 The Emacs manual describes how you can customize certain variables on a
 per-file basis by including a @dfn{file local variable} block at the end
-of the file (@pxref{File Variables,, Local Variables in Files, @emacsman{},
+of the file (@pxref{File Variables,, Local Variables in Files,@emacsman{},
 @emacsmantitle{}}).
 
 So far, you've only seen a functional interface for setting styles in
@@ -3139,8 +3139,9 @@ results in the current implementation.
 @end defopt
 
 @vindex comment-multi-line
-If inside a comment and @code{comment-multi-line} (@pxref{Auto Fill,,,
-@emacsman{}, @emacsmantitle{}} is non-@code{nil}, the indentation and
+If inside a comment and @code{comment-multi-line} (@pxref{Auto
+Fill,,,@emacsman{}, @emacsmantitle{}} is non-@code{nil}, the
+indentation and
 line prefix are preserved.  If inside a comment and
 @code{comment-multi-line} is @code{nil}, a new comment of the same
 type is started on the next line and indented as appropriate for
@@ -6771,7 +6772,7 @@ The stuff that didn't fit in anywhere else is documented here.
 Controls whether a final newline is enforced when the file is saved.
 The value is an association list that for each language mode specifies
 the value to give to @code{require-final-newline} (@pxref{Saving
-Buffers,,, @lispref{}, @lispreftitle{}}) at mode initialization.  If a
+Buffers,,,@lispref{}, @lispreftitle{}}) at mode initialization.  If a
 language isn't present on the association list, CC Mode won't touch
 @code{require-final-newline} in buffers for that language.
 
index 3d5485b..d91fc5d 100644 (file)
@@ -2,9 +2,25 @@
 
        * textmodes/rst.el (rst-re-alist): Fix loading (bug#11462).
 
+2012-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/rlogin.el (rlogin-mode-map): Fix last change.
+
+2012-05-14  Jason L. Wright  <jason.wright@inl.gov>  (tiny change)
+
+       * mail/smtpmail.el (smtpmail-send-command): Send the command and
+       the following \r\n using a single `process-send-string', since the
+       Lotus SMTP server refuses to accept any commands if they are sent
+       with two `process-send-string's (Bug#11444).
+
+2012-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * shell.el (shell-parse-pcomplete-arguments): Obey
+       pcomplete-arg-quote-list inside double-quoted args (Bug#11348).
+
 2012-05-14  Wolfgang Jenkner  <wjenkner@inode.at>
 
-       * image-mode.el: Fit to width/height for rotated images (bug#11431).
+       * image-mode.el: Fit to width/height for rotated images (Bug#11431).
        (image-transform-scale, image-transform-right-angle-fudge): New vars.
        (image-transform-width, image-transform-fit-width): New functions.
        (image-transform-properties): Use them.
index 134938a..9585c24 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-14  Mike Kazantsev  <mk.fraggod@gmail.com>  (tiny change)
+
+       * erc-dcc.el (erc-dcc-handle-ctcp-send): Fix a regression
+       introduced on 2011-11-28 when fixing quoted filenames matching,
+       the regex group was not corrected.
+
 2012-05-13  Teemu Likonen  <tlikonen@iki.fi>
 
        * erc-backend.el (erc-server-timestamp-format): New variable to
index ba87cf6..d1ef1a9 100644 (file)
@@ -674,7 +674,7 @@ It extracts the information about the dcc request and adds it to
        ?r "SEND" ?n nick ?u login ?h host))
      ((string-match erc-dcc-ctcp-query-send-regexp query)
       (let ((filename
-             (or (match-string 3 query)
+             (or (match-string 5 query)
                  (erc-dcc-unquote-filename (match-string 2 query))))
             (ip       (erc-decimal-to-ip (match-string 6 query)))
             (port     (match-string 7 query))
index 8e96e2c..804fe7a 100644 (file)
@@ -932,8 +932,7 @@ Returns an error if the server cannot be contacted."
       (insert (match-string 0 command) "<omitted>\r\n")
     (insert command "\r\n"))
   (setq smtpmail-read-point (point))
-  (process-send-string process command)
-  (process-send-string process "\r\n"))
+  (process-send-string process (concat command "\r\n")))
 
 (defun smtpmail-send-data-1 (process data)
   (goto-char (point-max))
index ac936ee..cef615d 100644 (file)
@@ -114,12 +114,12 @@ this variable is set from that."
   (let ((map (if (consp shell-mode-map)
                  (cons 'keymap shell-mode-map)
                (copy-keymap shell-mode-map))))
-    (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C)
-    (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D)
-    (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z)
-    (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash)
-    (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)
-    (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete)
+    (define-key map "\C-c\C-c" 'rlogin-send-Ctrl-C)
+    (define-key map "\C-c\C-d" 'rlogin-send-Ctrl-D)
+    (define-key map "\C-c\C-z" 'rlogin-send-Ctrl-Z)
+    (define-key map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash)
+    (define-key map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)
+    (define-key map "\C-i" 'rlogin-tab-or-complete)
     map)
   "Keymap for `rlogin-mode'.")
 
index f7a5301..1784188 100644 (file)
@@ -400,8 +400,9 @@ Thus, this does not include the shell's current directory.")
                      (t (match-string 3)))
                     arg))
              ((match-beginning 2)       ;Double quote.
-              (push (replace-regexp-in-string
-                     "\\\\\\(.\\)" "\\1" (match-string 2))
+              (push (if (null pcomplete-arg-quote-list) (match-string 2)
+                      (replace-regexp-in-string
+                       "\\\\\\(.\\)" "\\1" (match-string 2)))
                     arg))
              ((match-beginning 1)       ;Single quote.
               (push (match-string 1) arg))
index c41df0e..87f2cfe 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * url-expand.el (url-default-expander): Copy over the fullness of
+       the new URL object based on the definition URL object.
+
 2012-05-10  Chong Yidong  <cyd@gnu.org>
 
        * url-parse.el (url-path-and-query, url-port-if-non-default): New
index 156b06c..e5c7959 100644 (file)
@@ -116,13 +116,17 @@ path components followed by `..' are removed, along with the `..' itself."
     (setf (url-port urlobj) (or (url-port urlobj)
                                 (and (string= (url-type urlobj)
                                               (url-type defobj))
-                                     (url-port defobj))))
+                                    (url-port defobj))))
     (if (not (string= "file" (url-type urlobj)))
        (setf (url-host urlobj) (or (url-host urlobj) (url-host defobj))))
     (if (string= "ftp"  (url-type urlobj))
        (setf (url-user urlobj) (or (url-user urlobj) (url-user defobj))))
     (if (string= (url-filename urlobj) "")
        (setf (url-filename urlobj) "/"))
+    ;; If the object we're expanding from is full, then we are now
+    ;; full.
+    (unless (url-fullness urlobj)
+      (setf (url-fullness urlobj) (url-fullness defobj)))
     (if (string-match "^/" (url-filename urlobj))
        nil
       (let ((query nil)
index c5083cd..2d20f13 100644 (file)
@@ -1,3 +1,58 @@
+2012-05-14  Glenn Morris  <rgm@gnu.org>
+
+       * nsterm.m (ns_init_paths): Fix typo ("libexec" not "lib-exec").
+       Put "libexec" before "bin", for the sake of init_callproc_1.
+
+2012-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * keyboard.c (kbd_buffer_get_event) [!HAVE_DBUS]: Omit unused local.
+
+       * unexaix.c: Port to more-recent AIX compilers.
+       (report_error, report_error_1, make_hdr, copy_sym)
+       (mark_x, adjust_lnnoptrs, unrelocate_symbols):
+       Make arguments const char *, not char *, to avoid violations of C
+       standard and to fix some AIX warnings reported by Gilles Pion.
+
+2012-05-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (handle_stop): Don't call get_overlay_strings_1 if we
+       already have overlays loaded.
+       (handle_single_display_spec): Before returning without displaying
+       fringe bitmap, synchronize the bidi iterator with the main display
+       iterator, by calling iterate_out_of_display_property.
+       (iterate_out_of_display_property): Detect buffer iteration by
+       testing that it->string is a Lisp string.
+       (get_next_display_element): When the current object is exhausted,
+       and there's something on it->stack, call set_iterator_to_next to
+       proceed with what's on the stack, instead of returning zero.
+       (set_iterator_to_next): If called at the end of a Lisp string,
+       proceed to consider_string_end without incrementing string
+       position.  Don't increment display vector index past the end of
+       the display vector.  (Bug#11417)
+       (pos_visible_p): Don't report a position visible when move_it_to
+       stopped at the last line of window, which happens to be scanned
+       backwards by the bidi iteration.  (Bug#11464)
+
+2012-05-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (handle_single_display_spec): Return 1 for left-margin
+       and right-margin display specs even if the spec is invalid or we
+       are on a TTY, and thus unable to display on the fringes.  That's
+       because the text with the property will not be displayed anyway,
+       so we need to signal to the caller that this is a "replacing"
+       display spec.  This fixes display when the spec is invalid or we
+       are on a TTY.
+
+2012-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * unexaix.c (make_hdr): Fix typo in prototype.
+       This bug broke the build on AIX.  Problem reported by Gilles Pion.
+
+2012-05-14  Michael Albinus  <michael.albinus@gmx.de>
+
+       * keyboard.c (kbd_buffer_get_event): Read special events also in
+       batch mode.  (Bug#11415)
+
 2012-05-12  Glenn Morris  <rgm@gnu.org>
 
        * ns.mk: Update for ns_appbindir no longer having trailing "/".
index fcd5c0e..56858ac 100644 (file)
@@ -3786,7 +3786,6 @@ kbd_buffer_get_event (KBOARD **kbp,
                       int *used_mouse_menu,
                       struct timeval *end_time)
 {
-  register int c;
   Lisp_Object obj;
 
 #ifdef subprocesses
@@ -3803,16 +3802,18 @@ kbd_buffer_get_event (KBOARD **kbp,
     }
 #endif /* subprocesses */
 
+#ifndef HAVE_DBUS  /* We want to read D-Bus events in batch mode.  */
   if (noninteractive
       /* In case we are running as a daemon, only do this before
         detaching from the terminal.  */
       || (IS_DAEMON && daemon_pipe[1] >= 0))
     {
-      c = getchar ();
+      int c = getchar ();
       XSETINT (obj, c);
       *kbp = current_kboard;
       return obj;
     }
+#endif /* ! HAVE_DBUS  */
 
   /* Wait until there is input available.  */
   for (;;)
index 7cbaf99..4b8b2bb 100644 (file)
@@ -338,11 +338,18 @@ ns_init_paths (void)
 /*NSLog (@"loadPath: '%@'\n", resourcePaths); */
     }
 
+  /* Normally, Emacs does not add its own bin/ directory to the PATH.
+     However, a self-contained NS build has a different layout, with
+     bin/ and libexec/ subdirectories in the directory that contains
+     Emacs.app itself.
+     We put libexec first, because init_callproc_1 uses the first
+     element to initialize exec-directory.  An alternative would be
+     for init_callproc to check for invocation-directory/libexec.  */
   if (!getenv ("EMACSPATH"))
     {
       NSArray *paths = [binDir stringsByAppendingPaths:
-                                  [NSArray arrayWithObjects: @"bin",
-                                                             @"lib-exec", nil]];
+                                  [NSArray arrayWithObjects: @"libexec",
+                                                             @"bin", nil]];
       NSEnumerator *pathEnum = [paths objectEnumerator];
       resourcePaths = @"";
       while (resourcePath = [pathEnum nextObject])
index 1bf65b6..29fa0fd 100644 (file)
@@ -78,13 +78,13 @@ static long data_scnptr;
 static long load_scnptr;
 static long orig_load_scnptr;
 static long orig_data_scnptr;
-static int unrelocate_symbols (int, int, char *, char *);
+static int unrelocate_symbols (int, int, const char *, const char *);
 
 #ifndef MAX_SECTIONS
 #define MAX_SECTIONS   10
 #endif
 
-static int adjust_lnnoptrs (int, int, char *);
+static int adjust_lnnoptrs (int, int, const char *);
 
 static int pagemask;
 
@@ -92,7 +92,7 @@ static int pagemask;
 #include "lisp.h"
 
 static void
-report_error (char *file, int fd)
+report_error (const char *file, int fd)
 {
   if (fd)
     close (fd);
@@ -104,16 +104,16 @@ report_error (char *file, int fd)
 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
 
 static void
-report_error_1 (int fd, char *msg, int a1, int a2)
+report_error_1 (int fd, const char *msg, int a1, int a2)
 {
   close (fd);
   error (msg, a1, a2);
 }
 
-static int make_hdr (int, int, unsigned, unsigned, unsigned, char *, char *);
-static void mark_x (char *);
+static int make_hdr (int, int, const char *, const char *);
+static void mark_x (const char *);
 static int copy_text_and_data (int);
-static int copy_sym (int, int, char *, char *);
+static int copy_sym (int, int, const char *, const char *);
 static void write_segment (int, char *, char *);
 \f
 /* ****************************************************************
@@ -159,7 +159,7 @@ unexec (const char *new_name, const char *a_name)
  */
 static int
 make_hdr (int new, int a_out,
-         char *a_name, char *new_name)
+         const char *a_name, const char *new_name)
 {
   int scns;
   unsigned int bss_start;
@@ -429,7 +429,7 @@ write_segment (int new, char *ptr, char *end)
  * Copy the relocation information and symbol table from the a.out to the new
  */
 static int
-copy_sym (int new, int a_out, char *a_name, char *new_name)
+copy_sym (int new, int a_out, const char *a_name, const char *new_name)
 {
   char page[UnexBlockSz];
   int n;
@@ -465,7 +465,7 @@ copy_sym (int new, int a_out, char *a_name, char *new_name)
  * After successfully building the new a.out, mark it executable
  */
 static void
-mark_x (char *name)
+mark_x (const char *name)
 {
   struct stat sbuf;
   int um;
@@ -483,7 +483,7 @@ mark_x (char *name)
 }
 \f
 static int
-adjust_lnnoptrs (int writedesc, int readdesc, char *new_name)
+adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
 {
   int nsyms;
   int naux;
@@ -530,7 +530,8 @@ adjust_lnnoptrs (int writedesc, int readdesc, char *new_name)
 }
 
 static int
-unrelocate_symbols (int new, int a_out, char *a_name, char *new_name)
+unrelocate_symbols (int new, int a_out,
+                   const char *a_name, const char *new_name)
 {
   int i;
   LDHDR ldhdr;
index 36ca699..e7ecd2c 100644 (file)
@@ -849,6 +849,7 @@ static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
 static int trailing_whitespace_p (EMACS_INT);
 static intmax_t message_log_check_duplicate (EMACS_INT, EMACS_INT);
 static void push_it (struct it *, struct text_pos *);
+static void iterate_out_of_display_property (struct it *);
 static void pop_it (struct it *);
 static void sync_frame_with_window_matrix_rows (struct window *);
 static void select_frame_for_redisplay (Lisp_Object);
@@ -1313,8 +1314,8 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
         glyph.  */
       int top_x = it.current_x;
       int top_y = it.current_y;
-      enum it_method it_method = it.method;
       /* Calling line_bottom_y may change it.method, it.position, etc.  */
+      enum it_method it_method = it.method;
       int bottom_y = (last_height = 0, line_bottom_y (&it));
       int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
 
@@ -1322,6 +1323,31 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
        visible_p = bottom_y > window_top_y;
       else if (top_y < it.last_visible_y)
        visible_p = 1;
+      if (bottom_y >= it.last_visible_y
+         && it.bidi_p && it.bidi_it.scan_dir == -1
+         && IT_CHARPOS (it) < charpos)
+       {
+         /* When the last line of the window is scanned backwards
+            under bidi iteration, we could be duped into thinking
+            that we have passed CHARPOS, when in fact move_it_to
+            simply stopped short of CHARPOS because it reached
+            last_visible_y.  To see if that's what happened, we call
+            move_it_to again with a slightly larger vertical limit,
+            and see if it actually moved vertically; if it did, we
+            didn't really reach CHARPOS, which is beyond window end.  */
+         struct it save_it = it;
+         /* Why 10? because we don't know how many canonical lines
+            will the height of the next line(s) be.  So we guess.  */
+         int ten_more_lines =
+           10 * FRAME_LINE_HEIGHT (XFRAME (WINDOW_FRAME (w)));
+
+         move_it_to (&it, charpos, -1, bottom_y + ten_more_lines, -1,
+                     MOVE_TO_POS | MOVE_TO_Y);
+         if (it.current_y > top_y)
+           visible_p = 0;
+
+         it = save_it;
+       }
       if (visible_p)
        {
          if (it_method == GET_FROM_DISPLAY_VECTOR)
@@ -3135,7 +3161,15 @@ handle_stop (struct it *it)
                 overlays even if the actual buffer text is replaced.  */
              if (!handle_overlay_change_p
                  || it->sp > 1
-                 || !get_overlay_strings_1 (it, 0, 0))
+                 /* Don't call get_overlay_strings_1 if we already
+                    have overlay strings loaded, because doing so
+                    will load them again and push the iterator state
+                    onto the stack one more time, which is not
+                    expected by the rest of the code that processes
+                    overlay strings.  */
+                 || (it->n_overlay_strings <= 0
+                     ? !get_overlay_strings_1 (it, 0, 0)
+                     : 0))
                {
                  if (it->ellipsis_p)
                    setup_for_ellipsis (it, 0);
@@ -4691,10 +4725,22 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
          if (!FRAME_WINDOW_P (it->f))
            /* If we return here, POSITION has been advanced
               across the text with this property.  */
-           return 0;
+           {
+             /* Synchronize the bidi iterator with POSITION.  This is
+                needed because we are not going to push the iterator
+                on behalf of this display property, so there will be
+                no pop_it call to do this synchronization for us.  */
+             if (it->bidi_p)
+               {
+                 it->position = *position;
+                 iterate_out_of_display_property (it);
+                 *position = it->position;
+               }
+             return 1;
+           }
        }
       else if (!frame_window_p)
-       return 0;
+       return 1;
 
 #ifdef HAVE_WINDOW_SYSTEM
       value = XCAR (XCDR (spec));
@@ -4702,7 +4748,15 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
          || !(fringe_bitmap = lookup_fringe_bitmap (value)))
        /* If we return here, POSITION has been advanced
           across the text with this property.  */
-       return 0;
+       {
+         if (it && it->bidi_p)
+           {
+             it->position = *position;
+             iterate_out_of_display_property (it);
+             *position = it->position;
+           }
+         return 1;
+       }
 
       if (it)
        {
@@ -5621,7 +5675,7 @@ push_it (struct it *it, struct text_pos *position)
 static void
 iterate_out_of_display_property (struct it *it)
 {
-  int buffer_p = BUFFERP (it->object);
+  int buffer_p = !STRINGP (it->string);
   EMACS_INT eob = (buffer_p ? ZV : it->end_charpos);
   EMACS_INT bob = (buffer_p ? BEGV : 0);
 
@@ -6790,6 +6844,16 @@ get_next_display_element (struct it *it)
               && FACE_FROM_ID (it->f, face_id)->box == FACE_NO_BOX);
        }
     }
+  /* If we reached the end of the object we've been iterating (e.g., a
+     display string or an overlay string), and there's something on
+     IT->stack, proceed with what's on the stack.  It doesn't make
+     sense to return zero if there's unprocessed stuff on the stack,
+     because otherwise that stuff will never be displayed.  */
+  if (!success_p && it->sp > 0)
+    {
+      set_iterator_to_next (it, 0);
+      success_p = get_next_display_element (it);
+    }
 
   /* Value is 0 if end of buffer or string reached.  */
   return success_p;
@@ -6971,7 +7035,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
          display vector entry (these entries may contain faces).  */
       it->face_id = it->saved_face_id;
 
-      if (it->dpvec + it->current.dpvec_index == it->dpend)
+      if (it->dpvec + it->current.dpvec_index >= it->dpend)
        {
          int recheck_faces = it->ellipsis_p;
 
@@ -7009,6 +7073,26 @@ set_iterator_to_next (struct it *it, int reseat_p)
     case GET_FROM_STRING:
       /* Current display element is a character from a Lisp string.  */
       xassert (it->s == NULL && STRINGP (it->string));
+      /* Don't advance past string end.  These conditions are true
+        when set_iterator_to_next is called at the end of
+        get_next_display_element, in which case the Lisp string is
+        already exhausted, and all we want is pop the iterator
+        stack.  */
+      if (it->current.overlay_string_index >= 0)
+       {
+         /* This is an overlay string, so there's no padding with
+            spaces, and the number of characters in the string is
+            where the string ends.  */
+         if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string))
+           goto consider_string_end;
+       }
+      else
+       {
+         /* Not an overlay string.  There could be padding, so test
+            against it->end_charpos . */
+         if (IT_STRING_CHARPOS (*it) >= it->end_charpos)
+           goto consider_string_end;
+       }
       if (it->cmp_it.id >= 0)
        {
          int i;