unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* line-move-finish (simple.el) hangs on invisible&intangible text.
@ 2002-04-17 14:48 Juanma Barranquero
  2002-04-18 18:44 ` Richard Stallman
  0 siblings, 1 reply; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-17 14:48 UTC (permalink / raw)


emacs -q --no-site-file
C-h i
Move cursor to the first non-empty line after the title ("  The Info
Directory", etc.)
Move cursor to column 1 (or more).
<up>

Emacs endlessly loops on line-move-finish (C-g breaks from it).

If you put the cursor at the beginning of the "empty" line (it contains
a row of intangible, invisible asterisks), and eval the expression

(move-to-column 0)

the cursor moves to the first char of the next line ?!


                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-17 14:48 line-move-finish (simple.el) hangs on invisible&intangible text Juanma Barranquero
@ 2002-04-18 18:44 ` Richard Stallman
  2002-04-19  8:46   ` Juanma Barranquero
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2002-04-18 18:44 UTC (permalink / raw)
  Cc: emacs-devel

What version of Emacs are you using?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-18 18:44 ` Richard Stallman
@ 2002-04-19  8:46   ` Juanma Barranquero
  2002-04-19  9:59     ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-19  8:46 UTC (permalink / raw)
  Cc: emacs-devel


On Thu, 18 Apr 2002 12:44:53 -0600 (MDT), Richard Stallman <rms@gnu.org> wrote:

> What version of Emacs are you using?

21.2.50, straight from the CVS HEAD. Compiled on Windows XP with Visual
Studio.

On my machine/configuration the problem is perfectly repeatable. I put
the cursor on the first non-title line of any Info page, move the cursor
to a column > 0, do <up> to go to the empty line between the title and
the page text (which is not really empty, because it has
invisible&intangible text), and Emacs loops forever on line-move-finish.

Tracing the function, the problem seems to be that move-to-column moves
the cursor to the next line.

                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19  8:46   ` Juanma Barranquero
@ 2002-04-19  9:59     ` Eli Zaretskii
  2002-04-19 10:32       ` Juanma Barranquero
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-19  9:59 UTC (permalink / raw)
  Cc: rms, emacs-devel

> From: Juanma Barranquero <lektu@terra.es>
> Date: Fri, 19 Apr 2002 10:46:15 +0200
> 
> > What version of Emacs are you using?
> 
> 21.2.50, straight from the CVS HEAD. Compiled on Windows XP with Visual
> Studio.
> 
> On my machine/configuration the problem is perfectly repeatable. I put
> the cursor on the first non-title line of any Info page, move the cursor
> to a column > 0, do <up> to go to the empty line between the title and
> the page text (which is not really empty, because it has
> invisible&intangible text), and Emacs loops forever on line-move-finish.

Does it happen in "emacs -nw"?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19  9:59     ` Eli Zaretskii
@ 2002-04-19 10:32       ` Juanma Barranquero
  2002-04-19 13:06         ` Eli Zaretskii
  2002-04-20 11:50         ` Eli Zaretskii
  0 siblings, 2 replies; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-19 10:32 UTC (permalink / raw)
  Cc: rms, emacs-devel


On Fri, 19 Apr 2002 12:59:28 +0300, "Eli Zaretskii" <eliz@is.elta.co.il> wrote:

> Does it happen in "emacs -nw"?

In -nw mode the line of rows below the Info title is visible and
tangible. If I toggle read-only and then manually make the line to be
i&i, then yes, it happens too.

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?


                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 10:32       ` Juanma Barranquero
@ 2002-04-19 13:06         ` Eli Zaretskii
  2002-04-19 13:40           ` Juanma Barranquero
  2002-04-20 11:50         ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-19 13:06 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Date: Fri, 19 Apr 2002 12:32:15 +0200
> From: Juanma Barranquero <lektu@terra.es>
> 
> > Does it happen in "emacs -nw"?
> 
> In -nw mode the line of rows below the Info title is visible and
> tangible. If I toggle read-only and then manually make the line to be
> i&i, then yes, it happens too.

I seem to be unable to reproduce this on a tty.  I suspect that I'm
not doing something exactly like you do.  Could you please post an
exact recipe, starting with "emacs -q -nw"?  In particular, please
identify precisely what line do you put the cursor on, preferably
starting with "M-<" or something similarly unambiguous and moving with
C-n or C-p.

TIA

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 13:06         ` Eli Zaretskii
@ 2002-04-19 13:40           ` Juanma Barranquero
  2002-04-19 14:32             ` Eli Zaretskii
  2002-04-19 15:04             ` Robert J. Chassell
  0 siblings, 2 replies; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-19 13:40 UTC (permalink / raw)
  Cc: rms, emacs-devel


On Fri, 19 Apr 2002 09:06:46 -0400, Eli Zaretskii <eliz@fencepost.gnu.org> wrote:

> Could you please post an
> exact recipe, starting with "emacs -q -nw"?  In particular, please
> identify precisely what line do you put the cursor on, preferably
> starting with "M-<" or something similarly unambiguous and moving with
> C-n or C-p.

I'm doing exactly what I've said in two previous messages, no more, no
less. After

   emacs -q --no-site-file -nw

from view-lossage:

C-h i C-x C-q <down> <down> C-SPC <down> <f10> e t s I <up> C-SPC <down>
<f10> e t s i <down> <right>

Now I do:

<up>

and Emacs hangs. In fact, in -nw mode C-g does not break it out of the
loop and I have to forcefully close the console window.

Without -nw the recipe is the same, except that it is not necessary to
set text to invisible & intangible. Just

  C-h i <down> <down> <down> <right> <up> 

is enough.


                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 13:40           ` Juanma Barranquero
@ 2002-04-19 14:32             ` Eli Zaretskii
  2002-04-19 14:49               ` Juanma Barranquero
  2002-04-19 15:04             ` Robert J. Chassell
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-19 14:32 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Date: Fri, 19 Apr 2002 15:40:26 +0200
> From: Juanma Barranquero <lektu@terra.es>
> 
> C-h i C-x C-q <down> <down> C-SPC <down> <f10> e t s I <up> C-SPC <down>
> <f10> e t s i <down> <right>
> 
> Now I do:
> 
> <up>
> 
> and Emacs hangs.

Thanks, I see it now, at least in the MS-DOS version.  Curiously, in
a Unix tty Emacs doesn't hang.

> In fact, in -nw mode C-g does not break it out of the
> loop and I have to forcefully close the console window.

I suspect that's because C-g doesn't produce a signal on Windows.  I
can get the MS-DOS version out of the infloop with C-BREAK, which in
that version of Emacs does produce a signal that interrupts any code
(except for very tight loops and system calls).

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 14:32             ` Eli Zaretskii
@ 2002-04-19 14:49               ` Juanma Barranquero
  0 siblings, 0 replies; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-19 14:49 UTC (permalink / raw)
  Cc: rms, emacs-devel


On Fri, 19 Apr 2002 10:32:33 -0400, Eli Zaretskii <eliz@fencepost.gnu.org> wrote:

> Thanks, I see it now, at least in the MS-DOS version.

Pheew! I was starting to think it only happened to me.

> Curiously, in
> a Unix tty Emacs doesn't hang.

Have you tried to put the cursor in the first column of the line and
eval (beginning-of-line) and (move-to-column 0) to see if they act different?


                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 13:40           ` Juanma Barranquero
  2002-04-19 14:32             ` Eli Zaretskii
@ 2002-04-19 15:04             ` Robert J. Chassell
  1 sibling, 0 replies; 18+ messages in thread
From: Robert J. Chassell @ 2002-04-19 15:04 UTC (permalink / raw)
  Cc: emacs-devel

Run:

       emacs -q --no-site-file -nw

    from view-lossage:

    C-h i C-x C-q <down> <down> C-SPC <down> <f10> e t s I <up> C-SPC <down>
    <f10> e t s i <down> <right>

    Now I do:

    <up>

    and Emacs hangs. 

I cannot reproduce this error with:

    GNU Emacs 21.2.50.105 (i686-pc-linux-gnu, X toolkit) of 2002-04-18
    in an xterm
    under TWM 
    on a Debian GNU `testing' distribution
    running the Linux 2.4.18 kernel

-- 
    Robert J. Chassell                  bob@rattlesnake.com
    Rattlesnake Enterprises             http://www.rattlesnake.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
@ 2002-04-19 16:08 Christoph Conrad
  0 siblings, 0 replies; 18+ messages in thread
From: Christoph Conrad @ 2002-04-19 16:08 UTC (permalink / raw)
  Cc: Eli Zaretskii, bob

Hi Robert,

    > Run:
    >        emacs -q --no-site-file -nw

    >     [...]

I can reproduce this on Windows NT with the CVS version from
2002-04-18.

Best regards,
Christoph Conrad
-- 
Dipl.-Ing. Christoph Conrad
Senior-Systementwickler "Zentrale Software"
IVU Traffic Technologies AG
Elisabethstr. 16, 52062 Aachen
Telefon: +49.241.4 70 51-0, Telefax: +49.241.4 70 51-89
mailto:Christoph.Conrad@ivu-ac.de, http://www.ivu.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-19 10:32       ` Juanma Barranquero
  2002-04-19 13:06         ` Eli Zaretskii
@ 2002-04-20 11:50         ` Eli Zaretskii
  2002-04-21  1:32           ` Juanma Barranquero
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-20 11:50 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Date: Fri, 19 Apr 2002 12:32:15 +0200
> From: Juanma Barranquero <lektu@terra.es>
> 
> 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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-20 11:50         ` Eli Zaretskii
@ 2002-04-21  1:32           ` Juanma Barranquero
  2002-04-21  6:06             ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-21  1:32 UTC (permalink / raw)
  Cc: rms, emacs-devel


On Sat, 20 Apr 2002 07:50:39 -0400
Eli Zaretskii <eliz@fencepost.gnu.org> wrote:

> 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.

Thanks, I´ll test it on monday.

> 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.

That´s the reason I didn´t try to fix the bug. But I think it should be
fixed on the C level, as it seem the current behavior of Fmove_to_column
is not correct wrt to lines with no visible/tangible chars.

-- 
Juanma Barranquero <lektu@terra.es>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-21  1:32           ` Juanma Barranquero
@ 2002-04-21  6:06             ` Eli Zaretskii
  2002-04-21 17:05               ` Juanma Barranquero
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-21  6:06 UTC (permalink / raw)
  Cc: rms, emacs-devel


On Sat, 20 Apr 2002, Juanma Barranquero wrote:

> it seems the current behavior of Fmove_to_column
> is not correct wrt to lines with no visible/tangible chars.

It's not clear to me that move-to-column behaves incorrectly.  AFAIU, it 
tries to place point outside a run of characters with intangible property.
That's what I'd expect it to do.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-21 17:05               ` Juanma Barranquero
@ 2002-04-21 15:19                 ` Eli Zaretskii
  2002-04-22  7:47                 ` Richard Stallman
  1 sibling, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2002-04-21 15:19 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Date: Sun, 21 Apr 2002 14:05:05 -0300
> From: Juanma Barranquero <lektu@terra.es>
> 
> According to specs, if asked to move the cursor to a row greater than
> the number of visible rows in the line, it should put it on the last
> character of the line.

Yes, but in the case in point, the newline at the end of theline also
had the invisible and intangible properties.  Remember, you marked
that line with the sequence "C-SPC <down>", then put the properties on
it.  Thus the region includes the newline, and the first character
outside the intangible region is column zero of the next line.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-21  6:06             ` Eli Zaretskii
@ 2002-04-21 17:05               ` Juanma Barranquero
  2002-04-21 15:19                 ` Eli Zaretskii
  2002-04-22  7:47                 ` Richard Stallman
  0 siblings, 2 replies; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-21 17:05 UTC (permalink / raw)
  Cc: rms, emacs-devel


> It's not clear to me that move-to-column behaves incorrectly.  AFAIU, it 
> tries to place point outside a run of characters with intangible property.
> That's what I'd expect it to do.

According to specs, if asked to move the cursor to a row greater than
the number of visible rows in the line, it should put it on the last
character of the line. I fail to see how puting the cursor on the next
line can be a sensible behavior for a function called move-to-column :)


-- 
Juanma Barranquero <lektu@terra.es>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-21 17:05               ` Juanma Barranquero
  2002-04-21 15:19                 ` Eli Zaretskii
@ 2002-04-22  7:47                 ` Richard Stallman
  2002-04-22 10:09                   ` Juanma Barranquero
  1 sibling, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2002-04-22  7:47 UTC (permalink / raw)
  Cc: eliz, emacs-devel

    According to specs, if asked to move the cursor to a row greater than
    the number of visible rows in the line, it should put it on the last
    character of the line. I fail to see how puting the cursor on the next
    line can be a sensible behavior for a function called move-to-column :)

If the last character of the line and the newline are both intangible,
it can't put point there.  What do you think it should do instead?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: line-move-finish (simple.el) hangs on invisible&intangible text.
  2002-04-22  7:47                 ` Richard Stallman
@ 2002-04-22 10:09                   ` Juanma Barranquero
  0 siblings, 0 replies; 18+ messages in thread
From: Juanma Barranquero @ 2002-04-22 10:09 UTC (permalink / raw)
  Cc: eliz, emacs-devel


On Mon, 22 Apr 2002 01:47:34 -0600 (MDT), Richard Stallman <rms@gnu.org> wrote:

> If the last character of the line and the newline are both intangible,
> it can't put point there.  What do you think it should do instead?

My gut feeling is that cursor should move to the last visible/tangible
char on the line, or to the beginning of line otherwise.

But I agree with Eli: invisible/intangible text is very non-intuitive, and
different commands are doing different things.


                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2002-04-22 10:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-17 14:48 line-move-finish (simple.el) hangs on invisible&intangible text Juanma Barranquero
2002-04-18 18:44 ` Richard Stallman
2002-04-19  8:46   ` Juanma Barranquero
2002-04-19  9:59     ` Eli Zaretskii
2002-04-19 10:32       ` Juanma Barranquero
2002-04-19 13:06         ` Eli Zaretskii
2002-04-19 13:40           ` Juanma Barranquero
2002-04-19 14:32             ` Eli Zaretskii
2002-04-19 14:49               ` Juanma Barranquero
2002-04-19 15:04             ` Robert J. Chassell
2002-04-20 11:50         ` Eli Zaretskii
2002-04-21  1:32           ` Juanma Barranquero
2002-04-21  6:06             ` Eli Zaretskii
2002-04-21 17:05               ` Juanma Barranquero
2002-04-21 15:19                 ` Eli Zaretskii
2002-04-22  7:47                 ` Richard Stallman
2002-04-22 10:09                   ` Juanma Barranquero
  -- strict thread matches above, loose matches on Subject: below --
2002-04-19 16:08 Christoph Conrad

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).