[Top][All Lists]

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

Re: Fwd: Re: Re: bug in field-string and field-string-no-properties

From: Greg Hill
Subject: Re: Fwd: Re: Re: bug in field-string and field-string-no-properties
Date: Thu, 28 Aug 2003 19:20:32 -0700

At 5:32 PM -0400 8/28/03, Stefan Monnier wrote:

 > 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).

  (set-buffer (get-buffer-create "junk"))
  (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)))


"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.


reply via email to

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