From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alp Aker Newsgroups: gmane.emacs.bugs Subject: bug#8627: 24.0.50: cursor property behaves irregularly in before-strings Date: Thu, 05 May 2011 20:01:00 -0400 (EDT) Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Trace: dough.gmane.org 1304640134 3453 80.91.229.12 (6 May 2011 00:02:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 May 2011 00:02:14 +0000 (UTC) To: 8627@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 02:02:10 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 1QI8Uh-00081a-FJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2011 02:02:07 +0200 Original-Received: from localhost ([::1]:47472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI8Ug-0005PG-Pa for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 May 2011 20:02:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI8Ud-0005Ot-DU for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:02:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI8Uc-0000QX-EW for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:02:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI8Uc-0000QT-Cz for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QI8Uc-0001DP-2X; Thu, 05 May 2011 20:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alp Aker 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 00:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8627 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13046400774617 (code B ref -1); Fri, 06 May 2011 00:02:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 May 2011 00:01:17 +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 1QI8Ts-0001CQ-SQ for submit@debbugs.gnu.org; Thu, 05 May 2011 20:01:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QI8Tr-0001CB-8N for submit@debbugs.gnu.org; Thu, 05 May 2011 20:01:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI8Tl-0000OD-Co for submit@debbugs.gnu.org; Thu, 05 May 2011 20:01:10 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:38497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI8Tl-0000O9-BC for submit@debbugs.gnu.org; Thu, 05 May 2011 20:01:09 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI8Tk-0005OQ-AV for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:01:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI8Tj-0000Nw-6P for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:01:08 -0400 Original-Received: from exprod7og109.obsmtp.com ([64.18.2.171]:32997) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QI8Ti-0000Np-Ts for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:01:07 -0400 Original-Received: from mb1i1.ns.pitt.edu ([136.142.11.152]) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKTcM6PxCjivk6wDsYcRSTf25FQqD0fjFX@postini.com; Thu, 05 May 2011 17:01:06 PDT Original-Received: from unixs1.cis.pitt.edu ([136.142.4.246]) by pitt.edu (PMDF V6.3-x11 #31505) with ESMTP id <0LKQ00K49YPRJE@mb1i1.ns.pitt.edu> for bug-gnu-emacs@gnu.org; Thu, 05 May 2011 20:01:03 -0400 (EDT) X-X-Sender: aker@unixs1.cis.pitt.edu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 05 May 2011 20:02: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:46255 Archived-At: 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. 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. Here's a recipe for producing the variety of observed behaviors. (I use before-strings, but using after-strings gives similar results.) (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. However, if the before-string appears before a newline, the cursor property is respected: (save-excursion (goto-char (point-min)) (search-forward "\n") (move-overlay olay (1- (point)) (point))) (goto-char (overlay-start olay)) The cursor now appears at the propertized character in the before-string. (2) Now give the overlay a before-string one of whose characters has a numeric cursor property: (setq str2 (concat "XX" (propertize "Y" 'cursor 1) "ZZ")) (overlay-put olay 'before-string str2) In this case, the property is respected regardless of location. With the overlay still at the newline: (goto-char (overlay-start olay)) and in the middle of a row: (move-overlay olay 5 6) (goto-char (overlay-start olay)) the cursor appears at the propertized character in the before-string. (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. With the overlay still in the middle of the line: (setq str3 (concat str1 "\nWWW") str4 (concat str2 "\nWWW")) (overlay-put olay 'before-string str3) (goto-char (overlay-start olay)) (overlay-put olay 'before-string str4) (goto-char (overlay-start olay)) the cursor appears after the before string, for both types of property value. Now moving the overlay back to the newline: (save-excursion (goto-char (point-min)) (search-forward "\n") (move-overlay olay (1- (point)) (point))) (goto-char (overlay-start olay)) (overlay-put olay 'before-string str3) (goto-char (overlay-start olay)) the cursor property is again ignored, in both cases. 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. 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.)