GNU bug report logs - #31495
26.1; filename completion -vs- "*"

Previous Next

Package: emacs;

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

Date: Fri, 18 May 2018 15:34:02 UTC

Severity: minor

Tags: fixed

Found in version 26.1

Fixed in version 28.1

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 31495 in the body.
You can then email your comments to 31495 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#31495; Package emacs. (Fri, 18 May 2018 15:34:02 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. (Fri, 18 May 2018 15:34:02 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: 26.1; filename completion -vs- "*"
Date: Fri, 18 May 2018 09:33:16 -0600
I found a situation where using "*" globbing in filename completion acts
strangely.

Here is how to set up to see the bug:

$ cd /tmp
$ mkdir -p a/b/c a/d/c
$ touch a/b/c/q

Now in Emacs, C-x C-f /tmp/a/*/c TAB

On the first TAB, a "/" is appended, and then point moves to the "/"
before "c".

Now type TAB again.
At this point, the "/tmp/a" is greyed out and the minibuffer shows:

Find file: /tmp/a//c/

... so now only completions for "/c" are available.

I think instead the "*" should be preserved.  Often I'm using this
feature to try to find a specific file where I don't know the exact
subdirectory it is in.





In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-05-11 built on pokyo
Repository revision: c9c0e40d673a5fc0d24d30ff67ccb7c7f2fb482a
Windowing system distributor 'Fedora Project', version 11.0.11906000
System Description:	Fedora release 27 (Twenty Seven)

Recent messages:
Mark set
Saving file /home/tromey/rust-debug.org...
Wrote /home/tromey/rust-debug.org
Saving file /home/tromey/rust-debug.org...
Wrote /home/tromey/rust-debug.org
Mark saved where search started [2 times]
Quit
Making completion list... [2 times]
Quit [3 times]
Invalid module name "flycheck_TestRustNames" [invalid-name] [2 times]

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

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

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

Major mode: Python

Minor modes in effect:
  ggtags-mode: t
  ggtags-navigation-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  diff-auto-refine-mode: t
  flyspell-mode: t
  shell-dirtrack-mode: t
  which-function-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  erc-match-mode: t
  erc-services-mode: t
  erc-networks-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
  flycheck-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Load-path shadows:
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/26.1/lisp/play/bubbles

Features:
(shadow emacsbug python tramp-sh js sgml-mode gud mailalias bbdb-sc
supercite regi mail-hist iso-transl eieio-opt speedbar sb-image ezimage
dframe pulse compare-w org-rmail org-mhe org-irc org-info org-gnus nnir
org-docview doc-view image-mode org-bibtex bibtex org-bbdb org-w3m
org-element avl-tree generator org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs novice eww
webjump url-http url-auth url-gw log-view pcvs-util wgrep find-dired
grep tcl pcmpl-unix shr-color smerge-mode term/xterm xterm goto-addr
find-file dabbrev copyright idutils pcase add-log ggtags etags xref
project compile bug-reference whitespace cc-mode cc-fonts cc-guess
cc-menus cc-cmds shr svg dom jka-compr gnus-html url-queue help-fns
radix-tree browse-url url-cache mm-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf bbdb-gui
bbdb-hooks bbdb-rmail rmailsum sort smiley gnus-cite flow-fill
mm-archive gnus-bcklg erc-list erc-menu erc-join erc-ring erc-pcomplete
erc-netsplit erc-spelling erc-truncate qp gnus-async gnus-ml disp-table
misearch multi-isearch vc-mtn vc-hg vc-git diff-mode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs gnus-topic nndraft nnmh nnfolder utf-7
bbdb-gnus bbdb-snarf mail-extr bbdb-com network-stream nsm starttls
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp
gnus-cache gnus-registry registry eieio-base gnus-art mm-uu mml2015
mm-view mml-smime smime dig mailcap gnus-sum gnus-group gnus-undo
smtpmail sendmail gnus-start gnus-cloud nnimap nnmail mail-source tls
gnutls utf7 netrc nnoo gnus-spec gnus-int gnus-range message rmc puny
rfc822 mml mml-sec epa derived epg mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr elec-pair flyspell ispell diminish appt
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
parse-time which-func imenu autorevert filenotify desktop frameset
cus-start cus-load git-link url-util erc-track erc-notify
erc-desktop-notifications erc-match erc-services erc-networks
notifications dbus xml erc-hl-nicks easy-mmode color erc-button erc-fill
erc-stamp wid-edit erc-goodies erc erc-backend erc-compat format-spec
thingatpt pp dired-aux dired-x dired dired-loaddefs warnings advice
vc-dir ewoc vc vc-dispatcher flycheck cl-extra json map find-func
help-mode rx subr-x dash cc-styles cc-align cc-engine cc-vars cc-defs
bbdb cl timezone ange-ftp comint ansi-color ring server savehist
finder-inf bbdb-autoloads lisppaste-autoloads pydoc-info-autoloads
info-look info package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib time-date mule-util 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 menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray 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 lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 2783408 275648)
 (symbols 48 120787 15)
 (miscs 40 37433 11144)
 (strings 32 465564 61374)
 (string-bytes 1 12103968)
 (vectors 16 162401)
 (vector-slots 8 3066382 196672)
 (floats 8 608 703)
 (intervals 56 263860 7322)
 (buffers 992 263))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Sat, 19 May 2018 13:33:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Tom Tromey <tom <at> tromey.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Michael Albinus <michael.albinus <at> gmx.de>,
 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Sat, 19 May 2018 22:32:03 +0900
Tom Tromey <tom <at> tromey.com> writes:

> I found a situation where using "*" globbing in filename completion acts
> strangely.
>
> Here is how to set up to see the bug:
>
> $ cd /tmp
> $ mkdir -p a/b/c a/d/c
> $ touch a/b/c/q
>
> Now in Emacs, C-x C-f /tmp/a/*/c TAB
>
> On the first TAB, a "/" is appended, and then point moves to the "/"
> before "c".
Yeah, it's broken.
In this example adding a '/' makes the completion works
C-x C-f /tmp/a/*/c/ TAB

> Now type TAB again.
> At this point, the "/tmp/a" is greyed out and the minibuffer shows:
>
> Find file: /tmp/a//c/
>
> ... so now only completions for "/c" are available.
>
> I think instead the "*" should be preserved.  Often I'm using this
> feature to try to find a specific file where I don't know the exact
> subdirectory it is in.
Since Emacs 26.1 dired supports wildcards in the directory part.
You can use
C-x d /tmp/a/*/c/q RET

If you shell in '/bin/sh' supports globstar (and have it enabled by
default) then you can do just:
C-x d /tmp/**/q RET

We could even let the user enable globstar in those shells supporting
it but having it disable by default (e.g. bash).
For instance, following patch:
--8<-----------------------------cut here---------------start------------->8---
commit 1c1116e6a6ed369db63ddf00865f04f687579e71
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Sat May 19 21:57:42 2018 +0900

    Handle globstar in dired
    
    Allow user to enable globstar when the shell support
    it and disable it by default (e.g. bash).
    * lisp/dired.el (dired-maybe-use-globstar): New user option.
    (dired-enable-globstar-in-shell): New variable.
    (dired-insert-directory): if `dired-maybe-use-globstar' is
    non-nil and the shell supports globstar, then enable it.
    
    * doc/emacs/dired.texi: Document feature.
    ; * etc/NEWS: Add entry.

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index fbb3030c2a..ad63c2f6a5 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -79,6 +79,24 @@ Dired Enter
 @samp{foo}.  The latter lists the files with extension @samp{.el}
 in all the subdirectories of @samp{foo}.
 
+When the system shell supports globstar and it's enabled, then you
+can use recursive globbing:
+
+@example
+C-x d  ~/foo/**/*.el  @key{RET}
+@end example
+
+This command lists all the files with extension @samp{.el} descending
+recursively in all the subdirectories of @samp{foo}.  Note that there
+are small differences in the implementation of globstar between shells.
+Check your shell manual to know the expected behavior.
+
+@vindex dired-maybe-use-globstar
+@vindex dired-enable-globstar-in-shell
+If the shell supports globstar and disables it by default, you
+can still enable this feature with @code{dired-maybe-use-globstar} if
+the shell is included in @code{dired-enable-globstar-in-shell}.
+
 The usual history and completion commands can be used in the minibuffer;
 in particular, @kbd{M-n} puts the name of the visited file (if any) in
 the minibuffer (@pxref{Minibuffer History}).
diff --git a/etc/NEWS b/etc/NEWS
index c7ffb17ad3..931289f0af 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -266,6 +266,12 @@ unescaping text.
 ** Dired
 
 +++
+*** The new user option 'dired-maybe-use-globstar' enables globstar
+in shells that support this feature.  The new variable
+'dired-enable-globstar-in-shell' lists which shells can have enabled
+globstar.
+
++++
 *** The new user option 'dired-create-destination-dirs' controls whether
 'dired-do-copy' and 'dired-rename-file' should create non-existent
 directories in the destination.
diff --git a/lisp/dired.el b/lisp/dired.el
index 1348df6934..0adffdbd3f 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -77,6 +77,26 @@ dired-subdir-switches
    :type '(choice (const :tag "Use dired-listing-switches" nil)
                   (string :tag "Switches")))
 
+(defcustom dired-maybe-use-globstar nil
+  "If non-nil, enable globstar if the shell support it.
+Some shells enable this feature by default (e.g. zsh or fish).
+
+See `dired-enable-globstar-in-shell' for a list of shells
+that support globstar and disable it by default.
+
+Note that the implementation of globstar have small differences
+between shells.  You must check your shell documentation to see
+what to expect."
+  :type 'boolean
+  :group 'dired)
+
+(defconst dired-enable-globstar-in-shell
+  '(("ksh" . "set -G")
+    ("bash" . "shopt -s globstar"))
+  "Alist of (SHELL . COMMAND), where COMMAND enables globstar in SHELL.
+If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory'
+checks this alist to enable globstar in the shell subprocess.")
+
 (defcustom dired-chown-program
   (purecopy (cond ((executable-find "chown") "chown")
                   ((file-executable-p "/usr/sbin/chown") "/usr/sbin/chown")
@@ -1297,6 +1317,13 @@ dired-insert-directory
                                  (executable-find explicit-shell-file-name))
                             (executable-find "sh")))
                     (switch (if remotep "-c" shell-command-switch)))
+               ;; Enable globstar
+               (when-let ((globstar dired-maybe-use-globstar)
+                          (enable-it
+                           (assoc-default
+                            (file-truename sh) dired-enable-globstar-in-shell
+                            (lambda (reg shell) (string-match reg shell)))))
+                 (setq script (format "%s; %s" enable-it script)))
                (unless
                    (zerop
                     (process-file sh nil (current-buffer) nil switch script))
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 12, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2018-05-17 built on calancha-pc
Repository revision: 593c367b0727affc739832ab4f4bdb9d7dd1ddd7




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Sat, 19 May 2018 18:19:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Sat, 19 May 2018 20:17:34 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

Hi Tino,

> We could even let the user enable globstar in those shells supporting
> it but having it disable by default (e.g. bash).

What about ls-lisp?

> +(defconst dired-enable-globstar-in-shell
> +  '(("ksh" . "set -G")
> +    ("bash" . "shopt -s globstar"))
> +  "Alist of (SHELL . COMMAND), where COMMAND enables globstar in SHELL.
> +If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory'
> +checks this alist to enable globstar in the shell subprocess.")

This works only if the shell name like bash or ksh is used. Often, just
/bin/sh is used, and you don't know which real shell this file is linked to.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Sun, 20 May 2018 02:20:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Sun, 20 May 2018 11:19:37 +0900
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Tino Calancha <tino.calancha <at> gmail.com> writes:
>
> Hi Tino,
>
>> We could even let the user enable globstar in those shells supporting
>> it but having it disable by default (e.g. bash).
>
> What about ls-lisp?
It would be great to have there but it's out of the
scope of the patch yet.   This is not about add a new dired
feature.  Instead, the target is to turn on a
feature from your shell that is disabled by default.

If you use em-ls you have this feature.  Same as if you use
external program `ls' from zsh or fish shells.
The idea is to let users if they want to enable globstar
in their shell when its disabled by default.

>> +(defconst dired-enable-globstar-in-shell
>> +  '(("ksh" . "set -G")
>> +    ("bash" . "shopt -s globstar"))
>> +  "Alist of (SHELL . COMMAND), where COMMAND enables globstar in SHELL.
>> +If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory'
>> +checks this alist to enable globstar in the shell subprocess.")
>
> This works only if the shell name like bash or ksh is used. Often, just
> /bin/sh is used, and you don't know which real shell this file is linked to.
My patch use `file-truename' to get the actual shell
used by `dired-insert-directory'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Wed, 20 Jun 2018 12:37:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Michael Albinus <michael.albinus <at> gmx.de>, 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Wed, 20 Jun 2018 08:36:35 -0400
severity 31495 minor
quit

Tino Calancha <tino.calancha <at> gmail.com> writes:

> Tom Tromey <tom <at> tromey.com> writes:
>
>> Now in Emacs, C-x C-f /tmp/a/*/c TAB
>>
>> On the first TAB, a "/" is appended, and then point moves to the "/"
>> before "c".
> Yeah, it's broken.
> In this example adding a '/' makes the completion works
> C-x C-f /tmp/a/*/c/ TAB

Hmm, that makes it seem like the different behaviour without the
trailing slash is on purpose (though I can't see what that would be).

> +(defconst dired-enable-globstar-in-shell
> +  '(("ksh" . "set -G")
> +    ("bash" . "shopt -s globstar"))
> +  "Alist of (SHELL . COMMAND), where COMMAND enables globstar in SHELL.
> +If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory'
> +checks this alist to enable globstar in the shell subprocess.")

Shouldn't this be a defvar or a defcustom?  Using defconst makes it seem
like the code wouldn't handle it being changed.




Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 20 Jun 2018 12:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Wed, 20 Jun 2018 12:49:01 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Michael Albinus <michael.albinus <at> gmx.de>, 31495 <at> debbugs.gnu.org,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Wed, 20 Jun 2018 21:48:40 +0900 (JST)

>> +(defconst dired-enable-globstar-in-shell
>> +  '(("ksh" . "set -G")
>> +    ("bash" . "shopt -s globstar"))
>> +  "Alist of (SHELL . COMMAND), where COMMAND enables globstar in SHELL.
>> +If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory'
>> +checks this alist to enable globstar in the shell subprocess.")
>
> Shouldn't this be a defvar or a defcustom?  Using defconst makes it seem
> like the code wouldn't handle it being changed.
To indicate what shells Emacs is supporting for 
this feature.  Of course it might be a defvar, and users might change that adding other 
shells; but then, those shells might not been heavily tested by Emacs 
developers, and other features can break.
I just wanted to be conservative.

I think that is a cheap and useful addition.  I like it.
I set '/bin/sh' to '/bin/zsh' mainly to have globstar in dired; often,
I find that I reset it to 'bash' and globstar stop working with Dired :-(




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Wed, 20 Jun 2018 13:09:01 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Michael Albinus <michael.albinus <at> gmx.de>, Noam Postavsky <npostavs <at> gmail.com>,
 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Wed, 20 Jun 2018 22:08:23 +0900 (JST)

> I set '/bin/sh' to '/bin/zsh' mainly to have globstar in dired; often,
> I find that I reset it to 'bash' and globstar stop working with Dired :-(
You might be wondering why I reset back '/bin/sh' to '/bin/bash'.
The reason is that `shell-prompt-pattern' doesn't recognize my 
zsh prompt;
that means, if I want to visit dired as root:
emacs -Q 
C-x d /sudo::/bin
;; this command won't end if I am using zsh.
;; It works OK with other shells (dash, bash, etc).

I can modify `shell-prompt-pattern' myself but if I use
emacs -Q
still I cannot use dired as root in that case, which it's handy.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Wed, 20 Jun 2018 14:07:03 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Noam Postavsky <npostavs <at> gmail.com>, 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Wed, 20 Jun 2018 16:05:50 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

> C-x d /sudo::/bin
> ;; this command won't end if I am using zsh.
> ;; It works OK with other shells (dash, bash, etc).

Problems of cooperation between Tramp and zsh are discussed in the Tramp
manual.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Thu, 21 Jun 2018 01:51:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Noam Postavsky <npostavs <at> gmail.com>, 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Thu, 21 Jun 2018 10:50:18 +0900
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Tino Calancha <tino.calancha <at> gmail.com> writes:
>
>> C-x d /sudo::/bin
>> ;; this command won't end if I am using zsh.
>> ;; It works OK with other shells (dash, bash, etc).
>
> Problems of cooperation between Tramp and zsh are discussed in the Tramp
> manual.
Thank you,

I find-grep 'zsh' in doc, and I found from tramp manual just this:
When using zsh on remote hosts, disable zsh line editor because zsh
uses left-hand side and right-hand side prompts in parallel.  Add the
following line to @file{~/.zshrc}:

@example
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
@end example

Then, I add such line in
~/.zsh
and
/root/.zsh
sudo ln -sf /bin/zsh /bin/sh
emacs -Q
C-x d /sudo::/bin
;; I don't get prompt for root password

ln -sf /bin/bash /bin/sh
C-x d /sudo::/bin
;; OK, but I lost globstar sniff, sniff :-(




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Thu, 21 Jun 2018 07:20:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Noam Postavsky <npostavs <at> gmail.com>, 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Thu, 21 Jun 2018 09:19:17 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

Hi Tino,

this discussion is going offtopic. Maybe you write a bug report?

> I find-grep 'zsh' in doc, and I found from tramp manual just this:
> When using zsh on remote hosts, disable zsh line editor because zsh
> uses left-hand side and right-hand side prompts in parallel.  Add the
> following line to @file{~/.zshrc}:
>
> @example
> [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
> @end example
>
> Then, I add such line in
> ~/.zsh
> and
> /root/.zsh
> sudo ln -sf /bin/zsh /bin/sh
> emacs -Q
> C-x d /sudo::/bin
> ;; I don't get prompt for root password

Please eval (setq tramp-verbose 10) prior opening your remote
directory. There will be a Tramp debug buffer; pls show it.

Out of curiosity, why do you edit ~/.zsh and /root/.zsh? The manual
speaks about ~/.zshrc (I'm not an zsh user, so I don't know what I'm
speaking about).

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Thu, 21 Jun 2018 07:46:02 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 31495 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Tom Tromey <tom <at> tromey.com>, Noam Postavsky <npostavs <at> gmail.com>,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Thu, 21 Jun 2018 16:44:50 +0900 (JST)

On Thu, 21 Jun 2018, Michael Albinus wrote:

> this discussion is going offtopic. Maybe you write a bug report?
You are right.  Sorry for that.

>> I find-grep 'zsh' in doc, and I found from tramp manual just this:
>> When using zsh on remote hosts, disable zsh line editor because zsh
>> uses left-hand side and right-hand side prompts in parallel.  Add the
>> following line to @file{~/.zshrc}:
>>
>> @example
>> [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
>> @end example
>>
>> Then, I add such line in
>> ~/.zsh
>> and
>> /root/.zsh
>> sudo ln -sf /bin/zsh /bin/sh
>> emacs -Q
>> C-x d /sudo::/bin
>> ;; I don't get prompt for root password
>
> Please eval (setq tramp-verbose 10) prior opening your remote
> directory. There will be a Tramp debug buffer; pls show it.
This must go in the new bug report whenever it exists.

> Out of curiosity, why do you edit ~/.zsh and /root/.zsh? The manual
> speaks about ~/.zshrc (I'm not an zsh user, so I don't know what I'm
> speaking about).
Good catch!
My typo in the email.  I actually created:
~/.zshrc
/root/.zshrc


> Best regards, Michael
My best regards too,
Tino




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31495; Package emacs. (Sat, 22 Aug 2020 15:41:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Tom Tromey <tom <at> tromey.com>,
 Michael Albinus <michael.albinus <at> gmx.de>, 31495 <at> debbugs.gnu.org
Subject: Re: bug#31495: 26.1; filename completion -vs- "*"
Date: Sat, 22 Aug 2020 17:40:08 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

> We could even let the user enable globstar in those shells supporting
> it but having it disable by default (e.g. bash).
> For instance, following patch:
>
> commit 1c1116e6a6ed369db63ddf00865f04f687579e71
> Author: Tino Calancha <tino.calancha <at> gmail.com>
> Date:   Sat May 19 21:57:42 2018 +0900
>
>     Handle globstar in dired
>
>     Allow user to enable globstar when the shell support
>     it and disable it by default (e.g. bash).
>     * lisp/dired.el (dired-maybe-use-globstar): New user option.
>     (dired-enable-globstar-in-shell): New variable.
>     (dired-insert-directory): if `dired-maybe-use-globstar' is
>     non-nil and the shell supports globstar, then enable it.
>
>     * doc/emacs/dired.texi: Document feature.
>     ; * etc/NEWS: Add entry.

Makes sense to me, so I've applied it to Emacs 28.  Only very lightly
tested, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 22 Aug 2020 15:41:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 31495 <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. (Sat, 22 Aug 2020 15:41: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. (Sun, 20 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

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

Previous Next


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