GNU bug report logs - #25983
25.2; set dired-directory in vc-dir mode

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Sun, 5 Mar 2017 17:56:01 UTC

Severity: wishlist

Tags: wontfix

Found in version 25.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tom Tromey <tom <at> tromey.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Tom Tromey <tom <at> tromey.com>, 25983 <at> debbugs.gnu.org
Subject: bug#25983: 25.2; set dired-directory in vc-dir mode
Date: Sun, 05 Mar 2017 17:04:44 -0700
>>>>> "GM" == Glenn Morris <rgm <at> 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




This bug report was last modified 4 years and 300 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.