From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: bug in forward-visible-line: Patch Date: Wed, 21 May 2003 23:43:04 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305220443.h4M4h4w10124@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1053578793 21754 80.91.224.249 (22 May 2003 04:46:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 22 May 2003 04:46:33 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 22 06:46:31 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19IhyJ-0005eh-00 for ; Thu, 22 May 2003 06:46:31 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Ii9K-0007wl-00 for ; Thu, 22 May 2003 06:57:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Ihxm-0007Dz-Lc for emacs-devel@quimby.gnus.org; Thu, 22 May 2003 00:45:58 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19IhxM-000795-WD for emacs-devel@gnu.org; Thu, 22 May 2003 00:45:32 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Ihwq-0006oQ-28 for emacs-devel@gnu.org; Thu, 22 May 2003 00:45:32 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Ihv7-0006Si-1f for emacs-devel@gnu.org; Thu, 22 May 2003 00:43:13 -0400 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) by manatee.dms.auburn.edu (8.12.9/8.12.9) with ESMTP id h4M4hBoc008087 for ; Wed, 21 May 2003 23:43:11 -0500 (CDT) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.11.6+Sun/8.11.6) id h4M4h4w10124; Wed, 21 May 2003 23:43:04 -0500 (CDT) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14077 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14077 Start out with the following buffer: line 1;line 2 line 3;line 4 line 5 Where, after each ";" there is an invisible newline. With point at the beginning of the buffer, do M-: (forward-visible-line arg) for various args. 1 carries us to the beginning of line 3 and 2 to the beginning of line 5 (as I expected). Now put point at the end of line 4. There 0 carries us to the beginning of line 4, -1 to the beginning of line 3, -2 to the beginning of line 2 and -3 carries us also to the beginning of line 2. Makes no sense. The following patch seems to fix the problem: Change log: 2003-05-21 Luc Teirlinck * simple.el (forward-visible-line): Fix negative arguments. Patch: ===File ~/simplediff======================================== cd /usr/local/share/emacs/21.3.50/lisp/ diff -c /usr/local/share/emacs/21.3.50/lisp/simple.old.el /usr/local/share/emacs/21.3.50/lisp/simple.el *** /usr/local/share/emacs/21.3.50/lisp/simple.old.el Wed May 21 18:33:45 2003 --- /usr/local/share/emacs/21.3.50/lisp/simple.el Wed May 21 23:13:01 2003 *************** *** 2265,2272 **** (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))) --- 2265,2272 ---- (unless (bolp) (goto-char opoint)))) (let ((first t)) ! (while (or first (<= arg 0)) ! (if first (beginning-of-line) (or (zerop (forward-line -1)) (signal 'beginning-of-buffer nil))) *************** *** 2275,2287 **** (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))) --- 2275,2286 ---- (unless (bobp) (let ((prop (get-char-property (1- (point)) 'invisible))) ! (unless (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)) ;; If invisible text follows, and it is a number of complete lines, ;; skip it. (let ((opoint (point))) Diff finished at Wed May 21 23:13:27 ============================================================