unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thomas Koch <thomas@koch.ro>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: "12145@debbugs.gnu.org" <12145@debbugs.gnu.org>,
	"João Távora" <joaotavora@gmail.com>
Subject: bug#12145: Fix causes problems with other processes
Date: Thu, 2 Mar 2023 21:00:19 +0200 (EET)	[thread overview]
Message-ID: <432215292.266279.1677783619005@office.mailbox.org> (raw)
In-Reply-To: <87lekfxezv.fsf@gmx.de>

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	other threads:[~2023-03-02 19:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06  2:05 bug#12145: 24.1.50; enable-remote-dir-locals breaks find-name-dired in TRAMP buffers Matt McClure
2012-08-06 12:18 ` Michael Albinus
2012-08-20 14:07   ` Michael Albinus
2012-08-28 14:12     ` Matt McClure
2012-08-28 14:42       ` Michael Albinus
2023-03-02 10:48 ` bug#12145: Fix causes problems with other processes Thomas Koch
2023-03-02 16:08   ` Thomas Koch
2023-03-02 17:03     ` Michael Albinus
2023-03-02 19:00       ` Thomas Koch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=432215292.266279.1677783619005@office.mailbox.org \
    --to=thomas@koch.ro \
    --cc=12145@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).