Mercurial > emacs
comparison lisp/simple.el @ 44756:56b4ca0725c1
(line-move-finish): Find beg and end of line
before calling line-move-to-column. Do consider intangible
when finding the end. Take more care in analyzing the results
of intangibility after line-move-to-column.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 22 Apr 2002 22:35:46 +0000 |
parents | 6374552100a2 |
children | fe8ce22fc4a1 |
comparison
equal
deleted
inserted
replaced
44755:52388a234829 | 44756:56b4ca0725c1 |
---|---|
2636 (let ((repeat t)) | 2636 (let ((repeat t)) |
2637 (while repeat | 2637 (while repeat |
2638 ;; Set REPEAT to t to repeat the whole thing. | 2638 ;; Set REPEAT to t to repeat the whole thing. |
2639 (setq repeat nil) | 2639 (setq repeat nil) |
2640 | 2640 |
2641 ;; Move to the desired column. | 2641 (let (new |
2642 (line-move-to-column column) | |
2643 | |
2644 (let ((new (point)) | |
2645 (line-beg (save-excursion (beginning-of-line) (point))) | 2642 (line-beg (save-excursion (beginning-of-line) (point))) |
2646 (line-end (save-excursion (end-of-line) (point)))) | 2643 (line-end |
2644 ;; Compute the end of the line | |
2645 ;; ignoring effectively intangible newlines. | |
2646 (let ((inhibit-point-motion-hooks nil)) | |
2647 (save-excursion (end-of-line) (point))))) | |
2648 | |
2649 ;; Move to the desired column. | |
2650 (line-move-to-column column) | |
2651 (setq new (point)) | |
2647 | 2652 |
2648 ;; Process intangibility within a line. | 2653 ;; Process intangibility within a line. |
2649 ;; Move to the chosen destination position from above, | 2654 ;; Move to the chosen destination position from above, |
2650 ;; with intangibility processing enabled. | 2655 ;; with intangibility processing enabled. |
2651 | 2656 |
2654 (goto-char new) | 2659 (goto-char new) |
2655 | 2660 |
2656 ;; If intangibility moves us to a different (later) place | 2661 ;; If intangibility moves us to a different (later) place |
2657 ;; in the same line, use that as the destination. | 2662 ;; in the same line, use that as the destination. |
2658 (if (<= (point) line-end) | 2663 (if (<= (point) line-end) |
2659 (setq new (point)))) | 2664 (setq new (point)) |
2665 ;; If that position is "too late", | |
2666 ;; try the previous allowable position. | |
2667 ;; See if it is ok. | |
2668 (backward-char) | |
2669 (if (<= (point) line-end) | |
2670 (setq new (point)) | |
2671 ;; As a last resort, use the end of the line. | |
2672 (setq new line-end)))) | |
2660 | 2673 |
2661 ;; Now move to the updated destination, processing fields | 2674 ;; Now move to the updated destination, processing fields |
2662 ;; as well as intangibility. | 2675 ;; as well as intangibility. |
2663 (goto-char opoint) | 2676 (goto-char opoint) |
2664 (let ((inhibit-point-motion-hooks nil)) | 2677 (let ((inhibit-point-motion-hooks nil)) |
2665 (goto-char | 2678 (goto-char |
2666 (constrain-to-field new opoint nil t | 2679 (constrain-to-field new opoint nil t |
2667 'inhibit-line-move-field-capture))) | 2680 'inhibit-line-move-field-capture))) |
2668 | 2681 |
2669 ;; If intangibility processing moved us to a different line, | 2682 ;; If all this moved us to a different line, |
2670 ;; retry everything within that new line. | 2683 ;; retry everything within that new line. |
2671 (when (or (< (point) line-beg) (> (point) line-end)) | 2684 (when (or (< (point) line-beg) (> (point) line-end)) |
2672 ;; Repeat the intangibility and field processing. | 2685 ;; Repeat the intangibility and field processing. |
2673 (setq repeat t)))))) | 2686 (setq repeat t)))))) |
2674 | 2687 |