unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Greg Hill <ghill@synergymicro.com>
Cc: emacs-devel@gnu.org, monnier@cs.yale.edu, miles@gnu.org
Subject: Re: Fwd: Re: Re: bug in field-string and field-string-no-properties
Date: Thu, 28 Aug 2003 19:20:32 -0700	[thread overview]
Message-ID: <p04310103bb744f47c66f@[198.17.100.22]> (raw)
In-Reply-To: <200308282132.h7SLWeV1009685@rum.cs.yale.edu>

At 5:32 PM -0400 8/28/03, Stefan Monnier wrote:
<snip>
>
>  > As it stands, field-string returns a string only if the character to
>  > the left AND the character to the right of POS both have the same
>  > field property.
>
>Can you show a precise test case that shows that ?
>It works correctly in my tests (and in actual use by `customize' it also
>seems to work).

(progn
   (set-buffer (get-buffer-create "junk"))
   (erase-buffer)
   (insert "xXyY")
   (put-text-property 1 3 'field 'X)
   (put-text-property 3 5 'field 'Y)
   (message (concat "At 1, field-property = %s, field-string = '%s'\n"
		   " At 2, field-property = %s, field-string = '%s'\n"
		   " At 3, field-property = %s, field-string = '%s'\n"
		   " At 4, field-property = %s, field-string = '%s'\n"
		   " At 5, field-property = %s, field-string = '%s'\n")
	   (get-text-property 1 'field) (field-string-no-properties 1)
	   (get-text-property 2 'field) (field-string-no-properties 2)
	   (get-text-property 3 'field) (field-string-no-properties 3)
	   (get-text-property 4 'field) (field-string-no-properties 4)
	   (get-text-property 5 'field) (field-string-no-properties 5)))

produces:

"At 1, field-property = X, field-string = ''
  At 2, field-property = X, field-string = 'xX'
  At 3, field-property = Y, field-string = ''
  At 4, field-property = Y, field-string = 'yY'
  At 5, field-property = nil, field-string = ''
"

The kind of function I would find useful wouldn't depend on 
stickiness at all.  For a given buffer position, the value of the 
field property returned by get-text-property would determine the 
string returned by field-string when it is passed the same buffer 
position.  Thus, in the example above, since the characters at 
positions 3 and 4 both have the same value, 'Y, for their field 
property, field-string would return the same string, "yY", for both 
of those positions.  If this were the case, the `buffer-pos' in the 
event caused by mouse-clicking on the "y" at position 3 in the 
example above would always return "yY" as the field-string, not an 
empty string, and certainly not "xX" just because the "X" happened to 
be rear-sticky.

--Greg

  reply	other threads:[~2003-08-29  2:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-27 22:12 [ghill@synergymicro.com: Re: Re: bug in field-string and field-string-no-properties] Richard Stallman
2003-08-28 21:32 ` Fwd: Re: Re: bug in field-string and field-string-no-properties Stefan Monnier
2003-08-29  2:20   ` Greg Hill [this message]
2003-08-29  2:36     ` Miles Bader
2003-08-29 18:53       ` Kevin Rodgers
2003-08-29 21:55       ` Greg Hill

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='p04310103bb744f47c66f@[198.17.100.22]' \
    --to=ghill@synergymicro.com \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=monnier@cs.yale.edu \
    /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).