[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: line-move-finish (simple.el) hangs on invisible&intangible text.
From: |
Eli Zaretskii |
Subject: |
Re: line-move-finish (simple.el) hangs on invisible&intangible text. |
Date: |
Sat, 20 Apr 2002 07:50:39 -0400 |
> Date: Fri, 19 Apr 2002 12:32:15 +0200
> From: Juanma Barranquero <address@hidden>
>
> 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.
- line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/17
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Richard Stallman, 2002/04/18
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Eli Zaretskii, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Eli Zaretskii, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Eli Zaretskii, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Robert J. Chassell, 2002/04/19
- Re: line-move-finish (simple.el) hangs on invisible&intangible text.,
Eli Zaretskii <=
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/20
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Eli Zaretskii, 2002/04/21
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/21
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Eli Zaretskii, 2002/04/21
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Richard Stallman, 2002/04/22
- Re: line-move-finish (simple.el) hangs on invisible&intangible text., Juanma Barranquero, 2002/04/22