* Re: Re: bug in field-string and field-string-no-properties
[not found] <3F3BA301.4522.6E53D5@localhost>
@ 2003-08-15 1:00 ` Greg Hill
0 siblings, 0 replies; only message in thread
From: Greg Hill @ 2003-08-15 1:00 UTC (permalink / raw)
Cc: bug-gnu-emacs
> > There appears to be a bug in field-string and
>> field-string-no-properties. When (point) or the POS argument is at
>> the first character of a field, the function returns an empty
>> string. The following fragment of code, executed in the scratch
>> buffer, illustrates the problem.
>>
> > (progn
>> (set-buffer (get-buffer-create "junk"))
>> (erase-buffer)
>> (insert "Test")
>> (put-text-property (point-min) (point-max) 'field 1)
>> (message "field-string at 1 = '%s'\nfield-string at 2 = '%s'"
>> (field-string-no-properties 1) (field-string-no-properties 2)))
>
>>From (elisp) Fields Info node:
>
>"When the characters before and after POS are part of the same field,
>there is no doubt which field contains POS: the one those characters
>both belong to. When POS is at a boundary between fields, which field
>it belongs to depends on the stickiness of the `field' properties of
>the two surrounding characters (see *note Sticky Properties::). The
>field whose property would be inherited by text inserted at POS is the
>field that contains POS."
If stickiness is the issue, then the default rear-stickiness of the
last character of a field should identify the field-string "to the
left of" a point; but as the example below shows, it does not. It
seems to me that for a four-character field there ought to be at
least four places at which field-string will return it.
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. That means, of course, that for a field that is one
character long, there is no way you can ever get field-string to
return anything but an empty string.
(progn
(set-buffer (get-buffer-create "junk"))
(erase-buffer)
(insert "Test")
(put-text-property (point-min) (point-max) 'field 1)
(message "field-string at 1 = '%s'\nfield-string at 2 =
'%s'\nfield-string at (point-max) = '%s'"
(field-string-no-properties 1)
(field-string-no-properties 2)
(field-string-no-properties (point-max)) ) )
--Greg
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-15 1:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <3F3BA301.4522.6E53D5@localhost>
2003-08-15 1:00 ` Re: bug in field-string and field-string-no-properties Greg Hill
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.