From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Cursor positioning with `after-string' overlays Date: Thu, 01 Apr 2010 18:06:26 -0400 Message-ID: References: <83bpe3xqjj.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1270159932 26432 80.91.229.12 (1 Apr 2010 22:12:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Apr 2010 22:12:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 02 00:12:08 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NxSYL-0001Q4-1q for ged-emacs-devel@m.gmane.org; Fri, 02 Apr 2010 00:12:07 +0200 Original-Received: from localhost ([127.0.0.1]:44380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxSYB-0007rO-L2 for ged-emacs-devel@m.gmane.org; Thu, 01 Apr 2010 18:07:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxSXh-0007h4-CS for emacs-devel@gnu.org; Thu, 01 Apr 2010 18:07:13 -0400 Original-Received: from [140.186.70.92] (port=54084 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxSXd-0007eC-KN for emacs-devel@gnu.org; Thu, 01 Apr 2010 18:07:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxSXV-0005AD-Su for emacs-devel@gnu.org; Thu, 01 Apr 2010 18:07:02 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:10227 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxSWx-00057K-4R; Thu, 01 Apr 2010 18:06:27 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAKe1tEtFpZE8/2dsb2JhbACbSXK2O4UBBIsm X-IronPort-AV: E=Sophos;i="4.51,350,1267419600"; d="scan'208";a="60098077" Original-Received: from 69-165-145-60.dsl.teksavvy.com (HELO pastel.home) ([69.165.145.60]) by ironport2-out.pppoe.ca with ESMTP; 01 Apr 2010 18:06:26 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 1FD8785F0; Thu, 1 Apr 2010 18:06:26 -0400 (EDT) In-Reply-To: <83bpe3xqjj.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 01 Apr 2010 16:15:12 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:123039 Archived-At: > found. IOW, exact match wins over all other considerations. Since > C-f from the second `o' moves point to buffer position to which `b' > corresponds exactly, that is where the trunk version puts the cursor. But depending on the insertion-type of the end marker of your overlay, text inserted "at point" will be inserted (visually) between the o and the - rather than between the - and the b, so while this choice would sometimes be correct, it's sometimes incorrect. That's why we have the `cursor' property (although admittedly, for this particular use, the insertion-type of the marker should already provide the needed info). > More generally, what are the use-cases for putting the `cursor' > property on a `before-string' or `after-string' overlay, and what is > expected from cursor positioning in those use-cases? AFAIK, there are a few different use cases for the `cursor' property. One use case is when you simply want to control where the cursor is displayed on a piece of text that's not in the buffer (typically an after-string). In such a case, without any extra information, it would not be incorrect to place the cursor before the after-string, or after the after-string or anywhere in between. So the `cursor' property allows to specify the intended behavior (e.g. the after-string has the form "()" and you want the cursor to appear in between the two parens). The other use case is when the cursor positioning code gets it wrong because it works at too low a level (typically the after-string or similar thingy is on an overlay with carefully chosen stickiness which should make it clear whether the cursor should come before or after the string, but the cursor positioning code only gets to see a "flattened" representation of the text, so it can't know the stickiness property). Stefan