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: Fri, 06 May 2011 17:17:16 -0400 (EDT) Message-ID: References: <831v0cm6pl.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Trace: dough.gmane.org 1304716692 24926 80.91.229.12 (6 May 2011 21:18:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 May 2011 21:18:12 +0000 (UTC) Cc: 8627@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 23:18:07 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 1QISPX-0002mt-1c for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2011 23:18:07 +0200 Original-Received: from localhost ([::1]:51020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QISPW-0003MB-Bf for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2011 17:18:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QISPU-0003Lu-4h for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 17:18:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QISPT-0003s9-2L for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 17:18:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QISPS-0003s5-Vu for bug-gnu-emacs@gnu.org; Fri, 06 May 2011 17:18:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QISPS-0006J6-7B; Fri, 06 May 2011 17:18: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 21:18: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.130471664624198 (code B ref 8627); Fri, 06 May 2011 21:18:02 +0000 Original-Received: (at 8627) by debbugs.gnu.org; 6 May 2011 21:17:26 +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 1QISOr-0006IF-NZ for submit@debbugs.gnu.org; Fri, 06 May 2011 17:17:25 -0400 Original-Received: from exprod7og115.obsmtp.com ([64.18.2.217]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QISOp-0006I2-Io for 8627@debbugs.gnu.org; Fri, 06 May 2011 17:17:24 -0400 Original-Received: from mb2i1.ns.pitt.edu ([136.142.11.153]) by exprod7ob115.postini.com ([64.18.6.12]) with SMTP ID DSNKTcRlXQAxlcxpZ3Z7JwFrRoh0VxE6Mo8X@postini.com; Fri, 06 May 2011 14:17:23 PDT Original-Received: from unixs1.cis.pitt.edu ([136.142.4.246]) by pitt.edu (PMDF V6.3-x11 #31505) with ESMTP id <0LKS00LC8LSSNE@mb2i1.ns.pitt.edu> for 8627@debbugs.gnu.org; Fri, 06 May 2011 17:17:16 -0400 (EDT) In-reply-to: X-X-Sender: aker@unixs1.cis.pitt.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 06 May 2011 17:18: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:46295 Archived-At: >> But if the before-string contains a newline, the cursor property >> appears to be ignored. > > I will take a look at fixing this, but can you show a real-life use > case where this is needed? I ran into the need while working on this package: emacswiki.org/emacs/FillColumnIndicator It shades the area past the fill column by putting overlays on newlines (if you look at the screenshot it'll be obvious how it works). In a few edge cases it would be useful to be able to display a newline that's not part of the buffer content. For example, if the last line of the buffer doesn't end in a newline, then no fill-column shading appears on that line (since there's no newline to propertize). I'd like to put an overlay at point-max with an after-string containing a propertized newline character, so that the fill-column shading can appear on the last line of the buffer. But I can't do so, because the newline in the after-string causes any cursor property in it to be ignored, and so cursor motion at the end of the buffer becomes deranged. (Display strings won't do here, because I don't want to replace the display of any characters in the buffer.) Does that qualify as a use case? I might as well also mention, at least for the record, another (minor) issue with cursor properties in before-strings that I came across: If the position with the cursor property is out of sight because of horizontal scrolling, then the property is ignored, even when auto-hscroll-mode is enabled. Perhaps it would make more sense to respect the cursor property when auto-hscroll-mode is non-nil, and adjust hscrolling to bring the requested cursor position into view? Here's a test case: (progn (setq auto-hscroll-mode t) ;; A line of text, moving to the end of which will trigger hscrolling. (insert (make-string (+ hscroll-margin (window-width) 5) ?X)) (setq m (point-marker)) (insert "\n\n") (setq o (make-overlay (1- (point)) (point))) ;; Request that cursor be at bol, but make the before-string long ;; enough that if the cursor property is ignored we won't return from ;; hscrolling. (overlay-put o 'before-string (concat (propertize " " 'cursor 1) (make-string (window-width) 32))) (goto-char m) (redisplay) (forward-line 1)) After evaluation the cursor will be at the end of the before-string, rather than at the requested position. (This happens with 22 and 23 as well.)