From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: text_property_stickiness Date: Sun, 25 Jun 2006 16:59:12 -0400 Message-ID: <87ac81eyu7.fsf@stupidchicken.com> References: <87r71ee1uq.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1151269185 26348 80.91.229.2 (25 Jun 2006 20:59:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Jun 2006 20:59:45 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 25 22:59:39 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fubhd-0005b2-Ny for ged-emacs-devel@m.gmane.org; Sun, 25 Jun 2006 22:59:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fubhd-0000jC-AQ for ged-emacs-devel@m.gmane.org; Sun, 25 Jun 2006 16:59:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FubhR-0000j5-0m for emacs-devel@gnu.org; Sun, 25 Jun 2006 16:59:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FubhP-0000ik-MK for emacs-devel@gnu.org; Sun, 25 Jun 2006 16:59:19 -0400 Original-Received: from [18.72.1.2] (helo=south-station-annex.mit.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fubt8-0000wt-LN; Sun, 25 Jun 2006 17:11:26 -0400 Original-Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id k5PKxIeo003157; Sun, 25 Jun 2006 16:59:18 -0400 (EDT) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by grand-central-station.mit.edu (8.13.6/8.9.2) with ESMTP id k5PKxFBc011824; Sun, 25 Jun 2006 16:59:18 -0400 (EDT) Original-Received: from cyd (SYDNEYPACIFIC-FOUR-NINETY-NINE.MIT.EDU [18.95.6.244]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id k5PKxDxH023295; Sun, 25 Jun 2006 16:59:13 -0400 (EDT) Original-Received: from cyd by cyd with local (Exim 3.36 #1 (Debian)) id 1FubhI-00018A-00; Sun, 25 Jun 2006 16:59:12 -0400 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sun, 25 Jun 2006 11:33:48 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Spam-Score: 1.47 X-Scanned-By: MIMEDefang 2.42 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:56177 Archived-At: Richard Stallman writes: > This problem really is tricky, for the reasons I explained. > It could be that we need to make sure find_field is never called > for positions outside BEGV..ZV. That may require changes in callers > at higher level, and changes in the specs of the field functions. I see. I've checked the higher-level functions, and here are the results: text_property_stickiness is called by: * get_pos_property, which is called by: ** find_field, which is called by: Fdelete_field Ffield_string Ffield_string_no_properties Ffield_beginning Ffield_end ** Fconstrain_to_field, which is called by: Fline_beginning_position Fline_end_position ** get_local_map, for only valid positions. ** adjust_point_for_property, for only valid positions. * adjust_for_invis_intang, which is called by: ** set_point_both, for only valid values of pos. So the only thing we have to worry about are a bunch of lisp-visible functions, Fdelete_field and so forth. I think it is acceptable for us to handle this situation by the signalling of an args_out_of_range error, which, as you pointed out, already happens with the call to Fget_text_property in text_property_stickiness. So maybe all that we need to do is to add a comment to the code. (Or should we initialize prev_pos to stop the checker from complaining?) *** emacs/src/textprop.c.~1.147.~ 2006-05-22 20:28:23.000000000 -0400 --- emacs/src/textprop.c 2006-06-25 16:50:17.000000000 -0400 *************** *** 1789,1794 **** --- 1789,1796 ---- } /* Consider following character. */ + /* If pos is outside the accessible range of the buffer, this + signals an args_out_of_range error. */ front_sticky = Fget_text_property (pos, Qfront_sticky, buffer); if (EQ (front_sticky, Qt)