emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: part of display property on before-string property i


From: YAMAMOTO Mitsuharu
Subject: Re: address@hidden: part of display property on before-string property is not displayed]
Date: Mon, 15 Oct 2007 17:32:48 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Fri, 12 Oct 2007 15:59:57 -0400, Chong Yidong <address@hidden> said:

> I think your reasoning is correct, but instead of

>     if (!STRINGP (it->stack[it->sp - 1].string))

> could you do

>     if (BUFFERP (object))

> instead?

Thanks for the comment.  This is more concise.

>>>>> On Thu, 11 Oct 2007 16:29:41 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

> I guess the reason to pretend as if the `display' property were not
> processed yet at line 4240 is to process overlay strings at the
> start position of the `display' property later.

On second thought, this is not strictly correct.  If there're multiple
display specs, `position' is reused among them.

  3838        for (; CONSP (prop); prop = XCDR (prop))
  3839          {
  3840            if (handle_single_display_spec (it, XCAR (prop), object,
  3841                                            position, display_replaced_p))
  3842              display_replaced_p = 1;

The patch below breaks the loop for multiple display specs if a
replacing spec is found in a display property of a string.  This might
be a bit ad hoc, but I think drastic changes should be avoided for
Emacs 22.

                                     YAMAMOTO Mitsuharu
                                address@hidden

Index: src/xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1149.2.11
diff -c -p -r1.1149.2.11 xdisp.c
*** src/xdisp.c 9 Oct 2007 01:28:33 -0000       1.1149.2.11
--- src/xdisp.c 15 Oct 2007 08:10:21 -0000
*************** handle_display_prop (it)
*** 3839,3845 ****
        {
          if (handle_single_display_spec (it, XCAR (prop), object,
                                          position, display_replaced_p))
!           display_replaced_p = 1;
        }
      }
    else if (VECTORP (prop))
--- 3839,3851 ----
        {
          if (handle_single_display_spec (it, XCAR (prop), object,
                                          position, display_replaced_p))
!           {
!             display_replaced_p = 1;
!             /* If some text in a string is replaced, `position' no
!                longer points to the position of `object'.  */
!             if (STRINGP (object))
!               break;
!           }
        }
      }
    else if (VECTORP (prop))
*************** handle_display_prop (it)
*** 3848,3854 ****
        for (i = 0; i < ASIZE (prop); ++i)
        if (handle_single_display_spec (it, AREF (prop, i), object,
                                        position, display_replaced_p))
!         display_replaced_p = 1;
      }
    else
      {
--- 3854,3866 ----
        for (i = 0; i < ASIZE (prop); ++i)
        if (handle_single_display_spec (it, AREF (prop, i), object,
                                        position, display_replaced_p))
!         {
!           display_replaced_p = 1;
!           /* If some text in a string is replaced, `position' no
!              longer points to the position of `object'.  */
!           if (STRINGP (object))
!             break;
!         }
      }
    else
      {
*************** handle_single_display_spec (it, spec, ob
*** 4237,4249 ****
          /* Say that we haven't consumed the characters with
             `display' property yet.  The call to pop_it in
             set_iterator_to_next will clean this up.  */
!         *position = start_pos;
        }
        else if (CONSP (value) && EQ (XCAR (value), Qspace))
        {
          it->method = GET_FROM_STRETCH;
          it->object = value;
!         *position = it->position = start_pos;
        }
  #ifdef HAVE_WINDOW_SYSTEM
        else
--- 4249,4264 ----
          /* Say that we haven't consumed the characters with
             `display' property yet.  The call to pop_it in
             set_iterator_to_next will clean this up.  */
!         if (BUFFERP (object))
!           it->current.pos = start_pos;
        }
        else if (CONSP (value) && EQ (XCAR (value), Qspace))
        {
          it->method = GET_FROM_STRETCH;
          it->object = value;
!         it->position = start_pos;
!         if (BUFFERP (object))
!           it->current.pos = start_pos;
        }
  #ifdef HAVE_WINDOW_SYSTEM
        else
*************** handle_single_display_spec (it, spec, ob
*** 4257,4263 ****
          /* Say that we haven't consumed the characters with
             `display' property yet.  The call to pop_it in
             set_iterator_to_next will clean this up.  */
!         *position = start_pos;
        }
  #endif /* HAVE_WINDOW_SYSTEM */
  
--- 4272,4279 ----
          /* Say that we haven't consumed the characters with
             `display' property yet.  The call to pop_it in
             set_iterator_to_next will clean this up.  */
!         if (BUFFERP (object))
!           it->current.pos = start_pos;
        }
  #endif /* HAVE_WINDOW_SYSTEM */
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]