From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11094: Wrong cursor positioning with display+invisible Date: Mon, 26 Mar 2012 00:07:32 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1332734941 4906 80.91.229.3 (26 Mar 2012 04:09:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2012 04:09:01 +0000 (UTC) To: 11094@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 26 06:09:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SC1Eq-0000uR-HP for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Mar 2012 06:09:00 +0200 Original-Received: from localhost ([::1]:52923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1Ep-0007uK-S5 for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Mar 2012 00:08:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1Em-0007u4-KR for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:08:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC1Ek-0004AN-OI for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:08:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC1Ek-0004AE-Kj for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:08:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SC1ir-00084G-Qj for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2012 00:40:01 -0400 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133273675130945 (code B ref -1); Mon, 26 Mar 2012 04:40:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Mar 2012 04:39:11 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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" Original-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 Original-Received: by pastel.home (Postfix, from userid 20848) id BC5A2590DD; Mon, 26 Mar 2012 00:07:32 -0400 (EDT) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:58152 Archived-At: --=-=-= 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 --=-=-=--