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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25983 in the body.
You can then email your comments to 25983 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25983; Package emacs. (Sun, 05 Mar 2017 17:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Tromey <tom <at> tromey.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Mar 2017 17:56:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; set dired-directory in vc-dir mode
Date: Sun, 05 Mar 2017 10:55:21 -0700
I'd find it handy if vc-dir buffers had dired-directory set.
This can serve as an indication that the buffer is associated with some
directory, even though it's not visiting a file.

I've appended the patch I would like to apply.
Let me know what you think.

Tom


diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 0363aab..2281333 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1016,6 +1016,7 @@ vc-dir-mode
     (set (make-local-variable 'vc-ewoc) (ewoc-create #'vc-dir-printer))
     (set (make-local-variable 'revert-buffer-function)
 	 'vc-dir-revert-buffer-function)
+    (setq dired-directory default-directory)
     (setq list-buffers-directory (expand-file-name "*vc-dir*" default-directory))
     (add-to-list 'vc-dir-buffers (current-buffer))
     ;; Make sure that if the directory buffer is killed, the update





In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.8)
 of 2017-03-02 built on bapiya
Repository revision: 6e788ef0e262fafc014c21f4ad52cc5dc9f1715b
Windowing system distributor 'Fedora Project', version 11.0.11901000
System Description:	Fedora release 25 (Twenty Five)

Configured using:
 'configure --prefix=/home/tromey/Emacs/install/ --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: VC dir

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set [2 times]
Sending...
Mark set [2 times]
Sending via mail...
Type C-x 1 to delete the help window. [2 times]
Sending email 
Sending email done
Sending...done
a is undefined
Scanning for dabbrevs...done

Load-path shadows:
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/25.2/lisp/play/bubbles
/home/tromey/.emacs.d/elpa/soap-client-3.1.1/soap-inspect hides /home/tromey/Emacs/install/share/emacs/25.2/lisp/net/soap-inspect
/home/tromey/.emacs.d/elpa/soap-client-3.1.1/soap-client hides /home/tromey/Emacs/install/share/emacs/25.2/lisp/net/soap-client

Features:
(shadow emacsbug network-stream nsm starttls tls gnutls mailalias
smtpmail sort mailcap bbdb-message sendmail mail-extr vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs whitespace log-edit message idna dired
rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
pcvs-util cc-mode cc-fonts cc-guess cc-menus cc-cmds shell rx dabbrev
eieio-opt speedbar sb-image ezimage dframe find-func copyright debug
add-log vc-git diff-mode easy-mmode misearch multi-isearch jka-compr
flyspell ispell diminish edmacro kmacro projectile grep compile ibuf-ext
ibuffer dash appt diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs which-func imenu minimap autorevert filenotify cus-start
cus-load status erc-services erc-list erc-menu erc-join erc-ring
erc-networks erc-pcomplete pcomplete erc-track erc-match erc-netsplit
erc-hl-nicks color erc-button erc-fill erc-stamp wid-edit erc-goodies
erc erc-backend erc-compat format-spec auth-source eieio gnus-util
mm-util help-fns mail-prsvr password-cache thingatpt pp warnings advice
vc-dir ewoc vc vc-dispatcher cc-styles cc-align cc-engine cc-vars
cc-defs bbdb bbdb-site timezone ange-ftp comint ansi-color ring server
savehist finder-inf dwarf-mode-autoloads gdb-shell-autoloads eieio-core
lisppaste-autoloads pydoc-info-autoloads info-look cl-seq cl-macs cl
weblogger-autoloads info package epg-config seq byte-opt gv bytecomp
byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib
bbdb-loaddefs time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 349646 37130)
 (symbols 48 38486 0)
 (miscs 40 928 1341)
 (strings 32 81666 10590)
 (string-bytes 1 2782947)
 (vectors 16 40092)
 (vector-slots 8 1457709 144853)
 (floats 8 533 448)
 (intervals 56 14838 166)
 (buffers 976 42))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25983; Package emacs. (Sun, 05 Mar 2017 23:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 25983 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Tom Tromey <tom <at> tromey.com>
Cc: 25983 <at> debbugs.gnu.org
Subject: Re: bug#25983: 25.2; set dired-directory in vc-dir mode
Date: Sun, 05 Mar 2017 18:54:51 -0500
Tom Tromey wrote:

> I'd find it handy if vc-dir buffers had dired-directory set.
> This can serve as an indication that the buffer is associated with some
> directory, even though it's not visiting a file.

Is dired-directory not basically an internal dired variable that should
only be set in Dired mode, and modes derived from it, which vc-dir is not?

    Documentation:
    The directory name or wildcard spec that this Dired directory lists.
    Local to each Dired buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25983; Package emacs. (Mon, 06 Mar 2017 00:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 25983 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25983; Package emacs. (Tue, 15 Sep 2020 15:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 25983 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Tom Tromey <tom <at> tromey.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 25983 <at> debbugs.gnu.org
Subject: Re: bug#25983: 25.2; set dired-directory in vc-dir mode
Date: Tue, 15 Sep 2020 17:51:22 +0200
Tom Tromey <tom <at> tromey.com> writes:

>>>>>> "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.

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




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 15 Sep 2020 15:52:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25983 <at> debbugs.gnu.org and Tom Tromey <tom <at> tromey.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 15 Sep 2020 15:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 14 Oct 2020 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 193 days ago.

Previous Next


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