Commit cfe89c4f authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent eebaeadd
......@@ -1542,21 +1542,27 @@ Optional argument means return a file name relative to `default-directory'."
(defun dired-repeat-over-lines (arg function)
;; This version skips non-file lines.
(let ((pos (make-marker)))
(while (and (> arg 0) (not (eobp)))
(setq arg (1- arg))
(while (and (not (eobp)) (dired-between-files)) (forward-line 1))
(forward-line 1)
(move-marker pos (1+ (point))))
(save-excursion (funcall function))
(forward-line 1))
;; Advance to the next line--actually, to the line that *was* next.
;; (If FUNCTION inserted some new lines in between, skip them.)
(goto-char pos))
(while (and (< arg 0) (not (bobp)))
(setq arg (1+ arg))
(forward-line -1)
(while (and (not (bobp)) (dired-between-files)) (forward-line -1))
(save-excursion (funcall function))
(save-excursion (funcall function)))
(move-marker pos nil)
(defun dired-between-files ()
;; Point must be at beginning of line
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment