From mboxrd@z Thu Jan  1 00:00:00 1970
Path: main.gmane.org!not-for-mail
From: Greg Hill <ghill@synergymicro.com>
Newsgroups: gmane.emacs.bugs
Subject: Re: Re: bug in field-string and field-string-no-properties
Date: Thu, 14 Aug 2003 18:00:38 -0700
Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Message-ID: <p04310106bb61da269a13@[198.17.100.22]>
References: <3F3BA301.4522.6E53D5@localhost>
NNTP-Posting-Host: deer.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Trace: sea.gmane.org 1060909497 16493 80.91.224.253 (15 Aug 2003 01:04:57 GMT)
X-Complaints-To: usenet@sea.gmane.org
NNTP-Posting-Date: Fri, 15 Aug 2003 01:04:57 +0000 (UTC)
Cc: bug-gnu-emacs@gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 15 03:04:54 2003
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Original-Received: from monty-python.gnu.org ([199.232.76.173])
	by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian))
	id 19nT1S-0002nx-00
	for <geb-bug-gnu-emacs@m.gmane.org>; Fri, 15 Aug 2003 03:04:54 +0200
Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org)
	by monty-python.gnu.org with esmtp (Exim 4.20)
	id 19nT0I-0002Jx-D2
	for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Aug 2003 21:03:42 -0400
Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20)
	id 19nSzM-0001iK-VY
	for bug-gnu-emacs@gnu.org; Thu, 14 Aug 2003 21:02:44 -0400
Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20)
	id 19nSyp-0001Ug-37
	for bug-gnu-emacs@gnu.org; Thu, 14 Aug 2003 21:02:42 -0400
Original-Received: from [153.105.4.30] (helo=synergymicro.com)
	by monty-python.gnu.org with esmtp (Exim 4.20)
	id 19nSyI-0001De-Il; Thu, 14 Aug 2003 21:01:38 -0400
Original-Received: from synergy.synergy.encinitas.ca.us ([153.105.4.29])
	by synergymicro.com (8.9.3/8.9.3) with ESMTP id SAA10731;
	Thu, 14 Aug 2003 18:03:22 -0700
Original-Received: from [198.17.100.22] (G_Hill_Mac [198.17.100.22])
	by synergy.synergy.encinitas.ca.us (8.12.8/8.12.8) with ESMTP id
	h7F11Twr011623; Thu, 14 Aug 2003 18:01:30 -0700
In-Reply-To: <3F3BA301.4522.6E53D5@localhost>
Original-To: John Paul Wallington <jpw@gnu.org>
X-BeenThere: bug-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors
	<bug-gnu-emacs.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Xref: main.gmane.org gmane.emacs.bugs:5546
X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5546

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