aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-07-11 16:36:05 +0000
committerChong Yidong2009-07-11 16:36:05 +0000
commit774409a10b9b87805192df0444ca019ff929cfc4 (patch)
tree1fa93d8c0621ddfcbb1c0c490c4af88bd88663a1
parent65156807134f7d430f9e32086a228e4a3ad4f386 (diff)
downloademacs-774409a10b9b87805192df0444ca019ff929cfc4.tar.gz
emacs-774409a10b9b87805192df0444ca019ff929cfc4.zip
* simple.el (temporary-goal-column): Change the value for
line-move-visual to a cons cell. (line-move-visual): Record or set the window hscroll, if necessary (Bug#3494). (line-move-1): Handle cons value of temporary-goal-column.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/simple.el50
2 files changed, 43 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a1b44618e2c..007381ba11a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12009-07-11 Chong Yidong <cyd@stupidchicken.com>
2
3 * simple.el (temporary-goal-column): Change the value for
4 line-move-visual to a cons cell.
5 (line-move-visual): Record or set the window hscroll, if
6 necessary (Bug#3494).
7 (line-move-1): Handle cons value of temporary-goal-column.
8
12009-07-11 Kenichi Handa <handa@m17n.org> 92009-07-11 Kenichi Handa <handa@m17n.org>
2 10
3 * international/mule-diag.el (describe-character-set): Don't show 11 * international/mule-diag.el (describe-character-set): Don't show
diff --git a/lisp/simple.el b/lisp/simple.el
index 0bdc21a75b0..15536bced08 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3973,10 +3973,14 @@ This has no effect when `line-move-visual' is non-nil."
3973(defvar temporary-goal-column 0 3973(defvar temporary-goal-column 0
3974 "Current goal column for vertical motion. 3974 "Current goal column for vertical motion.
3975It is the column where point was at the start of the current run 3975It is the column where point was at the start of the current run
3976of vertical motion commands. It is a floating point number when 3976of vertical motion commands.
3977moving by visual lines via `line-move-visual'; this is the 3977
3978x-position, in pixels, divided by the default column width. When 3978When moving by visual lines via `line-move-visual', it is a cons
3979the `track-eol' feature is doing its job, the value is 3979cell (COL . HSCROLL), where COL is the x-position, in pixels,
3980divided by the default column width, and HSCROLL is the number of
3981columns by which window is scrolled from left margin.
3982
3983When the `track-eol' feature is doing its job, the value is
3980`most-positive-fixnum'.") 3984`most-positive-fixnum'.")
3981 3985
3982(defcustom line-move-ignore-invisible t 3986(defcustom line-move-ignore-invisible t
@@ -4075,18 +4079,33 @@ into account variable-width characters and line continuation."
4075(defun line-move-visual (arg &optional noerror) 4079(defun line-move-visual (arg &optional noerror)
4076 (let ((posn (posn-at-point)) 4080 (let ((posn (posn-at-point))
4077 (opoint (point)) 4081 (opoint (point))
4082 (hscroll (window-hscroll))
4078 x) 4083 x)
4079 ;; Reset temporary-goal-column, unless the previous command was a 4084 ;; Check if the previous command was a line-motion command, or if
4080 ;; line-motion command or we were called from some other command. 4085 ;; we were called from some other command.
4081 (unless (and (floatp temporary-goal-column) 4086 (cond ((and (consp temporary-goal-column)
4082 (memq last-command `(next-line previous-line ,this-command))) 4087 (memq last-command `(next-line previous-line ,this-command)))
4083 (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe 4088 ;; If so, there's no need to reset `temporary-goal-column',
4084 (setq temporary-goal-column (- (window-width) 1))) 4089 ;; unless the window hscroll has changed.
4085 ((setq x (car (posn-x-y posn))) 4090 (when (/= hscroll (cdr temporary-goal-column))
4086 (setq temporary-goal-column (/ (float x) (frame-char-width)))))) 4091 (set-window-hscroll nil 0)
4092 (setq temporary-goal-column
4093 (cons (+ (car temporary-goal-column)
4094 (cdr temporary-goal-column)) 0))))
4095 ;; Otherwise, we should reset `temporary-goal-column'.
4096 ;; Handle the `overflow-newline-into-fringe' case:
4097 ((eq (nth 1 posn) 'right-fringe)
4098 (setq temporary-goal-column (cons (- (window-width) 1) hscroll)))
4099 ((setq x (car (posn-x-y posn)))
4100 (setq temporary-goal-column
4101 (cons (/ (float x) (frame-char-width)) hscroll))))
4087 ;; Move using `vertical-motion'. 4102 ;; Move using `vertical-motion'.
4088 (or (and (= (vertical-motion 4103 (or (and (= (vertical-motion
4089 (cons (or goal-column (truncate temporary-goal-column)) arg)) 4104 (cons (or goal-column
4105 (if (consp temporary-goal-column)
4106 (truncate (car temporary-goal-column))
4107 temporary-goal-column))
4108 arg))
4090 arg) 4109 arg)
4091 (or (>= arg 0) 4110 (or (>= arg 0)
4092 (/= (point) opoint) 4111 (/= (point) opoint)
@@ -4108,8 +4127,9 @@ into account variable-width characters and line continuation."
4108 (let ((inhibit-point-motion-hooks t) 4127 (let ((inhibit-point-motion-hooks t)
4109 (opoint (point)) 4128 (opoint (point))
4110 (orig-arg arg)) 4129 (orig-arg arg))
4111 (if (floatp temporary-goal-column) 4130 (if (consp temporary-goal-column)
4112 (setq temporary-goal-column (truncate temporary-goal-column))) 4131 (setq temporary-goal-column (+ (car temporary-goal-column)
4132 (cdr temporary-goal-column))))
4113 (unwind-protect 4133 (unwind-protect
4114 (progn 4134 (progn
4115 (if (not (memq last-command '(next-line previous-line))) 4135 (if (not (memq last-command '(next-line previous-line)))