Subject: Re: bug#25983: 25.2; set dired-directory in vc-dir mode

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 15 Sep 2020 17:51:22 +0200

Tom Tromey <[email-masked]> writes:

>>>>>> "GM" == Glenn Morris <[email-masked]> writes:
>
> GM> Is dired-directory not basically an internal dired variable that should
> GM> only be set in Dired mode, and modes derived from it, which vc-dir is not?
>
> Various bits of code (and some other code I have seen, not part of
> Emacs) seem to examine it.  And vc-dir seems dired-like.

Hm...  Well, there's a bunch of buffers that are kinda-sorta dired-like
(like `M-x grep'), so adding this just to vc-dir seems a bit odd to me.

> The backstory for this bug is that I have this handy bit of code I got
> from someone on #emacs:
>
>     ;; From fledermaus
>     (defun kill-buffers-under (under)

[...]

>                       (and dired-directory
>                            (expand-file-name dired-directory)) )) ))

[...]

> ... and I'd rather not add a special hack just for vc-dir, and then for
> whatever other modes crop up.
>
> I guess I'm being a bit lazy trying to avoid introducing a new variable.
> But maybe I should?

All buffers have a default-directory, but you want to make a function
that kills are buffers that are "like" dired (in that they display a
buffer pointing to a directory, and there are things you can do there)?

I don't think you'll be able to find a definition of what's "like" dired
enough that this would make sense...  especially when the use case
doesn't seem that ... comprehensible?  That is, I think only the user
that writes a function like this knows what buffer types they want to
consider killing.  Finding a general solution here doesn't seem very
likely, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no