From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [ghill@synergymicro.com: Re: Re: bug in field-string and field-string-no-properties] Date: Wed, 27 Aug 2003 18:12:37 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1062024138 17847 80.91.224.253 (27 Aug 2003 22:42:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Aug 2003 22:42:18 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Aug 28 00:42:16 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 19s8zY-0008RQ-00 for ; Thu, 28 Aug 2003 00:42:16 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19s96B-0005qN-00 for ; Thu, 28 Aug 2003 00:49:07 +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 19s8u6-0004LE-HN for emacs-devel@quimby.gnus.org; Wed, 27 Aug 2003 18:36:38 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19s8dA-00058W-Je for emacs-devel@gnu.org; Wed, 27 Aug 2003 18:19:08 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19s8d2-00050E-SC for emacs-devel@gnu.org; Wed, 27 Aug 2003 18:19:03 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19s8aQ-0003m6-CQ for emacs-devel@gnu.org; Wed, 27 Aug 2003 18:16:18 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.20) id 19s8Wr-0005Tz-SV; Wed, 27 Aug 2003 18:12:37 -0400 Original-To: monnier@cs.yale.edu, miles@gnu.org 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:16168 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16168 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.) ------- 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 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 _______________________________________________ Bug-gnu-emacs mailing list Bug-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs ------- End of forwarded message -------