From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.bugs Subject: bugs and documentation issues: cursors, text/overlay properties (display, before-string, after-string, invisible, intangible), column numbers Date: Mon, 01 Oct 2007 16:31:55 +0100 Message-ID: <86y7emx34k.fsf@macs.hw.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1191252766 32230 80.91.229.12 (1 Oct 2007 15:32:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2007 15:32:46 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 01 17:32:42 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IcNGB-00073V-NG for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2007 17:32:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IcNG7-0006bN-LO for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2007 11:32:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IcNFe-0006Qx-SU for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2007 11:32:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IcNFb-0006Po-OS for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2007 11:32:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IcNFb-0006Pi-DU for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2007 11:32:03 -0400 Original-Received: from izanami.macs.hw.ac.uk ([137.195.13.6]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IcNFa-0004zj-2T for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2007 11:32:02 -0400 Original-Received: from lxultra1.macs.hw.ac.uk ([137.195.27.173]:53474 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1IcNFT-0007NI-RJ for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2007 16:31:56 +0100 Original-Received: (nullmailer pid 16500 invoked by uid 1001); Mon, 01 Oct 2007 15:31:55 -0000 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16675 Archived-At: Here are some assorted bugs and documentation issues. They affect cursors, column numbers, and these text/overlay properties: display, before-string, after-string, invisible, intangible. Basically I went through a bug report I sent 5 years ago for Emacs 21.2 and checked what the current status is. It seems some of the issues were fixed, but the fixes were not documented, so for these I am reporting the documentation issues. Some bugs are still the same. In some cases, the behavior is better now, but new anomalous behavior has appeared. Now here are the issues: ISSUE 1: The "Cursor Display" Emacs manual node says this: Normally, the cursor appears in non-selected windows in the "off" state, with the same appearance as when the blinking cursor blinks "off." For a box cursor, this is a hollow box; for a bar cursor, this is a thinner bar. To turn off cursors in non-selected windows, customize the variable `cursor-in-non-selected-windows' and assign it a `nil' value. Contradicting the above documentation, if the cursor-type variable is set to bar, then a thinner bar is not used when the window is not selected: (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (setq cursor-type 'bar) (display-buffer (current-buffer))) To get the documented effect, it is necessary to also set the variable cursor-in-non-selected-windows, like this: (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (setq cursor-type 'bar) ;; The fix is to use this new variable which should be documented ;; at cursor-type but is not yet. (setq cursor-in-non-selected-windows 'bar) (display-buffer (current-buffer))) ISSUE 2: The documentation string for cursor-in-non-selected-windows does not mention any distinctions other than nil vs. non-nil: *Non-nil means show a hollow box cursor in non-selected windows. If nil, don't show a cursor except in the selected window. Use Custom to set this variable to get the display updated. Similarly, the only mention of cursor-in-non-selected-windows in the Emacs manual is the one quoted above in issue 1, which also does not mention the other possible meaningful values of cursor-in-non-selected-windows. It seems that the only place where cursor-in-non-selected-windows is fully documented is in the etc/NEWS file. ISSUE 3: When the display property is given a display specification which replaces the text, then point is not allowed to be interactively placed inside the replaced text. While this is reasonable behavior, it is not documented in the Emacs Lisp manual section on "The `display' Property". ISSUE 4: A before-string property on a range of characters causes cursor problems. If point is just before all of the characters with the before-string property, the cursor is displayed _after_ the string which is the value of the before-string property. (This issue was first reported in 2002.) (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "AB") (let ((o (make-overlay 2 3))) ;; covering the B (overlay-put o 'before-string "YZ") ;;(overlay-put o 'display "C") ) (goto-char 2) ;; point now between A and B (display-buffer (current-buffer)) ) In the above example, because the characters "YZ" are logically part of the display of "B", and because point is between "A" and "B", then logically the cursor should be presented before the "YZ". ISSUE 5: An after-string and invisible property on a range of characters causes cursor problems. If point is just before all of the characters with the after-string and non-nil invisible property, the cursor is displayed _after_ the string which is the value of the after-string property. (This issue was first reported in 2002.) (progn (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "AB") (let ((o (make-overlay 2 3))) ;; covering the B (overlay-put o 'after-string "YZ") (overlay-put o 'invisible t)) (goto-char 2) ;; between A and B (display-buffer (current-buffer)) (what-cursor-position) ;; shows point is _before_ the B ) For the same reasons mentioned for the previous issue, the cursor should logically be displayed just after the "A" in this example. ISSUE 6: The previous-line and next-line commands skip over lines that have legal spots to move to. Here is a test case that shows the problem with previous-line. Warning: These test cases do not always produce the same behavior (despite the fact that they destroy and recreate all windows and buffers involved!). When invoked 2 or more times in a row, the test case always produces stable behavior on the invocations after the first. (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "A\nB\nC\nD\nE") (let ((o (make-overlay 3 8))) ;; covering the "B\nC\nD" (overlay-put o 'intangible t)) (goto-char 9) (previous-line 1) (display-buffer (current-buffer)) ;; shows point has skipped all the way to the line with the B, while ;; instead it should be just after the D: (what-cursor-position) ) Similarly, here is a test case that shows the problem with next-line: (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "A\nB\nC\nD\nE") (let ((o (make-overlay 3 8))) ;; covering the "B\nC\nD" (overlay-put o 'intangible t)) (goto-char 2) (next-line 1) (display-buffer (current-buffer)) ;; shows point has skipped all the way to the line with the D, while ;; instead it should be just before the B: (what-cursor-position) ) ISSUE 7: Column numbers as used by previous-line and next-line have surprising (to the naive user) effects when a display property (overlay or text property) is used which causes additional characters to be displayed or prevents characters in the buffer from being displayed. Strictly speaking, this may not be a bug, but it is highly undesirable behavior. There should be a way to have motion to a particular column based on what is displayed rather than on what is in the buffer. First, observe that column numbers are handled nicely when the invisible property is used: (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "ABCDEFGHI\nABCDEFGHI") (let ((o (make-overlay 3 5))) ;; covering the "CD" (overlay-put o 'invisible t)) (goto-char 7) ;; now between the "F" and the "G" (next-line 1) (display-buffer (current-buffer)) ;; now between the "D" and "E" (as desired) ) Then, observe that column numbers are _not_ handled nicely when the display property is used instead: (progn (delete-other-windows) (kill-buffer (get-buffer-create "test")) (set-buffer (get-buffer-create "test")) (insert "ABCDEFGHI\nABCDEFGHI") (let ((o (make-overlay 3 5))) ;; covering the "CD" (overlay-put o 'display "")) (goto-char 7) ;; now between the "F" and the "G" (next-line 1) (display-buffer (current-buffer)) ;; now between the "F" and "G" (undesired) ) For this purpose, a display property of "" should behave the same as a non-nil invisible property, but it does not. Warning: The test cases above are unstable in the same way as the test cases for issue 6 above. They do not always produce the same behavior, but do seem to produce the same behavior on the second and subsequent uses when repeated. You can see some very strange behavior by alternating invocations of the two test cases in this issue. I hope this report is useful. Joe ====================================================================== In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20) of 2007-06-27 on artemis Windowing system distributor `The X.Org Foundation', version 11.0.70000000 configured using `configure '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: jbw value of $LANG: nil locale-coding-system: utf-8 default-enable-multibyte-characters: t Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t