emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6b14ef273a: Fix find-dired over tramp


From: Lars Ingebrigtsen
Subject: master 6b14ef273a: Fix find-dired over tramp
Date: Tue, 2 Aug 2022 06:35:19 -0400 (EDT)

branch: master
commit 6b14ef273a90d774116e90dedc31fe59d77ec520
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix find-dired over tramp
    
    * lisp/find-dired.el (find-dired-with-command): Set the
    filter/sentinel immediately -- scheduling may make process output
    (and exit) happen before these are set otherwise (bug#56865).
    (find-dired-sort-by-filename): Don't bug out on error messages
    from find.
---
 lisp/find-dired.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 63f2148e47..fba5126133 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -242,6 +242,11 @@ it finishes, type \\[kill-find]."
     (setq default-directory dir)
     ;; Start the find process.
     (shell-command (concat command "&") (current-buffer))
+    (let ((proc (get-buffer-process (current-buffer))))
+      ;; Initialize the process marker; it is used by the filter.
+      (move-marker (process-mark proc) (point) (current-buffer))
+      (set-process-filter proc #'find-dired-filter)
+      (set-process-sentinel proc #'find-dired-sentinel))
     (dired-mode dir (cdr find-ls-option))
     (let ((map (make-sparse-keymap)))
       (set-keymap-parent map (current-local-map))
@@ -273,11 +278,6 @@ it finishes, type \\[kill-find]."
       (insert "  " command "\n")
       (dired-insert-set-properties point (point)))
     (setq buffer-read-only t)
-    (let ((proc (get-buffer-process (current-buffer))))
-      (set-process-filter proc #'find-dired-filter)
-      (set-process-sentinel proc #'find-dired-sentinel)
-      ;; Initialize the process marker; it is used by the filter.
-      (move-marker (process-mark proc) (point) (current-buffer)))
     (setq mode-line-process '(":%s"))))
 
 (defun find-dired--escaped-ls-option ()
@@ -419,10 +419,10 @@ specifies what to use in place of \"-ls\" as the final 
argument."
   "Sort entries in *Find* buffer by file name lexicographically."
   (sort-subr nil 'forward-line 'end-of-line
              (lambda ()
-               (buffer-substring-no-properties
-                (next-single-property-change
-                 (point) 'dired-filename)
-                (line-end-position)))))
+               (when-let ((start
+                           (next-single-property-change
+                            (point) 'dired-filename)))
+               (buffer-substring-no-properties start (line-end-position))))))
 
 
 (provide 'find-dired)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]