emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog simple.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog simple.el
Date: Sat, 11 Jul 2009 16:36:11 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/07/11 16:36:10

Modified files:
        lisp           : ChangeLog simple.el 

Log message:
        * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15796&r2=1.15797
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.989&r2=1.990

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15796
retrieving revision 1.15797
diff -u -b -r1.15796 -r1.15797
--- ChangeLog   11 Jul 2009 06:38:11 -0000      1.15796
+++ ChangeLog   11 Jul 2009 16:36:05 -0000      1.15797
@@ -1,3 +1,11 @@
+2009-07-11  Chong Yidong  <address@hidden>
+
+       * 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.
+
 2009-07-11  Kenichi Handa  <address@hidden>
 
        * international/mule-diag.el (describe-character-set): Don't show

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.989
retrieving revision 1.990
diff -u -b -r1.989 -r1.990
--- simple.el   2 Jul 2009 22:47:52 -0000       1.989
+++ simple.el   11 Jul 2009 16:36:09 -0000      1.990
@@ -3973,10 +3973,14 @@
 (defvar temporary-goal-column 0
   "Current goal column for vertical motion.
 It is the column where point was at the start of the current run
-of vertical motion commands.  It is a floating point number when
-moving by visual lines via `line-move-visual'; this is the
-x-position, in pixels, divided by the default column width.  When
-the `track-eol' feature is doing its job, the value is
+of vertical motion commands.
+
+When moving by visual lines via `line-move-visual', it is a cons
+cell (COL . HSCROLL), where COL is the x-position, in pixels,
+divided by the default column width, and HSCROLL is the number of
+columns by which window is scrolled from left margin.
+
+When the `track-eol' feature is doing its job, the value is
 `most-positive-fixnum'.")
 
 (defcustom line-move-ignore-invisible t
@@ -4075,18 +4079,33 @@
 (defun line-move-visual (arg &optional noerror)
   (let ((posn (posn-at-point))
        (opoint (point))
+       (hscroll (window-hscroll))
        x)
-    ;; Reset temporary-goal-column, unless the previous command was a
-    ;; line-motion command or we were called from some other command.
-    (unless (and (floatp temporary-goal-column)
+    ;; Check if the previous command was a line-motion command, or if
+    ;; we were called from some other command.
+    (cond ((and (consp temporary-goal-column)
                 (memq last-command `(next-line previous-line ,this-command)))
-      (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe
-            (setq temporary-goal-column (- (window-width) 1)))
+          ;; If so, there's no need to reset `temporary-goal-column',
+          ;; unless the window hscroll has changed.
+          (when (/= hscroll (cdr temporary-goal-column))
+            (set-window-hscroll nil 0)
+            (setq temporary-goal-column
+                  (cons (+ (car temporary-goal-column)
+                           (cdr temporary-goal-column)) 0))))
+         ;; Otherwise, we should reset `temporary-goal-column'.
+         ;; Handle the `overflow-newline-into-fringe' case:
+         ((eq (nth 1 posn) 'right-fringe)
+          (setq temporary-goal-column (cons (- (window-width) 1) hscroll)))
            ((setq x (car (posn-x-y posn)))
-            (setq temporary-goal-column (/ (float x) (frame-char-width))))))
+          (setq temporary-goal-column
+                (cons (/ (float x) (frame-char-width)) hscroll))))
     ;; Move using `vertical-motion'.
     (or (and (= (vertical-motion
-                (cons (or goal-column (truncate temporary-goal-column)) arg))
+                (cons (or goal-column
+                          (if (consp temporary-goal-column)
+                              (truncate (car temporary-goal-column))
+                            temporary-goal-column))
+                      arg))
                arg)
             (or (>= arg 0)
                 (/= (point) opoint)
@@ -4108,8 +4127,9 @@
   (let ((inhibit-point-motion-hooks t)
        (opoint (point))
        (orig-arg arg))
-    (if (floatp temporary-goal-column)
-       (setq temporary-goal-column (truncate temporary-goal-column)))
+    (if (consp temporary-goal-column)
+       (setq temporary-goal-column (+ (car temporary-goal-column)
+                                      (cdr temporary-goal-column))))
     (unwind-protect
        (progn
          (if (not (memq last-command '(next-line previous-line)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]