From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Mar 2012 04:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 11094@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.133273675130945 (code B ref -1); Mon, 26 Mar 2012 04:40:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Mar 2012 04:39:11 +0000 Received: from localhost ([127.0.0.1]:38890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1i0-00082z-0B for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:39:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56588) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1hh-00082B-Lp for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:39:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC1DY-0003qw-A3 for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:07:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:48281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DY-0003qs-6L for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:07:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DW-0007kD-DR for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC1DU-0003qM-54 for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:37 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:5702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DT-0003q5-VM for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:36 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4GAKU/KE9FpYqr/2dsb2JhbACBX48kAQGNGD15kziTUYYZBJsZhAk X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="el'?cpio'247?scan'247,208,247";a="170056623" Received: from 69-165-138-171.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.171]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Mar 2012 00:07:33 -0400 Received: by pastel.home (Postfix, from userid 20848) id BC5A2590DD; Mon, 26 Mar 2012 00:07:32 -0400 (EDT) From: Stefan Monnier Date: Mon, 26 Mar 2012 00:07:32 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) --=-=-= Content-Type: text/plain Package: Emacs Version: 24.0.94 Extract the test.cpio and cpio-mode.el files attached, and then try: src/emacs -Q -l .../cpio-mode.el .../test.cpio First, you'll note that the cursor is displayed at end-of-line (whereas in reality point as it BOB), then move forward with C-f and you'll see the cursor jumping in odd ways (often being pushed to end-of-line even when we're still in the middle of the line). In Emacs-23, the cursor jumps correctly over the various display and invisible fields, so this is a regression. Stefan In GNU Emacs 24.0.94.1 (i386-unknown-linux-gnu, GTK+ Version 2.24.10) of 2012-03-21 on pastel Windowing system distributor `The X.Org Foundation', version 11.0.11104000 Configured using: `configure 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O0' '--with-tiff=no'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_CH.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t --=-=-= Content-Type: application/x-cpio Content-Disposition: attachment; filename=test.cpio Content-Transfer-Encoding: base64 MDcwNzAxMDAwNjhEREIwMDAwNDFFRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwQTRGNkY4MTM4MDAw MDAwMDAwMDAwMDBGRTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAwMDAwMDAuADA3 MDcwMTAwMDY4RTU4MDAwMDQxRUQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDc0RjZGODEzNzAwMDAw MDAwMDAwMDAwRkUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwODAwMDAwMDAwc2NyaXB0 cwAAAA== --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=cpio-mode.el Content-Transfer-Encoding: quoted-printable ;;; cpio-mode.el --- View/edit cpio archives ;; Copyright (C) 2012 Stefan Monnier ;; Author: Stefan Monnier ;; Keywords:=20 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;=20 ;;; Code: ;; The format supported is the "New ASCII Format" as documented in ;; http://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt. (eval-when-compile (require 'cl)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cpio\\'" . cpio-mode)) ;;;###autoload (when (boundp 'inhibit-local-variables-regexps) (add-to-list 'inhibit-local-variables-regexps "\\.cpio\\'")) ;;;###autoload (define-derived-mode cpio-mode special-mode "CPIO" "View/edit cpio archives." (add-hook 'change-major-mode-hook (lambda () (with-silent-modifications (save-restriction (widen) (remove-text-properties (point-min) (point-max) '(display nil invisible nil))= )))) (cpio--parse-buffer)) (defun cpio--parse-mode (mode) (string (case (logand #o170000 mode) (#o140000 ?s) (#o120000 ?l) (#o100000 ?-) (#o060000 ?b) (#o040000 ?d) (#o020000 ?c) (#o010000 ?p) (t error "Unknown mode %S" mode)) (if (zerop (logand #o400 mode)) ?- ?r) (if (zerop (logand #o200 mode)) ?- ?w) (if (zerop (logand #o100 mode)) (if (zerop (logand #o4000 mode)) ?- ?S) (if (zerop (logand #o4000 mode)) ?x ?s)) (if (zerop (logand #o040 mode)) ?- ?r) (if (zerop (logand #o020 mode)) ?- ?w) (if (zerop (logand #o010 mode)) (if (zerop (logand #o2000 mode)) ?- ?S) (if (zerop (logand #o2000 mode)) ?x ?s)) (if (zerop (logand #o004 mode)) ?- ?r) (if (zerop (logand #o002 mode)) ?- ?w) (if (zerop (logand #o001 mode)) ?- ?x))) =20=20=20=20=20 (defun cpio--parse-buffer () (save-excursion (save-restriction (widen) (goto-char (point-min)) (with-silent-modifications (while (not (eobp)) (assert (zerop (mod (- (point) (point-min)) 4))) (cond ((not (looking-at "07070[12]\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)[[:xdigit:]]\\{8\\}\\|\0+\\'")) (error "Unrecognized cpio header format")) ((not (match-beginning 1)) ;; Reached the trailing padding, just skip it. (put-text-property (point) (point-max) 'invisible t) (goto-char (match-end 0))) (t (let* ((ino (string-to-number (match-string 1) 16)) (mode (string-to-number (match-string 2) 16)) (uid (string-to-number (match-string 3) 16)) (gid (string-to-number (match-string 4) 16)) (nlink (string-to-number (match-string 5) 16)) (mtime (string-to-number (match-string 6) 16)) (filesize (string-to-number (match-string 7) 16)) (devmajor (string-to-number (match-string 8) 16)) (devminor (string-to-number (match-string 9) 16)) (rdevmajor (string-to-number (match-string 10) 16)) (rdevminor (string-to-number (match-string 11) 16)) (namesize (string-to-number (match-string 12) 16)) (namebeg (match-end 0)) (name (buffer-substring namebeg (+ namebeg namesize -1))) (filebeg (+ (match-end 0) 2 (* (/ (+ namesize 1) 4) 4))) (next (+ filebeg (* (/ (+ filesize 3) 4) 4)))) (if (and (zerop ino) (zerop mode) (zerop filesize) (equal name "TRAILER!!!")) (put-text-property (match-beginning 0) next 'display "\n") (if (bobp) (put-text-property (point) (match-end 1) 'invisible t) (put-text-property (point) (match-end 1) 'display "\n")) (put-text-property (match-beginning 2) (match-end 2) 'display (cpio--parse-mode mode)) (put-text-property (match-beginning 3) (match-end 3) 'display (format "%10d" uid)) (put-text-property (match-beginning 4) (match-end 4) 'display (format "/%-10d" gid)) (put-text-property (match-beginning 5) (match-end 6) 'invisible t) (put-text-property (match-beginning 7) (match-end 7) 'display (format "%10d " filesize)) (put-text-property (match-beginning 8) namebeg 'invisible t) (if (=3D (logand #o170000 mode) #o120000) ;Symlink (progn (put-text-property (+ namebeg namesize -1) filebeg 'display " -> ") (put-text-property (+ filebeg filesize) next 'invisible t)) (put-text-property (+ namebeg namesize -1) next 'invisible t)) (message "Parsed %S of size %d" name filesize)) (goto-char next))))))))) (provide 'cpio-mode) ;;; cpio-mode.el ends here --=-=-=-- From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Mar 2012 09:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133318643722165 (code B ref 11094); Sat, 31 Mar 2012 09:34:02 +0000 Received: (at 11094) by debbugs.gnu.org; 31 Mar 2012 09:33:57 +0000 Received: from localhost ([127.0.0.1]:60099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDuh2-0005lR-Gz for submit@debbugs.gnu.org; Sat, 31 Mar 2012 05:33:56 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:42282) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDugy-0005lH-Sr for 11094@debbugs.gnu.org; Sat, 31 Mar 2012 05:33:54 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M1Q00C00T445D00@a-mtaout22.012.net.il> for 11094@debbugs.gnu.org; Sat, 31 Mar 2012 12:33:18 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.100.223]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1Q00BMZT7GD3N0@a-mtaout22.012.net.il>; Sat, 31 Mar 2012 12:33:18 +0300 (IDT) Date: Sat, 31 Mar 2012 12:33:17 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83vclljesi.fsf@gnu.org> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_JufyzPVdrRs1IMG5yD9Erw)" References: X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) --Boundary_(ID_JufyzPVdrRs1IMG5yD9Erw) Content-type: text/plain > From: Stefan Monnier > Date: Mon, 26 Mar 2012 00:07:32 -0400 > > Extract the test.cpio and cpio-mode.el files attached, and then try: > > src/emacs -Q -l .../cpio-mode.el .../test.cpio Ouch! (Btw, test.cpio is an invalid archive, according to 2 different implementations of the cpio command. The one from GNU/Linux says "cpio: premature end of file". Not that it matters for the purposes of this discussion.) > First, you'll note that the cursor is displayed at end-of-line (whereas > in reality point as it BOB), then move forward with C-f and you'll see > the cursor jumping in odd ways (often being pushed to end-of-line even > when we're still in the middle of the line). Right. The end-of-line placement of the cursor usually means that the display engine knows the cursor should be on this line, but it didn't find a proper place to put it. And in this case, for a good reason, see below. > In Emacs-23, the cursor jumps correctly over the various display and > invisible fields For some value of "correctly". E.g., position the cursor over the ".", which is the first file name in the archive, and type "C-x =". You will see "63", which is a lie: the actual value of point is 111. This lie becomes more evident if you position the cursor on the first 's' of "scripts", the file name on the second line: "C-x =" says "175" (whereas the truth is 223), but if you now type "C-f C-x =", you will see "224". Huh? Anyway, that this "works" in Emacs 23 and before is more by accident than by anything else. Your cpio-mode.el almost completely conceals the buffer contents from the display engine, either by 'invisible' property or behind display strings. The cursor-positioning code is therefore completely helpless when it comes to decide where to put the cursor, because all it has is (a) the value of point, and (b) the glyphs generated for each display line (a.k.a. "glyph row"). With most of the buffer positions covered by 'invisible' and 'display' properties, no glyphs to place the cursor on can be found for most values of point, since there are no glyphs which "tell" the display engine that they came from those buffer positions. The old, unidirectional display engine could get away (albeit by the skin of its teeth) with such code because it relied on buffer positions to increase monotonically with screen positions. So once it found a glyph from buffer position N that is greater or equal to the value of point, it could place the cursor there, because it "knew" all the later glyphs _must_ correspond to positions beyond N. That is why it "works" in Emacs 23. A case in point is the position of cursor at BOB. The value of point is 1, whereas the first glyph on the first screen lines comes from buffer position 15(!). The old display code could put the cursor there _only_ because that is the first glyph whose buffer position is greater or equal to 1. However, the bidirectional display engine can no longer make such assumptions, so it is helpless without at least _some_ clue about the buffer positions corresponding to the glyphs. And your code gives almost no such clues. I think we should either (1) from now on discourage (i.e., maintain that we don't support) code that covers too much of buffer text by display strings, or (2) completely redesign 'struct glyph', so that it keeps more information about the buffer positions "associated" with the glyph, and then refactor the code which needs that information. (The second alternative is, of course, not for Emacs 24.) Alternatively, may I suggest that you use the 'cursor' property to provide some rope for the display engine to do its job even in this situation? The attached variant of your code demonstrates how to do that; it works equally well with Emacs 23 and with the current trunk. Bottom line, to resolve this bug for Emacs 24.1, I suggest a judicial use of the 'cursor' property as the only safe (and IMO the only sane) alternative. If you still think we should support your original code, we should schedule some post-24.1 redesign and refactoring. Let me know what you think. Here's a modified version of cpio-mode.el. Note that it removes most of the 'invisible' properties, because they are not really needed, and because they have an unpleasant side effect of reporting incorrect value of point due to "point adjustments". I suspect that all the other 'invisible' properties should be removed as well, but I didn't test the situations where they would come into play. --Boundary_(ID_JufyzPVdrRs1IMG5yD9Erw) Content-type: application/emacs-lisp Content-transfer-encoding: quoted-printable Content-disposition: attachment; filename=cpio-mode1.el ;;; cpio-mode.el --- View/edit cpio archives ;; Copyright (C) 2012 Stefan Monnier ;; Author: Stefan Monnier ;; Keywords:=20 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;=20 ;;; Code: ;; The format supported is the "New ASCII Format" as documented in ;; http://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt. (eval-when-compile (require 'cl)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cpio\\'" . cpio-mode)) ;;;###autoload (when (boundp 'inhibit-local-variables-regexps) (add-to-list 'inhibit-local-variables-regexps "\\.cpio\\'")) ;;;###autoload (define-derived-mode cpio-mode special-mode "CPIO" "View/edit cpio archives." (add-hook 'change-major-mode-hook (lambda () (with-silent-modifications (save-restriction (widen) (remove-text-properties (point-min) (point-max) '(display nil invisible nil))= )))) (cpio--parse-buffer)) (defun cpio--parse-mode (mode) (string (case (logand #o170000 mode) (#o140000 ?s) (#o120000 ?l) (#o100000 ?-) (#o060000 ?b) (#o040000 ?d) (#o020000 ?c) (#o010000 ?p) (t error "Unknown mode %S" mode)) (if (zerop (logand #o400 mode)) ?- ?r) (if (zerop (logand #o200 mode)) ?- ?w) (if (zerop (logand #o100 mode)) (if (zerop (logand #o4000 mode)) ?- ?S) (if (zerop (logand #o4000 mode)) ?x ?s)) (if (zerop (logand #o040 mode)) ?- ?r) (if (zerop (logand #o020 mode)) ?- ?w) (if (zerop (logand #o010 mode)) (if (zerop (logand #o2000 mode)) ?- ?S) (if (zerop (logand #o2000 mode)) ?x ?s)) (if (zerop (logand #o004 mode)) ?- ?r) (if (zerop (logand #o002 mode)) ?- ?w) (if (zerop (logand #o001 mode)) ?- ?x))) (defun put-display-string-with-cursor (start end string &optional count) "Display STRING between START and END, with `cursor' property on 1st char. Optional argument COUNT controls the value of the `cursor' property. If it is nil or omitted, the value will be an integer number of buffer positions between START and END. Any other value will be used as the value of `cursor' property. Useful kinds of values include an integer number or a symbol." (put-text-property start end 'display (concat (propertize (substring string 0 1) 'cursor (or count (- end start 1))) (substring string 1)))) (defun cpio--parse-buffer () (save-excursion (save-restriction (widen) (goto-char (point-min)) (with-silent-modifications (while (not (eobp)) (assert (zerop (mod (- (point) (point-min)) 4))) (cond ((not (looking-at "07070[12]\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)[[:xdigit:]]\\{8\\}\\|\0+\\'")) (error "Unrecognized cpio header format")) ((not (match-beginning 1)) ;; Reached the trailing padding, just skip it. (put-text-property (point) (point-max) 'invisible t) (goto-char (match-end 0))) (t (let* ((ino (string-to-number (match-string 1) 16)) (mode (string-to-number (match-string 2) 16)) (uid (string-to-number (match-string 3) 16)) (gid (string-to-number (match-string 4) 16)) (nlink (string-to-number (match-string 5) 16)) (mtime (string-to-number (match-string 6) 16)) (filesize (string-to-number (match-string 7) 16)) (devmajor (string-to-number (match-string 8) 16)) (devminor (string-to-number (match-string 9) 16)) (rdevmajor (string-to-number (match-string 10) 16)) (rdevminor (string-to-number (match-string 11) 16)) (namesize (string-to-number (match-string 12) 16)) (namebeg (match-end 0)) (name (buffer-substring namebeg (+ namebeg namesize -1))) (filebeg (+ (match-end 0) 2 (* (/ (+ namesize 1) 4) 4))) (next (+ filebeg (* (/ (+ filesize 3) 4) 4)))) (if (and (zerop ino) (zerop mode) (zerop filesize) (equal name "TRAILER!!!")) (put-display-string-with-cursor (match-beginning 0) next "\n") (if (bobp) (put-display-string-with-cursor (point) (match-end 2) (cpio--parse-mode mode) t) (put-text-property (point) (match-end 1) 'display "\n") (put-display-string-with-cursor (match-end 1) (match-end 2) (cpio--parse-mode mode) t)) (put-display-string-with-cursor (match-beginning 3) (match-end 3) (format "%10d" uid) t) (put-display-string-with-cursor (match-beginning 4) (match-end 4) (format "/%-10d" gid) t) (put-display-string-with-cursor (match-beginning 5) namebeg (format "%10d " filesize) t) (if (=3D (logand #o170000 mode) #o120000) ;Symlink (progn (put-text-property (+ namebeg namesize -1) filebeg 'display " -> ") (put-text-property (+ filebeg filesize) next 'invisible t)) (put-text-property (+ namebeg namesize -1) next 'invisible t)) (message "Parsed %S of size %d" name filesize)) (goto-char next))))))))) (provide 'cpio-mode) ;;; cpio-mode.el ends here --Boundary_(ID_JufyzPVdrRs1IMG5yD9Erw)-- From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 01:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 11094@debbugs.gnu.org Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133332883626115 (code B ref 11094); Mon, 02 Apr 2012 01:08:02 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 01:07:16 +0000 Received: from localhost ([127.0.0.1]:35212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEVjn-0006n9-Nd for submit@debbugs.gnu.org; Sun, 01 Apr 2012 21:07:16 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:24866) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEVjl-0006n2-Ut for 11094@debbugs.gnu.org; Sun, 01 Apr 2012 21:07:14 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9soXt6/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="171211337" Received: from 108-161-123-122.dsl.teksavvy.com (HELO pastel.home) ([108.161.123.122]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 01 Apr 2012 21:06:59 -0400 Received: by pastel.home (Postfix, from userid 20848) id 5F873590C9; Sun, 1 Apr 2012 21:06:59 -0400 (EDT) From: Stefan Monnier Message-ID: References: <83vclljesi.fsf@gnu.org> Date: Sun, 01 Apr 2012 21:06:59 -0400 In-Reply-To: <83vclljesi.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 31 Mar 2012 12:33:17 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Extract the test.cpio and cpio-mode.el files attached, and then try: >> src/emacs -Q -l .../cpio-mode.el .../test.cpio > Ouch! ;-) > (Btw, test.cpio is an invalid archive, according to 2 different > implementations of the cpio command. The one from GNU/Linux says > "cpio: premature end of file". Not that it matters for the purposes > of this discussion.) I just truncated it, since the original (an initrd) is 10MB long. >> In Emacs-23, the cursor jumps correctly over the various display and >> invisible fields > For some value of "correctly". E.g., position the cursor over the > ".", which is the first file name in the archive, and type "C-x =". > You will see "63", which is a lie: the actual value of point is 111. I don't think it's a lie because that text is preceded by invisible text, so while "." is at 111, point is indeed at 63 (and that's just because of adjust_point_for_property, so we can get point to stay at 111 by being more careful with text property's stickiness). > The old, unidirectional display engine could get away (albeit by the > skin of its teeth) with such code because it relied on buffer > positions to increase monotonically with screen positions. So once it > found a glyph from buffer position N that is greater or equal to the > value of point, it could place the cursor there, because it "knew" all > the later glyphs _must_ correspond to positions beyond N. That is why > it "works" in Emacs 23. I see that the problem is not so much that all the text is covered by those properties, but rather that there is are contiguous texts with `invisible' and `display' properties. I get Emacs-24 to behave correctly by turning all "invisible span followed by display span" into just a single display span. E.g. if you do emacs -Q (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") (goto-char (point-min)) you'll see that the cursor is drawn at the wrong place (i.e. after the <>), whereas if you do emacs -Q (put-text-property (point-min) (+ 4 (point-min)) 'display "<>") (goto-char (point-min)) the cursor is drawn at the right place. I think this is the core of the problem that's handled differently from Emacs-23. [ IIUC you've gotten to the same conclusion. ] > If you still think we should support your original code, we should > schedule some post-24.1 redesign and refactoring. Let me know what > you think. I don't think it's a very high priority problem, but it would be good to try and tackle it, yes (post-24.1). Stefan From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 02:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.13333354243218 (code B ref 11094); Mon, 02 Apr 2012 02:58:02 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 02:57:04 +0000 Received: from localhost ([127.0.0.1]:35222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEXS4-0000pq-1M for submit@debbugs.gnu.org; Sun, 01 Apr 2012 22:57:04 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:62773) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEXRm-0000pC-PC for 11094@debbugs.gnu.org; Sun, 01 Apr 2012 22:57:01 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M1U00A00001UR00@a-mtaout22.012.net.il> for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 05:56:31 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.100.223]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1U00AS1066JR70@a-mtaout22.012.net.il>; Mon, 02 Apr 2012 05:56:31 +0300 (IDT) Date: Mon, 02 Apr 2012 05:56:34 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83wr5yj0yl.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Sun, 01 Apr 2012 21:06:59 -0400 > > > For some value of "correctly". E.g., position the cursor over the > > ".", which is the first file name in the archive, and type "C-x =". > > You will see "63", which is a lie: the actual value of point is 111. > > I don't think it's a lie because that text is preceded by invisible > text, so while "." is at 111, point is indeed at 63 (and that's just > because of adjust_point_for_property, so we can get point to stay at > 111 by being more careful with text property's stickiness). Having point report X when it is position on a character whose position is Y, or jump when you move it from one character of a file name to the next violates the principle of least astonishment, IMO. > I see that the problem is not so much that all the text is covered by > those properties, but rather that there is are contiguous texts with > `invisible' and `display' properties. Yes, that doesn't help, as I mentioned. > emacs -Q > (put-text-property (point-min) (+ 4 (point-min)) 'display "<>") > (goto-char (point-min)) > > the cursor is drawn at the right place. I think this is the core of the > problem that's handled differently from Emacs-23. > [ IIUC you've gotten to the same conclusion. ] While there could be more than one way to cut this cake, I still think we should encourage Lips programmers to use the `cursor' property in these situations. > > If you still think we should support your original code, we should > > schedule some post-24.1 redesign and refactoring. Let me know what > > you think. > > I don't think it's a very high priority problem, but it would be good to > try and tackle it, yes (post-24.1). OK. Should we close this bug, then? From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 13:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 11094@debbugs.gnu.org Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133337219531949 (code B ref 11094); Mon, 02 Apr 2012 13:10:02 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 13:09:55 +0000 Received: from localhost ([127.0.0.1]:35580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEh19-0008JG-9l for submit@debbugs.gnu.org; Mon, 02 Apr 2012 09:09:55 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:14137) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEh16-0008J8-8D for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 09:09:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9soXt6/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="171273365" Received: from 108-161-123-122.dsl.teksavvy.com (HELO pastel.home) ([108.161.123.122]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 02 Apr 2012 09:09:35 -0400 Received: by pastel.home (Postfix, from userid 20848) id D95D1590C9; Mon, 2 Apr 2012 09:09:34 -0400 (EDT) From: Stefan Monnier Message-ID: References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> Date: Mon, 02 Apr 2012 09:09:34 -0400 In-Reply-To: <83wr5yj0yl.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Apr 2012 05:56:34 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> > For some value of "correctly". E.g., position the cursor over the >> > ".", which is the first file name in the archive, and type "C-x =". >> > You will see "63", which is a lie: the actual value of point is 111. >> I don't think it's a lie because that text is preceded by invisible >> text, so while "." is at 111, point is indeed at 63 (and that's just >> because of adjust_point_for_property, so we can get point to stay at >> 111 by being more careful with text property's stickiness). > Having point report X when it is position on a character whose > position is Y, or jump when you move it from one character of a file > name to the next violates the principle of least astonishment, IMO. That's an inevitable consequence of using `invisible'. So yes, I agree that `invisible' should be used with great care, but there is no bug in this particular part (the underlying problem is that the block cursor is drawn *on* characters whereas point is *between* characters). >> the cursor is drawn at the right place. I think this is the core of the >> problem that's handled differently from Emacs-23. >> [ IIUC you've gotten to the same conclusion. ] > While there could be more than one way to cut this cake, I still think > we should encourage Lips programmers to use the `cursor' property in > these situations. Hmm... I haven't actually tried to use the `cursor' property, but I'm not sure it would help when point is actually outside of the text area covered by any of the display strings. > Should we close this bug, then? We might as well keep it open until the problem is actually solved. Stefan From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133338552820457 (code B ref 11094); Mon, 02 Apr 2012 16:53:01 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 16:52:08 +0000 Received: from localhost ([127.0.0.1]:36795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEkUB-0005Jt-PA for submit@debbugs.gnu.org; Mon, 02 Apr 2012 12:52:08 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:44890) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEkU8-0005Jh-AN for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 12:52:05 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M1V00K002RNSO00@a-mtaout22.012.net.il> for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 19:51:39 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.100.223]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1V00K5A2U1G370@a-mtaout22.012.net.il>; Mon, 02 Apr 2012 19:51:38 +0300 (IDT) Date: Mon, 02 Apr 2012 19:51:46 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83vclihyal.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Mon, 02 Apr 2012 09:09:34 -0400 > > Hmm... I haven't actually tried to use the `cursor' property, but I'm > not sure it would help when point is actually outside of the text area > covered by any of the display strings. It could do that, if you give the property an integer value. > > Should we close this bug, then? > > We might as well keep it open until the problem is actually solved. Then please define precisely what problem needs to be solved, because I'm definitely confused about that now. From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 20:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 11094@debbugs.gnu.org Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.13333977386032 (code B ref 11094); Mon, 02 Apr 2012 20:16:01 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 20:15:38 +0000 Received: from localhost ([127.0.0.1]:36963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEnf8-0001ZF-62 for submit@debbugs.gnu.org; Mon, 02 Apr 2012 16:15:38 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:38373) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEnf6-0001Z8-CW for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 16:15:37 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q32KFI5d013640; Mon, 2 Apr 2012 16:15:18 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 10440B4507; Mon, 2 Apr 2012 16:15:17 -0400 (EDT) From: Stefan Monnier Message-ID: References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> Date: Mon, 02 Apr 2012 16:15:17 -0400 In-Reply-To: <83vclihyal.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Apr 2012 19:51:46 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4180=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4180> : streams <743291> : uri <1094664> X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >> We might as well keep it open until the problem is actually solved. > Then please define precisely what problem needs to be solved, because > I'm definitely confused about that now. We could start with: emacs -Q (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") (goto-char (point-min)) where I'd expect the cursor to be drawn to the left of "<>" rather than to the right. Stefan From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 21:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133340084610742 (code B ref 11094); Mon, 02 Apr 2012 21:08:01 +0000 Received: (at 11094) by debbugs.gnu.org; 2 Apr 2012 21:07:26 +0000 Received: from localhost ([127.0.0.1]:36994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEoTF-0002nD-P4 for submit@debbugs.gnu.org; Mon, 02 Apr 2012 17:07:26 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]:41834) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEoTC-0002n2-MC for 11094@debbugs.gnu.org; Mon, 02 Apr 2012 17:07:23 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0M1V00K00EJPX000@a-mtaout21.012.net.il> for 11094@debbugs.gnu.org; Tue, 03 Apr 2012 00:06:42 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.100.223]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1V00KHOEN5RU90@a-mtaout21.012.net.il>; Tue, 03 Apr 2012 00:06:42 +0300 (IDT) Date: Tue, 03 Apr 2012 00:06:51 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83vclhdes4.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Mon, 02 Apr 2012 16:15:17 -0400 > > emacs -Q > (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) > (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") > (goto-char (point-min)) > > where I'd expect the cursor to be drawn to the left of "<>" rather than > to the right. Isn't this an issue with point adjustments? If I set global-disable-point-adjustment non-nil, I get the cursor where you want it. From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Apr 2012 13:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 11094@debbugs.gnu.org Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.13334602535119 (code B ref 11094); Tue, 03 Apr 2012 13:38:01 +0000 Received: (at 11094) by debbugs.gnu.org; 3 Apr 2012 13:37:33 +0000 Received: from localhost ([127.0.0.1]:37844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SF3vQ-0001KV-Lu for submit@debbugs.gnu.org; Tue, 03 Apr 2012 09:37:32 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:16841) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SF3vP-0001KP-DW for 11094@debbugs.gnu.org; Tue, 03 Apr 2012 09:37:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9soXt6/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="171686935" Received: from 108-161-123-122.dsl.teksavvy.com (HELO pastel.home) ([108.161.123.122]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 03 Apr 2012 09:37:09 -0400 Received: by pastel.home (Postfix, from userid 20848) id B000359322; Tue, 3 Apr 2012 09:37:08 -0400 (EDT) From: Stefan Monnier Message-ID: References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> Date: Tue, 03 Apr 2012 09:37:08 -0400 In-Reply-To: <83vclhdes4.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 03 Apr 2012 00:06:51 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> emacs -Q >> (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) >> (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") >> (goto-char (point-min)) >> where I'd expect the cursor to be drawn to the left of "<>" rather than >> to the right. > Isn't this an issue with point adjustments? No: the (goto-char (point-min)) really moves to (point-min) for me, as can be verified with M-: (point). > If I set global-disable-point-adjustment non-nil, I get the cursor > where you want it. It makes no difference for me: point as at BOB, but the cursor is drawn after the "<>". Stefan From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Apr 2012 12:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.13338006253614 (code B ref 11094); Sat, 07 Apr 2012 12:11:01 +0000 Received: (at 11094) by debbugs.gnu.org; 7 Apr 2012 12:10:25 +0000 Received: from localhost ([127.0.0.1]:43132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGUTJ-0000wF-2X for submit@debbugs.gnu.org; Sat, 07 Apr 2012 08:10:25 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:32980) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGUTF-0000w5-M4 for 11094@debbugs.gnu.org; Sat, 07 Apr 2012 08:10:23 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M2300800YXPPI00@a-mtaout22.012.net.il> for 11094@debbugs.gnu.org; Sat, 07 Apr 2012 15:09:34 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.229.252.114]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M2300884Z3XDAD0@a-mtaout22.012.net.il>; Sat, 07 Apr 2012 15:09:34 +0300 (IDT) Date: Sat, 07 Apr 2012 15:07:34 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83pqbjagop.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Tue, 03 Apr 2012 09:37:08 -0400 > > >> emacs -Q > >> (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) > >> (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") > >> (goto-char (point-min)) > >> where I'd expect the cursor to be drawn to the left of "<>" rather than > >> to the right. > > Isn't this an issue with point adjustments? > > No: the (goto-char (point-min)) really moves to (point-min) for me, as > can be verified with M-: (point). > > > If I set global-disable-point-adjustment non-nil, I get the cursor > > where you want it. > > It makes no difference for me: point as at BOB, but the cursor is drawn > after the "<>". The patch below solves this problem. Do you think it is safe enough for the release branch? === modified file 'src/xdisp.c' --- src/xdisp.c 2012-03-31 19:30:53 +0000 +++ src/xdisp.c 2012-04-07 11:58:19 +0000 @@ -14042,15 +14042,18 @@ set_cursor_from_row (struct window *w, s || pos <= tem) { /* If the string from which this glyph came is - found in the buffer at point, then we've - found the glyph we've been looking for. If - it comes from an overlay (tem == 0), and it - has the `cursor' property on one of its + found in the buffer at point, or at position + that is closer to point than pos_after, then + we've found the glyph we've been looking for. + If it comes from an overlay (tem == 0), and + it has the `cursor' property on one of its glyphs, record that glyph as a candidate for displaying the cursor. (As in the unidirectional version, we will display the cursor on the last candidate we find.) */ - if (tem == 0 || tem == pt_old) + if (tem == 0 + || tem == pt_old + || (tem - pt_old > 0 && tem < pos_after)) { /* The glyphs from this string could have been reordered. Find the one with the @@ -14088,7 +14091,8 @@ set_cursor_from_row (struct window *w, s } } - if (tem == pt_old) + if (tem == pt_old + || (tem - pt_old > 0 && tem < pos_after)) goto compute_x; } if (tem) From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Apr 2012 02:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 11094@debbugs.gnu.org Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133393825329684 (code B ref 11094); Mon, 09 Apr 2012 02:25:02 +0000 Received: (at 11094) by debbugs.gnu.org; 9 Apr 2012 02:24:13 +0000 Received: from localhost ([127.0.0.1]:45855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SH4H7-0007ij-7B for submit@debbugs.gnu.org; Sun, 08 Apr 2012 22:24:13 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:6112) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SH4H5-0007ic-So for 11094@debbugs.gnu.org; Sun, 08 Apr 2012 22:24:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE/O+KRD/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="172797437" Received: from 206-248-164-67.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.164.67]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 08 Apr 2012 22:23:18 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 0BC57AE203; Sun, 8 Apr 2012 22:23:17 -0400 (EDT) From: Stefan Monnier Message-ID: References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> <83pqbjagop.fsf@gnu.org> Date: Sun, 08 Apr 2012 22:23:17 -0400 In-Reply-To: <83pqbjagop.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Apr 2012 15:07:34 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The patch below solves this problem. Do you think it is safe enough > for the release branch? Let's keep it on the trunk for now. Stefan From unknown Sat Aug 16 17:02:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11094: Wrong cursor positioning with display+invisible Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Apr 2012 08:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 11094@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.133395876027317 (code B ref 11094); Mon, 09 Apr 2012 08:06:01 +0000 Received: (at 11094) by debbugs.gnu.org; 9 Apr 2012 08:06:00 +0000 Received: from localhost ([127.0.0.1]:46141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SH9bs-00076X-6b for submit@debbugs.gnu.org; Mon, 09 Apr 2012 04:06:00 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:49220) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SH9bq-00076P-BH for 11094@debbugs.gnu.org; Mon, 09 Apr 2012 04:05:59 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0M2700L00D2J3V00@a-mtaout23.012.net.il> for 11094@debbugs.gnu.org; Mon, 09 Apr 2012 11:04:20 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.229.57.204]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M2700LH4D373310@a-mtaout23.012.net.il>; Mon, 09 Apr 2012 11:04:20 +0300 (IDT) Date: Mon, 09 Apr 2012 11:02:24 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83fwcd8h9r.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> <83pqbjagop.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Sun, 08 Apr 2012 22:23:17 -0400 > > > The patch below solves this problem. Do you think it is safe enough > > for the release branch? > > Let's keep it on the trunk for now. Done as trunk revision 107809. Should I close this bug, or is there anything else? From unknown Sat Aug 16 17:02:27 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Monnier Subject: bug#11094: closed (Re: bug#11094: Wrong cursor positioning with display+invisible) Message-ID: References: X-Gnu-PR-Message: they-closed 11094 X-Gnu-PR-Package: emacs Reply-To: 11094@debbugs.gnu.org Date: Mon, 09 Apr 2012 13:23:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1333977782-692-1" This is a multi-part message in MIME format... ------------=_1333977782-692-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #11094: Wrong cursor positioning with display+invisible which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 11094@debbugs.gnu.org. --=20 11094: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D11094 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1333977782-692-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 11094-done) by debbugs.gnu.org; 9 Apr 2012 13:22:18 +0000 Received: from localhost ([127.0.0.1]:46451 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHEXy-0000A9-0V for submit@debbugs.gnu.org; Mon, 09 Apr 2012 09:22:18 -0400 Received: from ironport-out.teksavvy.com ([206.248.143.162]:25807) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHEXw-00009y-HP for 11094-done@debbugs.gnu.org; Mon, 09 Apr 2012 09:22:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYIACxOgk/O+KRD/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kiBwFtjKLYYR5BKRFgV2DAw X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="172849045" Received: from 206-248-164-67.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.164.67]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 09 Apr 2012 09:21:19 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 97159AE213; Mon, 9 Apr 2012 09:21:19 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#11094: Wrong cursor positioning with display+invisible Message-ID: References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> <83pqbjagop.fsf@gnu.org> <83fwcd8h9r.fsf@gnu.org> Date: Mon, 09 Apr 2012 09:21:19 -0400 In-Reply-To: <83fwcd8h9r.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 09 Apr 2012 11:02:24 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11094-done Cc: 11094-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Should I close this bug, or is there anything else? Closed, thanks, Stefan ------------=_1333977782-692-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Mar 2012 04:39:11 +0000 Received: from localhost ([127.0.0.1]:38890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1i0-00082z-0B for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:39:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56588) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1hh-00082B-Lp for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:39:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC1DY-0003qw-A3 for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:07:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:48281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DY-0003qs-6L for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:07:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DW-0007kD-DR for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC1DU-0003qM-54 for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:37 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:5702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1DT-0003q5-VM for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:07:36 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4GAKU/KE9FpYqr/2dsb2JhbACBX48kAQGNGD15kziTUYYZBJsZhAk X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="el'?cpio'247?scan'247,208,247";a="170056623" Received: from 69-165-138-171.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.171]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Mar 2012 00:07:33 -0400 Received: by pastel.home (Postfix, from userid 20848) id BC5A2590DD; Mon, 26 Mar 2012 00:07:32 -0400 (EDT) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: Wrong cursor positioning with display+invisible Date: Mon, 26 Mar 2012 00:07:32 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) --=-=-= Content-Type: text/plain Package: Emacs Version: 24.0.94 Extract the test.cpio and cpio-mode.el files attached, and then try: src/emacs -Q -l .../cpio-mode.el .../test.cpio First, you'll note that the cursor is displayed at end-of-line (whereas in reality point as it BOB), then move forward with C-f and you'll see the cursor jumping in odd ways (often being pushed to end-of-line even when we're still in the middle of the line). In Emacs-23, the cursor jumps correctly over the various display and invisible fields, so this is a regression. Stefan In GNU Emacs 24.0.94.1 (i386-unknown-linux-gnu, GTK+ Version 2.24.10) of 2012-03-21 on pastel Windowing system distributor `The X.Org Foundation', version 11.0.11104000 Configured using: `configure 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O0' '--with-tiff=no'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_CH.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t --=-=-= Content-Type: application/x-cpio Content-Disposition: attachment; filename=test.cpio Content-Transfer-Encoding: base64 MDcwNzAxMDAwNjhEREIwMDAwNDFFRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwQTRGNkY4MTM4MDAw MDAwMDAwMDAwMDBGRTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAwMDAwMDAuADA3 MDcwMTAwMDY4RTU4MDAwMDQxRUQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDc0RjZGODEzNzAwMDAw MDAwMDAwMDAwRkUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwODAwMDAwMDAwc2NyaXB0 cwAAAA== --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=cpio-mode.el Content-Transfer-Encoding: quoted-printable ;;; cpio-mode.el --- View/edit cpio archives ;; Copyright (C) 2012 Stefan Monnier ;; Author: Stefan Monnier ;; Keywords:=20 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;=20 ;;; Code: ;; The format supported is the "New ASCII Format" as documented in ;; http://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt. (eval-when-compile (require 'cl)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cpio\\'" . cpio-mode)) ;;;###autoload (when (boundp 'inhibit-local-variables-regexps) (add-to-list 'inhibit-local-variables-regexps "\\.cpio\\'")) ;;;###autoload (define-derived-mode cpio-mode special-mode "CPIO" "View/edit cpio archives." (add-hook 'change-major-mode-hook (lambda () (with-silent-modifications (save-restriction (widen) (remove-text-properties (point-min) (point-max) '(display nil invisible nil))= )))) (cpio--parse-buffer)) (defun cpio--parse-mode (mode) (string (case (logand #o170000 mode) (#o140000 ?s) (#o120000 ?l) (#o100000 ?-) (#o060000 ?b) (#o040000 ?d) (#o020000 ?c) (#o010000 ?p) (t error "Unknown mode %S" mode)) (if (zerop (logand #o400 mode)) ?- ?r) (if (zerop (logand #o200 mode)) ?- ?w) (if (zerop (logand #o100 mode)) (if (zerop (logand #o4000 mode)) ?- ?S) (if (zerop (logand #o4000 mode)) ?x ?s)) (if (zerop (logand #o040 mode)) ?- ?r) (if (zerop (logand #o020 mode)) ?- ?w) (if (zerop (logand #o010 mode)) (if (zerop (logand #o2000 mode)) ?- ?S) (if (zerop (logand #o2000 mode)) ?x ?s)) (if (zerop (logand #o004 mode)) ?- ?r) (if (zerop (logand #o002 mode)) ?- ?w) (if (zerop (logand #o001 mode)) ?- ?x))) =20=20=20=20=20 (defun cpio--parse-buffer () (save-excursion (save-restriction (widen) (goto-char (point-min)) (with-silent-modifications (while (not (eobp)) (assert (zerop (mod (- (point) (point-min)) 4))) (cond ((not (looking-at "07070[12]\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)\\([[:xdigi= t:]]\\{8\\}\\)\\([[:xdigit:]]\\{8\\}\\)[[:xdigit:]]\\{8\\}\\|\0+\\'")) (error "Unrecognized cpio header format")) ((not (match-beginning 1)) ;; Reached the trailing padding, just skip it. (put-text-property (point) (point-max) 'invisible t) (goto-char (match-end 0))) (t (let* ((ino (string-to-number (match-string 1) 16)) (mode (string-to-number (match-string 2) 16)) (uid (string-to-number (match-string 3) 16)) (gid (string-to-number (match-string 4) 16)) (nlink (string-to-number (match-string 5) 16)) (mtime (string-to-number (match-string 6) 16)) (filesize (string-to-number (match-string 7) 16)) (devmajor (string-to-number (match-string 8) 16)) (devminor (string-to-number (match-string 9) 16)) (rdevmajor (string-to-number (match-string 10) 16)) (rdevminor (string-to-number (match-string 11) 16)) (namesize (string-to-number (match-string 12) 16)) (namebeg (match-end 0)) (name (buffer-substring namebeg (+ namebeg namesize -1))) (filebeg (+ (match-end 0) 2 (* (/ (+ namesize 1) 4) 4))) (next (+ filebeg (* (/ (+ filesize 3) 4) 4)))) (if (and (zerop ino) (zerop mode) (zerop filesize) (equal name "TRAILER!!!")) (put-text-property (match-beginning 0) next 'display "\n") (if (bobp) (put-text-property (point) (match-end 1) 'invisible t) (put-text-property (point) (match-end 1) 'display "\n")) (put-text-property (match-beginning 2) (match-end 2) 'display (cpio--parse-mode mode)) (put-text-property (match-beginning 3) (match-end 3) 'display (format "%10d" uid)) (put-text-property (match-beginning 4) (match-end 4) 'display (format "/%-10d" gid)) (put-text-property (match-beginning 5) (match-end 6) 'invisible t) (put-text-property (match-beginning 7) (match-end 7) 'display (format "%10d " filesize)) (put-text-property (match-beginning 8) namebeg 'invisible t) (if (=3D (logand #o170000 mode) #o120000) ;Symlink (progn (put-text-property (+ namebeg namesize -1) filebeg 'display " -> ") (put-text-property (+ filebeg filesize) next 'invisible t)) (put-text-property (+ namebeg namesize -1) next 'invisible t)) (message "Parsed %S of size %d" name filesize)) (goto-char next))))))))) (provide 'cpio-mode) ;;; cpio-mode.el ends here --=-=-=-- ------------=_1333977782-692-1--