unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50630: 28.0.50; list-directory shows free space for current directory, not the specified one
@ 2021-09-16 23:00 John Cummings
  2021-09-17  7:07 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: John Cummings @ 2021-09-16 23:00 UTC (permalink / raw)
  To: 50630

[-- Attachment #1: Type: text/plain, Size: 5082 bytes --]

Hello, long time emacs user; first time reporter. Apologies if I do anything wrong here.

The verbose output for list-directory always shows the free space for the current directory of the buffer where it was called, not the target directory that is supplied as an argument.

This may have been first introduced in 849051903e7, while fixing this report:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2002-03/msg00251.html
The result was that, while the *Directory* output buffer's current directory was set correctly, setting it last meant that the free space calculation always took place in "." rather than the argument to list-directory.

Here are commands/output to demonstrate. Note that the free space changes for the same directory argument when I change the current directory, since the two different directories are on different disks.


  (eval-expression (pwd) t)
  "Directory ~/emacs/"

  (eval-expression (list-directory "~" t) t)
  "/home/emacsdev/"

  (insert-buffer-substring "*Directory*")
  Directory /home/emacsdev
  total used in directory 0 available 15.5 GiB
  lrwxrwxrwx 1 /emacsdev /emacsdev 26 Sep 16 17:45 emacs -> /media/ubuntu/turkey/emacs
  lrwxrwxrwx 1 /emacsdev /emacsdev 34 Sep 16 17:44 emacs-project -> /media/ubuntu/turkey/emacs-project


  (cd "/")

  (eval-expression (pwd) t)
  "Directory /"

  (eval-expression (list-directory "~" t) t)
  "/home/emacsdev/"

  (insert-buffer-substring "*Directory*")
  Directory /home/emacsdev
  total used in directory 0 available 7.7 GiB
  lrwxrwxrwx 1 /emacsdev /emacsdev 26 Sep 16 17:45 emacs -> /media/ubuntu/turkey/emacs
  lrwxrwxrwx 1 /emacsdev /emacsdev 34 Sep 16 17:44 emacs-project -> /media/ubuntu/turkey/emacs-project

Changing the call to get-free-disk-space seemed to work in the attached patch, but I haven't attempted to dig deeper and check for any regressions. I would be glad to do that, but would need more time to research and would probably ask for more help to do it.

Thanks for everything!



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2021-09-10 built on ubuntu
Repository revision: ceb60225bacc7650b5e52032c0c33b9d67f9a6d7
Repository branch: master
System Description: Ubuntu 20.04.1 LTS

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils subr-x pcase
misearch multi-isearch vc-git diff-mode easy-mmode vc-dispatcher
bug-reference find-func cl-extra shortdoc text-property-search seq
mule-diag thingatpt help-fns radix-tree help-mode cl-loaddefs cl-lib
term/xterm xterm byte-opt gv bytecomp byte-compile cconv iso-transl
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer 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 composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 99674 10407)
 (symbols 48 8011 1)
 (strings 32 25795 958)
 (string-bytes 1 846999)
 (vectors 16 13457)
 (vector-slots 8 152638 6184)
 (floats 8 90 749)
 (intervals 56 1088 62)
 (buffers 992 16))



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-text-verbose-dir-fix.patch --]
[-- Type: text/x-patch; name=0001-text-verbose-dir-fix.patch, Size: 770 bytes --]

From 87dbf73c209e70382db64c2d196b761d656df409 Mon Sep 17 00:00:00 2001
From: emacs dev <noone@example.com>
Date: Thu, 16 Sep 2021 18:49:43 -0400
Subject: [PATCH] text verbose dir fix

---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 7e4bdab507..ef0c4ac458 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7608,7 +7608,7 @@ insert-directory
 		  ;; Replace "total" with "total used in directory" to
 		  ;; avoid confusion.
 		  (replace-match "total used in directory" nil nil nil 1)
-		  (let ((available (get-free-disk-space ".")))
+		  (let ((available (get-free-disk-space file)))
 		    (when available
 		      (end-of-line)
 		      (insert " available " available))))))))))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2021-09-25 19:58 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 23:00 bug#50630: 28.0.50; list-directory shows free space for current directory, not the specified one John Cummings
2021-09-17  7:07 ` Eli Zaretskii
2021-09-17 10:24   ` John Cummings
2021-09-17 10:36     ` Eli Zaretskii
2021-09-17 17:38   ` bug#50630: [External] : " Drew Adams
2021-09-17 18:04     ` Eli Zaretskii
2021-09-17 20:32       ` John Cummings
2021-09-18  5:56         ` Eli Zaretskii
2021-09-18 10:04           ` John Cummings
2021-09-21 10:57 ` bug#50630: Confirmation of instances in ls-lisp.el and tramp-sh.el John Cummings
2021-09-24 19:58 ` bug#50630: [PATCH] Add tests for insert-directory John Cummings
2021-09-25  1:47   ` Lars Ingebrigtsen
2021-09-25 10:45     ` John Cummings
2021-09-25 11:38       ` Michael Albinus
2021-09-25 12:13         ` John Cummings
2021-09-25  6:10   ` Eli Zaretskii
2021-09-25 11:38     ` John Cummings
2021-09-25 12:30       ` John Cummings
2021-09-25 13:06       ` Eli Zaretskii
2021-09-25 14:29         ` John Cummings
2021-09-25 14:55           ` Eli Zaretskii
2021-09-25 17:15             ` John Cummings
2021-09-25 17:26               ` Eli Zaretskii
2021-09-25 17:37                 ` John Cummings
2021-09-25 17:44                   ` Eli Zaretskii
2021-09-25 18:01                     ` John Cummings
2021-09-25 18:44                       ` Eli Zaretskii
2021-09-25 19:00                         ` John Cummings
2021-09-25 19:07                           ` Eli Zaretskii
2021-09-25 19:58                             ` John Cummings

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