From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#8627: 24.0.50: cursor property behaves irregularly in before-strings Date: Fri, 06 May 2011 14:03:34 +0300 Message-ID: <831v0cm6pl.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1304679856 30737 80.91.229.12 (6 May 2011 11:04:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 May 2011 11:04:16 +0000 (UTC) Cc: 8627@debbugs.gnu.org To: Alp Aker Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 13:04:12 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QIIpQ-0004Mr-2H for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2011 13:04:12 +0200 Original-Received: from localhost ([::1]:37845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIIpP-0006RW-I7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2011 07:04:11 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIIpN-0006RP-4u for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 07:04:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QIIpH-00032V-W1 for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 07:04:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QIIpH-00032G-UX for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 07:04:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QIIpG-0007zD-P8; Fri, 06 May 2011 07:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 May 2011 11:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8627 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8627-submit@debbugs.gnu.org id=B8627.130467982330671 (code B ref 8627); Fri, 06 May 2011 11:04:02 +0000 Original-Received: (at 8627) by debbugs.gnu.org; 6 May 2011 11:03:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QIIow-0007ye-Nb for submit@debbugs.gnu.org; Fri, 06 May 2011 07:03:42 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QIIou-0007yR-AT for 8627@debbugs.gnu.org; Fri, 06 May 2011 07:03:41 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LKR00L00T7VYM00@a-mtaout22.012.net.il> for 8627@debbugs.gnu.org; Fri, 06 May 2011 14:03:34 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.234.175]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LKR00JV0TDWT5N0@a-mtaout22.012.net.il>; Fri, 06 May 2011 14:03:34 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 06 May 2011 07:04:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46265 Archived-At: > Date: Thu, 05 May 2011 20:01:00 -0400 (EDT) > From: Alp Aker > > The documentation for the cursor property (info node "(elisp) Special > Properties") states that: > > "Normally, the cursor is displayed at the end of any overlay and text > property strings present at the current buffer position. You can place > the cursor on any desired character of these strings by giving that > character a non-`nil' `cursor' text property." > > And then follows the description of using integer values for the cursor > property to make it applicable to a range of buffer positions other than > the range between the overlay's start and end. Note that, crucially, the before-string and after-string properties are not described in this section. They are described elsewhere, where the `cursor' property is not mentioned. So I wonder if the `cursor' property was really supposed to work with before-strings and after-strings... > However, when used with overlay before-strings (or after-strings), the > cursor property appears to behave in ways that aren't consonant with the > docs and that don't follow a consistent pattern. It looks like it was never supported consistently, ever since the `cursor' property was introduced (in Emacs 22.1). > (1) Insert some boilerplate text to interact with. > > (save-excursion > (goto-char (point-min)) > (insert "Lorem ipsum dolor sit amet.\n")) > > Make an overlay and give it a before-string with a non-nil cursor property > on one character: > > (setq olay (make-overlay 5 6) > str1 (concat "XX" > (propertize "Y" 'cursor t) > "ZZ")) > (overlay-put olay 'before-string str1) > > If one now does: > > (goto-char (overlay-start olay)) > > the cursor property is ignored; the cursor appears after the > before-string. This works as expected in Emacs 23, so it must be some problem with the bidi-aware redisplay in Emacs 24. I will take a look when I have time; thanks for a clear test case. > (3) But if the before-string contains a newline, the cursor property > appears to be ignored regardless of location and regardless of whether the > value of the cursor property is numeric or merely non-nil. This never worked, I tested it in Emacs 22.1, and it behaves like this as well. I will take a look at fixing this, bat can you show a real-life use case where this is needed? > I started to read through xdisp.c to make some sense of this, but I'm too > new to Emacs's internals to be able to follow much of the display routine. > I did observe, though, that cursor_row_p only checks display properties, > and doesn't appear to check before-strings and after-strings. It may come as a surprise, but the implementation of display properties is very different from that of before-string and after-string properties. It's a small wonder they don't behave similarly. > In any case, it would appear that either the treatment of before-strings > and after-strings should be changed so that the cursor property works with > them as it does with strings that come from display properties, or the > documentation should be amended to make clear that that it can't be > expected to do so. (In the latter case, it would still seem desirable > that cursor properties in before- and after-strings behave systematically, > which isn't currently the case.) It sounds like it works in most use cases, so fixing the implementation is probably a better alternative.