unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: [jbw@macs.hw.ac.uk: part of display property on before-string property is not displayed]
Date: Mon, 15 Oct 2007 17:32:48 +0900	[thread overview]
Message-ID: <wlejfwhj67.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <87sl4gm7cy.fsf@stupidchicken.com> <wllkaakt22.wl%mituharu@math.s.chiba-u.ac.jp>

>>>>> On Fri, 12 Oct 2007 15:59:57 -0400, Chong Yidong <cyd@stupidchicken.com> 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 <mituharu@math.s.chiba-u.ac.jp> 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
				mituharu@math.s.chiba-u.ac.jp

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	other threads:[~2007-10-15  8:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04  2:02 [jbw@macs.hw.ac.uk: part of display property on before-string property is not displayed] Richard Stallman
2007-10-11  7:29 ` YAMAMOTO Mitsuharu
2007-10-12 19:59   ` Chong Yidong
2007-10-15  8:32     ` YAMAMOTO Mitsuharu [this message]
2007-10-15 12:50       ` Chong Yidong
2007-10-16  4:11         ` Richard Stallman
2007-10-16  9:09           ` YAMAMOTO Mitsuharu
2007-10-17  5:03             ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-09-26 21:57 Richard Stallman
2007-09-19 15:48 Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wlejfwhj67.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).