From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: last character on line different when behind invis text? Date: Sat, 07 Sep 2002 06:29:08 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: References: <86bs7scq7v.fsf@mobile.repose.cx> <200208260036.g7Q0aO912379@wijiji.santafe.edu> <87ofbq5hke.fsf@free.net.ph> <86k7meb2jq.fsf@mobile.repose.cx> <86admvdt1d.fsf@mobile.repose.cx> Reply-To: rms@gnu.org NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1031396103 31330 127.0.0.1 (7 Sep 2002 10:55:03 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 7 Sep 2002 10:55:03 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17ndEy-00088o-00 for ; Sat, 07 Sep 2002 12:55:00 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17ndnu-0005X7-00 for ; Sat, 07 Sep 2002 13:31:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17ndEx-0000Tw-00; Sat, 07 Sep 2002 06:54:59 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17ndD7-0000KP-00 for emacs-devel@gnu.org; Sat, 07 Sep 2002 06:53:05 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17ncq9-0005LF-00 for emacs-devel@gnu.org; Sat, 07 Sep 2002 06:29:28 -0400 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17ncq8-0005Ku-00 for emacs-devel@gnu.org; Sat, 07 Sep 2002 06:29:20 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.10) id 17ncpw-00087B-00; Sat, 07 Sep 2002 06:29:08 -0400 Original-To: resolve@repose.cx In-Reply-To: <86admvdt1d.fsf@mobile.repose.cx> (message from Damien Elmes on Sat, 07 Sep 2002 01:41:50 +1000) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:7676 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:7676 Please try this replacement function. The code does what the doc strings says. Whether that makes for correct behavior I am not sure. (defun forward-visible-line (arg) "Move forward by ARG lines, ignoring currently invisible newlines only. If ARG is negative, move backward -ARG lines. If ARG is zero, move to the beginning of the current line." (condition-case nil (if (> arg 0) (progn (while (> arg 0) (or (zerop (forward-line 1)) (signal 'end-of-buffer nil)) ;; If the newline we just skipped is invisible, ;; don't count it. (let ((prop (get-char-property (1- (point)) 'invisible))) (if (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))) (setq arg (1+ arg)))) (setq arg (1- arg))) ;; If invisible text follows, and it is a number of complete lines, ;; skip it. (let ((opoint (point))) (while (and (not (eobp)) (let ((prop (get-char-property (point) 'invisible))) (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))))) (goto-char (if (get-text-property (point) 'invisible) (or (next-single-property-change (point) 'invisible) (point-max)) (next-overlay-change (point))))) (unless (bolp) (goto-char opoint)))) (let ((first t)) (while (or first (< arg 0)) (if (zerop arg) (beginning-of-line) (or (zerop (forward-line -1)) (signal 'beginning-of-buffer nil))) ;; If the newline we just moved to is invisible, ;; don't count it. (unless (bobp) (let ((prop (get-char-property (1- (point)) 'invisible))) (if (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))) (setq arg (1+ arg))))) (setq first nil) (setq arg (1+ arg))) ;; If invisible text follows, and it is a number of complete lines, ;; skip it. (let ((opoint (point))) (while (and (not (bobp)) (let ((prop (get-char-property (1- (point)) 'invisible))) (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))))) (goto-char (if (get-text-property (1- (point)) 'invisible) (or (previous-single-property-change (point) 'invisible) (point-min)) (previous-overlay-change (point))))) (unless (bolp) (goto-char opoint))))) ((beginning-of-buffer end-of-buffer) nil)))