File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 6262(define-key *directory-mode-keymap* " r" ' directory-mode-rename-file)
6363(define-key *directory-mode-keymap* " s" ' directory-mode-sort-files)
6464(define-key *directory-mode-keymap* " +" ' make-directory)
65+ (define-key *directory-mode-keymap* " k" ' directory-mode-kill-lines)
6566
6667(defun run-command (command)
6768 (when (consp command)
132133 (funcall function p)
133134 (unless (line-offset p 1 ) (return )))))
134135
135- (defun marked-files (p)
136+
137+ (defun marked-lines (p)
136138 (with-point ((p p))
137- (let ((pathnames ' ()))
139+ (let ((points ' ()))
138140 (iter-marks p
139141 (lambda (p)
140142 (when (get-mark p)
141- (push (get-pathname p) pathnames))))
142- (nreverse pathnames))))
143+ (push (copy-point p :temporary ) points))))
144+ (nreverse points))))
145+
146+ (defun marked-files (p)
147+ (mapcar ' get-pathname (marked-lines p)))
143148
144149(defun filter-marks (p function)
145150 (iter-marks p
566571 (let ((filename (file-namestring fullpath)))
567572 (search-filename-and-recenter (file-namestring filename)))))))
568573
574+ (define-command directory-mode-kill-lines () ()
575+ " Delete the marked lines from the directory-mode buffer.
576+ This does not delete the marked entries, but only remove them from the buffer."
577+ (with-buffer-read-only (current-buffer) nil
578+ (let ((*inhibit-read-only* t )
579+ (marked-lines (marked-lines (current-point))))
580+ (save-excursion
581+ ; ; Reverse the lines so killing is done from the end of the buffer
582+ (loop :for marked-line :in (nreverse marked-lines)
583+ :do (move-point (current-point) marked-line)
584+ (kill-whole-line))))))
585+
569586(setf *find-directory-function* ' directory-buffer)
570587
571588(defmethod execute :after ((mode directory-mode) command argument)
You can’t perform that action at this time.
0 commit comments