diff options
| author | Kim F. Storm | 2005-03-07 11:12:31 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-03-07 11:12:31 +0000 |
| commit | 0cbb497cf069870f707c8942dfbadcf5eae06f18 (patch) | |
| tree | 915e19bd8b0f7bd5e147a81e0506fea736eec251 | |
| parent | d17a638d58d5c7a82d842601d70dee0f3e41ed84 (diff) | |
| download | emacs-0cbb497cf069870f707c8942dfbadcf5eae06f18.tar.gz emacs-0cbb497cf069870f707c8942dfbadcf5eae06f18.zip | |
(move-beginning-of-line): New command.
| -rw-r--r-- | lisp/simple.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 38c9bff4130..207f5b83abc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3517,6 +3517,33 @@ boundaries bind `inhibit-field-text-motion' to t." | |||
| 3517 | (setq arg 1) | 3517 | (setq arg 1) |
| 3518 | (setq done t))))))) | 3518 | (setq done t))))))) |
| 3519 | 3519 | ||
| 3520 | (defun move-beginning-of-line (arg) | ||
| 3521 | "Move point to beginning of current display line. | ||
| 3522 | With argument ARG not nil or 1, move forward ARG - 1 lines first. | ||
| 3523 | If point reaches the beginning or end of buffer, it stops there. | ||
| 3524 | To ignore intangibility, bind `inhibit-point-motion-hooks' to t. | ||
| 3525 | |||
| 3526 | This command does not move point across a field boundary unless doing so | ||
| 3527 | would move beyond there to a different line; if ARG is nil or 1, and | ||
| 3528 | point starts at a field boundary, point does not move. To ignore field | ||
| 3529 | boundaries bind `inhibit-field-text-motion' to t." | ||
| 3530 | (interactive "p") | ||
| 3531 | (or arg (setq arg 1)) | ||
| 3532 | (if (/= arg 1) | ||
| 3533 | (line-move (1- arg) t)) | ||
| 3534 | (let (done pos) | ||
| 3535 | (while (not done) | ||
| 3536 | (beginning-of-line 1) | ||
| 3537 | ;; (not bolp) means that it stopped at a field boundary. | ||
| 3538 | (if (or (bobp) (not (bolp))) | ||
| 3539 | (setq done t) | ||
| 3540 | (sit-for 0) | ||
| 3541 | (if (and (consp (setq pos (pos-visible-in-window-p (point) nil t))) | ||
| 3542 | (= (car pos) 0)) | ||
| 3543 | (setq done t) | ||
| 3544 | (backward-char 1)))))) | ||
| 3545 | |||
| 3546 | |||
| 3520 | ;;; Many people have said they rarely use this feature, and often type | 3547 | ;;; Many people have said they rarely use this feature, and often type |
| 3521 | ;;; it by accident. Maybe it shouldn't even be on a key. | 3548 | ;;; it by accident. Maybe it shouldn't even be on a key. |
| 3522 | (put 'set-goal-column 'disabled t) | 3549 | (put 'set-goal-column 'disabled t) |