bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12145: Fix causes problems with other processes


From: Thomas Koch
Subject: bug#12145: Fix causes problems with other processes
Date: Thu, 2 Mar 2023 21:00:19 +0200 (EET)

I've now also digged a bit into the second, longer backtrace with 
(wrong-type-argument "markerp nil"):

- With (message) debugging I fount that the last line of this snippet in 
`comint-output-filter` is the one that causes the error:

          ;; We temporarily remove any buffer narrowing, in case the
          ;; process mark is outside of the restriction
          (save-restriction
            (widen)

            (goto-char (process-mark process))
            (set-marker comint-last-output-start (point))

- comint-last-output start gets initialized in `define-derived-mode 
comint-mode`:

  (setq-local comint-last-output-start (make-marker))

-> Either, a) `comint-output-filter` gets called before `comint-mode`
-> or b) `comint-last-output-start` gets reset after its initialization.

These two lines from `find-dired`:

    (shell-command (concat args "&") (current-buffer))
    ;; The next statement will bomb in classic dired (no optional arg allowed)
    (dired-mode dir (cdr find-ls-option))

1. `shell-command` switches (current-buffer) to `shell-mode` which is derived 
from `comint-mode`.
2. `comint-mode` initializes `comint-last-output-start`.
3. `shell-command` sets `comint-output-filter` for the process it started
4. `find-dired` calls `dired-mode`
5. `dired-mode` calls (kill-all-local-variables) which probably sets 
`comint-last-output-start` to nil?

It is however not too important whether the above analysis is right, given the 
following comment in shell-command:

"""In Elisp, you will often be better served by calling call-process or
   start-process directly, since they offer more control and do not
   impose the use of a shell (with its need to quote arguments)."""

I believe, find-dired should be changed to not call shell-command anymore.

I rest my case.





reply via email to

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