unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug in field-string and field-string-no-properties
@ 2003-08-14 21:00 Greg Hill
  2003-08-14 21:21 ` John Paul Wallington
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Hill @ 2003-08-14 21:00 UTC (permalink / raw)


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


platform:  GNU Emacs 21.2.2 (sparc-sun-solaris2.7, X toolkit)

--Greg

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bug in field-string and field-string-no-properties
  2003-08-14 21:00 bug in field-string and field-string-no-properties Greg Hill
@ 2003-08-14 21:21 ` John Paul Wallington
  0 siblings, 0 replies; 2+ messages in thread
From: John Paul Wallington @ 2003-08-14 21:21 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."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-14 21:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-14 21:00 bug in field-string and field-string-no-properties Greg Hill
2003-08-14 21:21 ` John Paul Wallington

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