From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: line-move-finish (simple.el) hangs on invisible&intangible text. Date: Sat, 20 Apr 2002 07:50:39 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: References: <20020419104107.1A85.LEKTU@terra.es> <5080-Fri19Apr2002125927+0300-eliz@is.elta.co.il> <20020419122441.1A89.LEKTU@terra.es> Reply-To: Eli Zaretskii NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1019303489 4724 127.0.0.1 (20 Apr 2002 11:51:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 20 Apr 2002 11:51:29 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16ytOq-0001E5-00 for ; Sat, 20 Apr 2002 13:51:28 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16ytif-0004eV-00 for ; Sat, 20 Apr 2002 14:11:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ytOd-0006Kj-00; Sat, 20 Apr 2002 07:51:15 -0400 Original-Received: from eliz by fencepost.gnu.org with local (Exim 3.34 #1 (Debian)) id 16ytO3-0006CA-00; Sat, 20 Apr 2002 07:50:39 -0400 Original-To: lektu@terra.es In-Reply-To: <20020419122441.1A89.LEKTU@terra.es> (message from Juanma Barranquero on Fri, 19 Apr 2002 12:32:15 +0200) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2829 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2829 > Date: Fri, 19 Apr 2002 12:32:15 +0200 > From: Juanma Barranquero > > line-move-finish calls line-move-to-column to set the cursor to the > desired column, and that function does: > > (if (zerop col) > (beginning-of-line) > (move-to-column col)) > > That's why it works from column 0 and not others. In my system, puting > the cursor at the beginning of a line that only contains i&i characters > and evaling > > (beginning-of-line) > > does not move the cursor, while evaling > > (move-to-column 0) > > moves it. Doesn't that happen on your system? Yes, it does. The following tentative change (not installed) detects a possible infloop and breaks out of it with the last good position it found, hopefully without breaking anything else. I will install this if people who understand more than I do the intricacies of the invisible and intangible properties take a good look at the patch and approve it. Index: lisp/simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.537 diff -c -r1.537 simple.el *** lisp/simple.el 19 Apr 2002 00:05:22 -0000 1.537 --- lisp/simple.el 20 Apr 2002 11:32:46 -0000 *************** *** 2633,2676 **** nil) (defun line-move-finish (column opoint) ! (let ((repeat t)) (while repeat ;; Set REPEAT to t to repeat the whole thing. (setq repeat nil) ;; Move to the desired column. (line-move-to-column column) ! ! (let ((new (point)) ! (line-beg (save-excursion (beginning-of-line) (point))) ! (line-end (save-excursion (end-of-line) (point)))) ! ! ;; Process intangibility within a line. ! ;; Move to the chosen destination position from above, ! ;; with intangibility processing enabled. ! ! (goto-char (point-min)) ! (let ((inhibit-point-motion-hooks nil)) ! (goto-char new) ! ! ;; If intangibility moves us to a different (later) place ! ;; in the same line, use that as the destination. ! (if (<= (point) line-end) ! (setq new (point)))) ! ! ;; Now move to the updated destination, processing fields ! ;; as well as intangibility. ! (goto-char opoint) ! (let ((inhibit-point-motion-hooks nil)) ! (goto-char ! (constrain-to-field new opoint nil t ! 'inhibit-line-move-field-capture))) ! ! ;; If intangibility processing moved us to a different line, ! ;; retry everything within that new line. ! (when (or (< (point) line-beg) (> (point) line-end)) ! ;; Repeat the intangibility and field processing. ! (setq repeat t)))))) (defun line-move-to-column (col) "Try to find column COL, considering invisibility. --- 2633,2681 ---- nil) (defun line-move-finish (column opoint) ! (let ((repeat t) ! (prev-new -1) ! last-good-point) (while repeat ;; Set REPEAT to t to repeat the whole thing. (setq repeat nil) ;; Move to the desired column. + (setq last-good-point (point)) (line-move-to-column column) ! (if (= (point) prev-new) ! (goto-char last-good-point) ! (let ((new (point)) ! (line-beg (save-excursion (beginning-of-line) (point))) ! (line-end (save-excursion (end-of-line) (point)))) ! ! (setq prev-new new) ! ;; Process intangibility within a line. ! ;; Move to the chosen destination position from above, ! ;; with intangibility processing enabled. ! ! (goto-char (point-min)) ! (let ((inhibit-point-motion-hooks nil)) ! (goto-char new) ! ! ;; If intangibility moves us to a different (later) place ! ;; in the same line, use that as the destination. ! (if (<= (point) line-end) ! (setq new (point)))) ! ! ;; Now move to the updated destination, processing fields ! ;; as well as intangibility. ! (goto-char opoint) ! (let ((inhibit-point-motion-hooks nil)) ! (goto-char ! (constrain-to-field new opoint nil t ! 'inhibit-line-move-field-capture))) ! ! ;; If intangibility processing moved us to a different line, ! ;; retry everything within that new line. ! (when (or (< (point) line-beg) (> (point) line-end)) ! ;; Repeat the intangibility and field processing. ! (setq repeat t))))))) (defun line-move-to-column (col) "Try to find column COL, considering invisibility.