From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Miles Bader <miles@gnu.org>
Cc: David Reitter <david.reitter@gmail.com>,
Chong Yidong <cyd@stupidchicken.com>,
"Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>,
Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: visual-line-mode
Date: Sun, 29 Jun 2008 10:01:22 -0400 [thread overview]
Message-ID: <jwvzlp4fio7.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87zlp4raab.fsf@catnip.gol.com> (Miles Bader's message of "Sun, 29 Jun 2008 16:05:16 +0900")
> I expect emacs primitives will need improvement to work for the
> word-wrapping case (and display-time line-prefixes which I've hacked up
> locally), so perhaps they can be improved to work better in general too.
After looking a bit more at the various visual line movement packages,
and remembering that I've just added a `cols' arg to vertical-motion,
I believe the patch below provides basically the behavior we want.
As it turns out, it doesn't work right with word-wrapping because
posn-at-point returns funny X positions. Probably the same underlying
bug causes sometimes mouse-clicks to place point elsewhere than under
the mouse.
Stefan
=== modified file 'lisp/simple.el'
--- lisp/simple.el 2008-06-21 02:48:08 +0000
+++ lisp/simple.el 2008-06-29 13:36:08 +0000
@@ -4030,6 +4030,16 @@
(t
(set-window-vscroll nil (frame-char-height) t)))))))
+(defvar line-move-visual t)
+
+(defun line-move-visual (arg)
+ (unless (and (floatp temporary-goal-column)
+ (or (memq last-command '(next-line previous-line))
+ ;; In case we're called from some other command.
+ (eq last-command this-command)))
+ (setq temporary-goal-column
+ (/ (car (nth 2 (posn-at-point))) 1.0 (frame-char-width))))
+ (vertical-motion (cons (truncate temporary-goal-column) arg)))
;; This is like line-move-1 except that it also performs
;; vertical scrolling of tall images if appropriate.
@@ -4046,7 +4056,9 @@
(not executing-kbd-macro)
(line-move-partial arg noerror to-end))
(set-window-vscroll nil 0 t)
- (line-move-1 arg noerror to-end)))
+ (if line-move-visual
+ (line-move-visual arg)
+ (line-move-1 arg noerror to-end))))
;; This is the guts of next-line and previous-line.
;; Arg says how many lines to move.
next prev parent reply other threads:[~2008-06-29 14:01 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 6:30 visual-line-mode David Reitter
2008-06-29 7:05 ` visual-line-mode Miles Bader
2008-06-29 7:19 ` visual-line-mode Miles Bader
2008-06-29 14:01 ` Stefan Monnier [this message]
2008-06-29 15:29 ` visual-line-mode Chong Yidong
2008-06-30 3:07 ` visual-line-mode Miles Bader
2008-06-30 3:15 ` visual-line-mode Chong Yidong
2008-06-30 5:13 ` visual-line-mode Miles Bader
2008-06-30 5:15 ` visual-line-mode Miles Bader
2008-06-30 10:39 ` visual-line-mode Miles Bader
2008-06-30 11:20 ` visual-line-mode Miles Bader
2008-06-30 14:01 ` visual-line-mode Chong Yidong
2008-06-30 16:10 ` visual-line-mode Chong Yidong
2008-07-01 9:10 ` visual-line-mode David Reitter
2008-07-03 19:20 ` visual-line-mode Chong Yidong
2008-07-03 23:56 ` visual-line-mode David Reitter
2008-07-04 10:23 ` visual-line-mode Chong Yidong
2008-07-04 10:58 ` visual-line-mode Miles Bader
2008-07-04 13:04 ` visual-line-mode Chong Yidong
2008-07-04 15:04 ` visual-line-mode David Reitter
2008-07-04 15:49 ` visual-line-mode Stefan Monnier
2008-07-04 16:21 ` visual-line-mode David Reitter
2008-07-05 18:41 ` visual-line-mode Chong Yidong
2008-07-06 1:29 ` visual-line-mode Miles Bader
2008-07-09 14:28 ` visual-line-mode David Reitter
2008-07-10 3:05 ` visual-line-mode Chong Yidong
2008-07-10 12:39 ` visual-line-mode David Reitter
2008-07-10 13:55 ` visual-line-mode Chong Yidong
2008-08-03 13:47 ` visual-line-mode David Reitter
2008-08-11 13:38 ` word-wrap in echo area (was Re: visual-line-mode) David Reitter
2008-08-11 16:03 ` word-wrap in echo area Chong Yidong
2008-07-10 16:37 ` visual-line-mode Chong Yidong
2008-07-10 17:32 ` visual-line-mode Miles Bader
2008-07-10 17:40 ` visual-line-mode Miles Bader
2008-07-10 20:23 ` visual-line-mode Stefan Monnier
2008-07-10 23:23 ` visual-line-mode Chong Yidong
2008-07-10 23:44 ` visual-line-mode Miles Bader
2008-07-10 23:49 ` visual-line-mode Chong Yidong
2008-07-11 13:10 ` visual-line-mode David Reitter
2008-07-14 3:58 ` visual-line-mode Miles Bader
2008-07-14 3:59 ` visual-line-mode Miles Bader
2008-07-11 1:36 ` visual-line-mode Stefan Monnier
2008-07-11 2:30 ` visual-line-mode Miles Bader
2008-07-11 4:36 ` visual-line-mode Chong Yidong
2008-07-11 14:56 ` visual-line-mode David Reitter
2008-07-11 15:57 ` visual-line-mode Chong Yidong
2008-07-11 18:27 ` visual-line-mode Chong Yidong
2008-07-11 20:36 ` visual-line-mode Miles Bader
2008-07-11 21:18 ` visual-line-mode Stefan Monnier
2008-07-11 21:23 ` visual-line-mode David Kastrup
2008-07-11 21:41 ` visual-line-mode David Reitter
2008-07-12 1:49 ` visual-line-mode Stefan Monnier
2008-07-12 8:09 ` visual-line-mode David Kastrup
2008-07-12 16:35 ` visual-line-mode Richard M Stallman
2008-07-12 17:42 ` visual-line-mode Chong Yidong
2008-07-16 4:21 ` visual-line-mode Chong Yidong
2008-07-16 4:37 ` visual-line-mode Miles Bader
2008-07-11 21:10 ` visual-line-mode Chong Yidong
2008-07-12 1:43 ` visual-line-mode Stefan Monnier
2008-07-10 18:08 ` visual-line-mode David Reitter
2008-07-10 23:18 ` visual-line-mode Miles Bader
2008-07-10 23:35 ` visual-line-mode Chong Yidong
2008-07-10 23:49 ` visual-line-mode Chong Yidong
2008-07-09 14:31 ` visual-line-mode David Reitter
2008-07-04 11:09 ` visual-line-mode David Reitter
2008-07-04 12:39 ` visual-line-mode Paul R
2008-06-30 7:32 ` visual-line-mode David Reitter
2008-06-30 7:43 ` visual-line-mode Miles Bader
2008-06-30 7:58 ` visual-line-mode David Reitter
2008-06-30 8:05 ` visual-line-mode Miles Bader
2008-06-30 8:25 ` visual-line-mode David Reitter
2008-06-30 8:30 ` visual-line-mode Miles Bader
2008-07-10 4:53 ` visual-line-mode Chong Yidong
-- strict thread matches above, loose matches on Subject: below --
2009-10-21 14:35 visual-line-mode Quintana Seguí, Pere
2009-10-21 18:24 visual-line-mode Scott Randby
2009-10-21 21:14 ` visual-line-mode Scot Becker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvzlp4fio7.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=cyd@stupidchicken.com \
--cc=david.reitter@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=miles@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.