all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27843: 26.0.50; Dired w/ eshell insert subdirs content when dir-or-list is a cons
@ 2017-07-27  3:19 Tino Calancha
  2017-07-27  9:26 ` Tino Calancha
  2017-07-29  9:04 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Tino Calancha @ 2017-07-27  3:19 UTC (permalink / raw)
  To: 27843

emacs -r -Q -l ls-lisp -eval "(setq ls-lisp-use-insert-directory-program t)"
;; Following form must lists just 2 entries in Dired:
M-: (dired (list source-directory "README" "lisp")) RET

;; In fact, it inserts the full content of subdir "lisp".

--8<-----------------------------cut here---------------start------------->8---
commit 6216ea9470feabf22333988f02203334fcfd2e26
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Thu Jul 27 12:09:00 2017 +0900

    Dired w/ eshell: Don't insert subdirs content if dir-or-list is a cons
    
    * lisp/eshell/em-ls.el (eshell-ls--insert-directory):
    Append '("-d") into 'eshell-ls-dired-initial-args'
    when 'dired-directory' is a cons (Bug#27843).
    * test/lisp/dired-tests.el (dired-test-bug27843): Add test.

diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 79799db30b..367ec69489 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -276,8 +276,10 @@ eshell-ls--insert-directory
           (let ((insert-func 'insert)
                 (error-func 'insert)
                 (flush-func 'ignore)
-                eshell-ls-dired-initial-args)
-            (eshell-do-ls (append switches (list file)))))))))
+                (switches (append eshell-ls-dired-initial-args
+                                  (and (consp dired-directory) (list "-d"))
+                                  switches)))
+            (eshell-do-ls (nconc switches (list file)))))))))
 
 (defsubst eshell/ls (&rest args)
   "An alias version of `eshell-do-ls'."
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 601d65768b..63b1e45e1f 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -188,5 +188,20 @@
       (customize-set-variable 'eshell-ls-use-in-dired orig)
       (and (buffer-live-p buf) (kill-buffer)))))
 
+(ert-deftest dired-test-bug27843 ()
+  "Test for http://debbugs.gnu.org/27843 ."
+  (require 'em-ls)
+  (let ((orig eshell-ls-use-in-dired)
+        (dired-use-ls-dired 'unspecified)
+        buf insert-directory-program)
+    (unwind-protect
+        (progn
+          (customize-set-variable 'eshell-ls-use-in-dired t)
+          (setq buf (dired (list source-directory "lisp")))
+          (dired-toggle-marks)
+          (should-not (cdr (dired-get-marked-files))))
+      (customize-set-variable 'eshell-ls-use-in-dired orig)
+      (and (buffer-live-p buf) (kill-buffer)))))
+
 (provide 'dired-tests)
 ;; dired-tests.el ends here

--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-07-26
Repository revision: e1e8d2e229f48b3cee765f7cf27ae04ee4401d85






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

end of thread, other threads:[~2017-08-01 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-27  3:19 bug#27843: 26.0.50; Dired w/ eshell insert subdirs content when dir-or-list is a cons Tino Calancha
2017-07-27  9:26 ` Tino Calancha
2017-07-29  9:07   ` Eli Zaretskii
2017-07-29  9:04 ` Eli Zaretskii
2017-08-01 14:34   ` Tino Calancha

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.