]> git.eshelyaron.com Git - emacs.git/commitdiff
(line-move-finish): New arg FORWARD.
authorRichard M. Stallman <rms@gnu.org>
Sat, 20 Nov 2004 19:08:45 +0000 (19:08 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 20 Nov 2004 19:08:45 +0000 (19:08 +0000)
Ignore invisible newlines, not intangible ones.
Conditions for acceptable stopping positions depend on FORWARD.
(line-move): Pass FORWARD arg to line-move-finish.

lisp/simple.el

index f3532226d854fcd3acdcb0694d6c4a469476a9b4..3fb388c88674ce6774287549eb0a8ea577f838f1 100644 (file)
@@ -3107,6 +3107,7 @@ Outline mode sets this."
   ;; for intermediate positions.
   (let ((inhibit-point-motion-hooks t)
        (opoint (point))
+       (forward (> arg 0))
        new line-end line-beg)
     (unwind-protect
        (progn
@@ -3181,9 +3182,10 @@ Outline mode sets this."
             ;; at least go to end of line.
             (beginning-of-line))
            (t
-            (line-move-finish (or goal-column temporary-goal-column) opoint))))))
+            (line-move-finish (or goal-column temporary-goal-column)
+                              opoint forward))))))
 
-(defun line-move-finish (column opoint)
+(defun line-move-finish (column opoint forward)
   (let ((repeat t))
     (while repeat
       ;; Set REPEAT to t to repeat the whole thing.
@@ -3193,10 +3195,11 @@ Outline mode sets this."
            (line-beg (save-excursion (beginning-of-line) (point)))
            (line-end
             ;; Compute the end of the line
-            ;; ignoring effectively intangible newlines.
+            ;; ignoring effectively invisible newlines.
             (save-excursion
-              (let ((inhibit-point-motion-hooks nil)
-                    (inhibit-field-text-motion t))
+              (end-of-line)
+              (while (and (not (eobp)) (line-move-invisible-p (point)))
+                (goto-char (next-char-property-change (point)))
                 (end-of-line))
               (point))))
 
@@ -3220,7 +3223,13 @@ Outline mode sets this."
            ;; try the previous allowable position.
            ;; See if it is ok.
            (backward-char)
-           (if (<= (point) line-end)
+           (if (if forward
+                   ;; If going forward, don't accept the previous
+                   ;; allowable position if it is before the target line.
+                   (< line-beg (point)) 
+                 ;; If going backward, don't accept the previous
+                 ;; allowable position if it is still after the target line.
+                 (<= (point) line-end))
                (setq new (point))
              ;; As a last resort, use the end of the line.
              (setq new line-end))))