From: Tom Tromey <tom@tromey.com>
To: Glenn Morris <rgm@gnu.org>
Cc: Tom Tromey <tom@tromey.com>, 25983@debbugs.gnu.org
Subject: bug#25983: 25.2; set dired-directory in vc-dir mode
Date: Sun, 05 Mar 2017 17:04:44 -0700 [thread overview]
Message-ID: <87h9371d9f.fsf@tromey.com> (raw)
In-Reply-To: <tcinnn8ek4.fsf@fencepost.gnu.org> (Glenn Morris's message of "Sun, 05 Mar 2017 18:54:51 -0500")
>>>>> "GM" == Glenn Morris <rgm@gnu.org> 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.
The basic problem is that I don't think there's a good way to indicate:
"this buffer is associated with this directory, but isn't visiting a
file". dired-directory is the only one I know of.
default-directory seems almost right but it's a bit random for some
buffers; like *shell* or *compilation*.
There's list-buffer-directory but it is just a random string, not
actually a directory name.
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)
(interactive "DKill buffers under: ")
(setq under (concat "^" (expand-file-name under)))
(mapc
(lambda (buf)
(let ((path
(or (buffer-file-name buf)
(progn
(set-buffer buf)
(and dired-directory
(expand-file-name dired-directory)) )) ))
;;(message "checking %S: %S vs |%s|" buf path under)
(and path (string-match under path)
(progn
(message "Killing buffer %s" (buffer-name buf))
(kill-buffer buf))) ))
(buffer-list)))
... 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?
Tom
next prev parent reply other threads:[~2017-03-06 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-05 17:55 bug#25983: 25.2; set dired-directory in vc-dir mode Tom Tromey
2017-03-05 23:54 ` Glenn Morris
2017-03-06 0:04 ` Tom Tromey [this message]
2020-09-15 15:51 ` Lars Ingebrigtsen
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=87h9371d9f.fsf@tromey.com \
--to=tom@tromey.com \
--cc=25983@debbugs.gnu.org \
--cc=rgm@gnu.org \
/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).