diff options
| author | Richard M. Stallman | 1993-06-15 07:59:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-15 07:59:07 +0000 |
| commit | cfe89c4fa50b7f7e72c0e9d3c699f00ed17025db (patch) | |
| tree | c86eb561521b981e65a32ed69233832d0d588526 | |
| parent | eebaeadde2e9cd812dd5b3eebf3860164338feb0 (diff) | |
| download | emacs-cfe89c4fa50b7f7e72c0e9d3c699f00ed17025db.tar.gz emacs-cfe89c4fa50b7f7e72c0e9d3c699f00ed17025db.zip | |
(dired-repeat-over-lines): Going fwd, skip new lines
that FUNCTION inserts after the current line.
Going backwd, no need for dired-move-to-filename each time.
| -rw-r--r-- | lisp/dired.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 949eaec83f6..20a3267810d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1542,21 +1542,27 @@ Optional argument means return a file name relative to `default-directory'." | |||
| 1542 | 1542 | ||
| 1543 | (defun dired-repeat-over-lines (arg function) | 1543 | (defun dired-repeat-over-lines (arg function) |
| 1544 | ;; This version skips non-file lines. | 1544 | ;; This version skips non-file lines. |
| 1545 | (beginning-of-line) | 1545 | (let ((pos (make-marker))) |
| 1546 | (while (and (> arg 0) (not (eobp))) | ||
| 1547 | (setq arg (1- arg)) | ||
| 1548 | (beginning-of-line) | ||
| 1549 | (while (and (not (eobp)) (dired-between-files)) (forward-line 1)) | ||
| 1550 | (save-excursion (funcall function)) | ||
| 1551 | (forward-line 1)) | ||
| 1552 | (while (and (< arg 0) (not (bobp))) | ||
| 1553 | (setq arg (1+ arg)) | ||
| 1554 | (forward-line -1) | ||
| 1555 | (while (and (not (bobp)) (dired-between-files)) (forward-line -1)) | ||
| 1556 | (beginning-of-line) | 1546 | (beginning-of-line) |
| 1557 | (save-excursion (funcall function)) | 1547 | (while (and (> arg 0) (not (eobp))) |
| 1558 | (dired-move-to-filename)) | 1548 | (setq arg (1- arg)) |
| 1559 | (dired-move-to-filename)) | 1549 | (beginning-of-line) |
| 1550 | (while (and (not (eobp)) (dired-between-files)) (forward-line 1)) | ||
| 1551 | (save-excursion | ||
| 1552 | (forward-line 1) | ||
| 1553 | (move-marker pos (1+ (point)))) | ||
| 1554 | (save-excursion (funcall function)) | ||
| 1555 | ;; Advance to the next line--actually, to the line that *was* next. | ||
| 1556 | ;; (If FUNCTION inserted some new lines in between, skip them.) | ||
| 1557 | (goto-char pos)) | ||
| 1558 | (while (and (< arg 0) (not (bobp))) | ||
| 1559 | (setq arg (1+ arg)) | ||
| 1560 | (forward-line -1) | ||
| 1561 | (while (and (not (bobp)) (dired-between-files)) (forward-line -1)) | ||
| 1562 | (beginning-of-line) | ||
| 1563 | (save-excursion (funcall function))) | ||
| 1564 | (move-marker pos nil) | ||
| 1565 | (dired-move-to-filename))) | ||
| 1560 | 1566 | ||
| 1561 | (defun dired-between-files () | 1567 | (defun dired-between-files () |
| 1562 | ;; Point must be at beginning of line | 1568 | ;; Point must be at beginning of line |