Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"

From: Paul Pogonyshev <[email-masked]>
Date: Fri, 12 Aug 2022 17:12:07 +0200

For what it's worth, I use `grep-find' a lot over Tramp and have never had
problems with it. (Other than when it finds a match in something like a 500
KB minified JS, but this is not Tramp-specific; Emacs in general sucks with
very long lines in text files.) It works over compilation infrastructure
apparently. Compilation itself also works fine for me.

Paul

On Wed, 10 Aug 2022 at 15:26, Paul Pogonyshev <[email-masked]> wrote:

> Actually no, it doesn't help in all cases. It got better, but sometimes
> still dies with the same error:
>
> Debugger entered--Lisp error: (wrong-type-argument processp nil)
>   process-mark(nil)
>   (move-marker (process-mark proc) (point) (current-buffer))
>   (let ((proc (get-buffer-process (current-buffer)))) (message "@ %S %S"
> (current-buffer) proc) (move-marker (process-mark proc) (point)
> (current-buffer)) (set-process-filter proc #'find-dired-filter)
> (set-process-sentinel proc #'find-dired-sentinel))
>   ...
>
> For debugging I also added this line:
>
>      (shell-command (concat command "&") (current-buffer))
>      (let ((proc (get-buffer-process (current-buffer))))
>  +     (message "@ %S %S" (current-buffer) proc)
>        ;; Initialize the process marker; it is used by the filter.
>        (move-marker (process-mark proc) (point) (current-buffer))  ;; <--
> dies here
>
> Here is the resut in buffer *Messages*:
>
> @ #<buffer *Find*> nil
>
> So, the process can be nil immediately after `shell-command' returns too.
>
> Paul
>
>
> On Tue, 2 Aug 2022 at 13:28, Lars Ingebrigtsen <[email-masked]> wrote:
>
>> Paul Pogonyshev <[email-masked]> writes:
>>
>> > Seems so. I guess with the way Elisp works it is even correct, because
>> > (as I understand) Elisp has no way to notice that process has died if
>> > there are no IO calls between `shell-process' and `set-process-*'.
>>
>> Yes, but I'm not quite sure that's actually the case in all
>> circumstances (especially when Tramp is involved)...
>>
>> > But it does feel dirty. (Also that `(sit-for 1)' a few lines above
>> > feels dirty.)
>>
>> Yeah, much of the code in find-dired.el looks pretty fragile.
>>
>> But I guess this works now, so I'm closing this bug report.
>>
>>