all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#1730: 23.0.60; line-move-visual doesn't forget
@ 2008-12-29 22:55 Lennart Borgman (gmail)
  2008-12-30  0:13 ` Lennart Borgman
  0 siblings, 1 reply; 2+ messages in thread
From: Lennart Borgman (gmail) @ 2008-12-29 22:55 UTC (permalink / raw)
  To: emacs-pretest-bug

It looks like line-move-visual keeps remember too much about which
column it was in. To show that start from

  emacs -Q

and eval this code

(defun ourcomments-move-beginning-of-line(arg)
  "Move point to beginning of line or indentation.
See `beginning-of-line' for ARG.

If `line-move-visual' is on then the visual line beginning is
first tried."
  (interactive "p")
  (let ((pos (point))
        vis-pos)
    (when line-move-visual
      (line-move-visual -1 t)
      (beginning-of-line)
      (setq vis-pos (point))
      (goto-char pos))
    (call-interactively 'beginning-of-line arg)
    (when (and vis-pos
               (= vis-pos (point)))
      (while (and (> pos (point))
                  (not (eobp)))
        (line-move-visual 1 t))
      (line-move-visual -1 t))
    (when (= pos (point))
      (if (= 0 (current-column))
          (skip-chars-forward " \t")
        (backward-char)
        (beginning-of-line)))))

(global-set-key [home] 'ourcomments-move-beginning-of-line)

The function is supposed to go to the beginning of the visual line
first. This fails sometimes, see below.

- Shrink the window width so that some lines wrap.
- Go to a wrapped buffer line, to the first visual line of it.
- Move forward some columns on that line.
- Move down to next visual line (arrow down). You should still be on the
same buffer line.
- Press HOME.

Point should now be on the beginning on the visual line where you
pressed HOME. However it is on the line above instead, on the column you
were before you pressed arrow down.

Now do exactly the same except:

- Before pressing HOME press arrow left followed by arrow right.

Now after pressing HOME you should be on the beginning of the visual
line as expected.


In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-12-25
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'







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

* bug#1730: 23.0.60; line-move-visual doesn't forget
  2008-12-29 22:55 bug#1730: 23.0.60; line-move-visual doesn't forget Lennart Borgman (gmail)
@ 2008-12-30  0:13 ` Lennart Borgman
  0 siblings, 0 replies; 2+ messages in thread
From: Lennart Borgman @ 2008-12-30  0:13 UTC (permalink / raw)
  To: emacs-pretest-bug

On Mon, Dec 29, 2008 at 11:55 PM, Lennart Borgman (gmail)
<lennart.borgman@gmail.com> wrote:
> It looks like line-move-visual keeps remember too much about which
> column it was in. To show that start from
>
>  emacs -Q
>
> and eval this code
>
> (defun ourcomments-move-beginning-of-line(arg)
>  "Move point to beginning of line or indentation.
> See `beginning-of-line' for ARG.
>
> If `line-move-visual' is on then the visual line beginning is
> first tried."
>  (interactive "p")
>  (let ((pos (point))
>        vis-pos)
>    (when line-move-visual
>      (line-move-visual -1 t)
>      (beginning-of-line)
>      (setq vis-pos (point))
>      (goto-char pos))
>    (call-interactively 'beginning-of-line arg)
>    (when (and vis-pos
>               (= vis-pos (point)))
>      (while (and (> pos (point))
>                  (not (eobp)))

Looking at the code I see that this can be taken care of by replacing
the line below with

   (let (last-command)
      (line-move-visual 1 t )))

So ... this is not a bug. Just unintended use.

>        (line-move-visual 1 t))
>      (line-move-visual -1 t))
>    (when (= pos (point))
>      (if (= 0 (current-column))
>          (skip-chars-forward " \t")
>        (backward-char)
>        (beginning-of-line)))))
>
> (global-set-key [home] 'ourcomments-move-beginning-of-line)
>
> The function is supposed to go to the beginning of the visual line
> first. This fails sometimes, see below.
>
> - Shrink the window width so that some lines wrap.
> - Go to a wrapped buffer line, to the first visual line of it.
> - Move forward some columns on that line.
> - Move down to next visual line (arrow down). You should still be on the
> same buffer line.
> - Press HOME.
>
> Point should now be on the beginning on the visual line where you
> pressed HOME. However it is on the line above instead, on the column you
> were before you pressed arrow down.
>
> Now do exactly the same except:
>
> - Before pressing HOME press arrow left followed by arrow right.
>
> Now after pressing HOME you should be on the beginning of the visual
> line as expected.
>
>
> In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
>  of 2008-12-25
> Windowing system distributor `Microsoft Corp.', version 5.1.2600
> configured using `configure --with-gcc (3.4) --no-opt --cflags
> -Ic:/g/include -fno-crossjumping'
>
>
>
>
>
>






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

end of thread, other threads:[~2008-12-30  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-29 22:55 bug#1730: 23.0.60; line-move-visual doesn't forget Lennart Borgman (gmail)
2008-12-30  0:13 ` Lennart Borgman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.