From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Re: Re: bug in field-string and field-string-no-properties Date: Thu, 28 Aug 2003 17:32:39 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200308282132.h7SLWeV1009685@rum.cs.yale.edu> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1062108923 13103 80.91.224.253 (28 Aug 2003 22:15:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Aug 2003 22:15:23 +0000 (UTC) Cc: auto-added , emacs-devel@gnu.org, monnier@cs.yale.edu, miles@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Aug 29 00:15:20 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19sV32-0002Bg-00 for ; Fri, 29 Aug 2003 00:15:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19sVA7-0000D9-00 for ; Fri, 29 Aug 2003 00:22:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19sUwu-0003Vx-S0 for emacs-devel@quimby.gnus.org; Thu, 28 Aug 2003 18:09:00 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19sUdn-0005wW-TU for emacs-devel@gnu.org; Thu, 28 Aug 2003 17:49:15 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19sUcR-0004xn-Bs for emacs-devel@gnu.org; Thu, 28 Aug 2003 17:47:55 -0400 Original-Received: from [128.36.229.169] (helo=rum.cs.yale.edu) by monty-python.gnu.org with esmtp (Exim 4.22) id 19sUWo-0002MG-N8; Thu, 28 Aug 2003 17:42:02 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h7SLWfKc009687; Thu, 28 Aug 2003 17:32:41 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h7SLWeV1009685; Thu, 28 Aug 2003 17:32:40 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Richard Stallman X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16180 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16180 > Would you please give me your thoughts on this issue? What he says > seems logical; at the same time, I'm concerned that changing the spec > of field-string could easily break something that depends on the > current behavior. > > (Everyone else is welcome to discuss it too, but I particularly > am looking for Stefan's and Miles' thoughts.) I remember replying, but I can't find the reply any more. Here is a short summary: I think the current behavior is correct and as for bugs, I don't know any right now (and since the code is used for the minibuffer, it's unlikely that we'll see bugs in situations similar to the minibuffer). > ------- Start of forwarded message ------- > In-Reply-To: <3F3BA301.4522.6E53D5@localhost> > Date: Thu, 14 Aug 2003 18:00:38 -0700 > To: John Paul Wallington > From: Greg Hill > Cc: bug-gnu-emacs@gnu.org > Subject: Re: Re: bug in field-string and field-string-no-properties > Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org > > > > 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 I don't see how the example shows that. > seems to me that for a four-character field there ought to be at > least four places at which field-string will return it. There are. At positions 2, 3, 4, and 5. For non-sticky, there'll only be 3 positions and for red and front sticky properties, there will be 5 positions where field-string will return the field. > 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). Stefan