diff options
| author | Richard M. Stallman | 2006-08-16 05:07:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-08-16 05:07:22 +0000 |
| commit | ad47c4a0a50bfb43ff1d29e80fa3edf9b0955249 (patch) | |
| tree | e3fd06e4ab4b870d299c28c3cb124a38b1f80fb5 | |
| parent | b605a60ad353518cc072bc0f4cad78dfed6364a2 (diff) | |
| download | emacs-ad47c4a0a50bfb43ff1d29e80fa3edf9b0955249.tar.gz emacs-ad47c4a0a50bfb43ff1d29e80fa3edf9b0955249.zip | |
(move-beginning-of-line): Test whether fields
would prevent motion back to line's first visible character.
If so, stop where the fields would stop the motion.
| -rw-r--r-- | lisp/simple.el | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 9288ab6bd79..f1b80968ff1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3770,7 +3770,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 3770 | (interactive "p") | 3770 | (interactive "p") |
| 3771 | (or arg (setq arg 1)) | 3771 | (or arg (setq arg 1)) |
| 3772 | 3772 | ||
| 3773 | (let ((orig (point))) | 3773 | (let ((orig (point)) |
| 3774 | start first-vis first-vis-field-value) | ||
| 3774 | 3775 | ||
| 3775 | ;; Move by lines, if ARG is not 1 (the default). | 3776 | ;; Move by lines, if ARG is not 1 (the default). |
| 3776 | (if (/= arg 1) | 3777 | (if (/= arg 1) |
| @@ -3781,10 +3782,24 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 3781 | (while (and (not (bobp)) (line-move-invisible-p (1- (point)))) | 3782 | (while (and (not (bobp)) (line-move-invisible-p (1- (point)))) |
| 3782 | (goto-char (previous-char-property-change (point))) | 3783 | (goto-char (previous-char-property-change (point))) |
| 3783 | (skip-chars-backward "^\n")) | 3784 | (skip-chars-backward "^\n")) |
| 3784 | 3785 | (setq start (point)) | |
| 3785 | ;; Take care of fields. | 3786 | |
| 3786 | (goto-char (constrain-to-field (point) orig | 3787 | ;; Now find first visible char in the line |
| 3787 | (/= arg 1) t nil)))) | 3788 | (while (and (not (eobp)) (line-move-invisible-p (point))) |
| 3789 | (goto-char (next-char-property-change (point)))) | ||
| 3790 | (setq first-vis (point)) | ||
| 3791 | |||
| 3792 | ;; See if fields would stop us from reaching FIRST-VIS. | ||
| 3793 | (setq first-vis-field-value | ||
| 3794 | (constrain-to-field first-vis orig (/= arg 1) t nil)) | ||
| 3795 | |||
| 3796 | (goto-char (if (/= first-vis-field-value first-vis) | ||
| 3797 | ;; If yes, obey them. | ||
| 3798 | first-vis-field-value | ||
| 3799 | ;; Otherwise, move to START with attention to fields. | ||
| 3800 | ;; (It is possible that fields never matter in this case.) | ||
| 3801 | (constrain-to-field (point) orig | ||
| 3802 | (/= arg 1) t nil))))) | ||
| 3788 | 3803 | ||
| 3789 | 3804 | ||
| 3790 | ;;; Many people have said they rarely use this feature, and often type | 3805 | ;;; Many people have said they rarely use this feature, and often type |