GNU bug report logs - #28096
25.2; c-a-p/shell/ielm: Broken directory completion for directories that contain spaces

Previous Next

Package: emacs;

Reported by: xristos <xristos <at> sdf.lonestar.org>

Date: Tue, 15 Aug 2017 12:49:02 UTC

Severity: minor

Tags: confirmed

Found in versions 26.1, 25.2

To reply to this bug, email your comments to 28096 AT debbugs.gnu.org.

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#28096; Package emacs. (Tue, 15 Aug 2017 12:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to xristos <xristos <at> sdf.lonestar.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 15 Aug 2017 12:49:02 GMT) Full text and rfc822 format available.

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

From: xristos <xristos <at> sdf.lonestar.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Tue, 15 Aug 2017 08:42:26 -0400
emacs -Q
M-x shell
;; First create the directory structure for the test
cd /tmp/ RET
mkdir "Directory One" RET
mkdir "Directory Two" RET
;; Try to complete in shell
cd D<TAB>
;; Completes to Directory\
<TAB>
;; No match shown in *Messages* (unexpected, should list the two directories)
C-a-k
cd Directory\ O<TAB>
;; No match shown in *Messages* (unexpected, should complete Directory\ One)

;;; For ielm, we try completion inside a string

M-x ielm
"/tmp/D<TAB>
;; Completes to "/tmp/Directory
<TAB>
;; Nothing shown in *Messages*, no completion (unexpected, should list the two directories)
C-a-k
"/tmp/Directory O<TAB>
;; No match shown in *Messages*, no completion (unexpected, should complete
Directory One)


completion-at-point-functions in *ielm*:
(comint-replace-by-expanded-history ielm-complete-filename
elisp-completion-at-point)

completion-at-point-functions in *shell*:
(comint-completion-at-point t)


In GNU Emacs 25.2.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1611))
 of 2017-08-07 built on elcapitan.internal.macports.net
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --prefix=/opt/local --without-ns --without-dbus
 --without-gconf --without-libotf --without-m17n-flt --without-gpm
 --without-gnutls --with-xml2 --with-modules --infodir
 /opt/local/share/info/emacs --with-ns CC=/usr/bin/clang 'CFLAGS=-pipe
 -Os -arch x86_64' 'LDFLAGS=-L/opt/local/lib
 -Wl,-headerpad_max_install_names -Wl,-no_pie -arch x86_64'
 CPPFLAGS=-I/opt/local/include'

Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

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

Major mode: IELM

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-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
  transient-mark-mode: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28096; Package emacs. (Mon, 02 Apr 2018 08:38:02 GMT) Full text and rfc822 format available.

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

From: Eric Skoglund <eric <at> pagefault.se>
To: xristos <xristos <at> sdf.lonestar.org>
Cc: , 28096 <at> https, 28096 <at> debbugs.gnu.org
Subject: Re: bug#28096: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Mon, 02 Apr 2018 10:37:01 +0200
Seems like this is fixed, I was unable to reproduce this for both the
master and emacs-26 branches.

// Eric




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28096; Package emacs. (Wed, 30 May 2018 07:56:01 GMT) Full text and rfc822 format available.

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

From: xristos <xristos <at> sdf.org>
To: Eric Skoglund <eric <at> pagefault.se>
Cc: xristos <xristos <at> sdf.lonestar.org>, 28096 <at> debbugs.gnu.org
Subject: Re: bug#28096: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Tue, 29 May 2018 20:08:06 -0400
This is still an open issue for me on Emacs 26.1 (Linux and OSX).

I asked a few people from #emacs to try and reproduce on 26.1,
they all reported that the issue is still there.

On Mon, 02 Apr 2018 10:37:01 +0200, 
Eric Skoglund <eric <at> pagefault.se> wrote:
> Seems like this is fixed, I was unable to reproduce this for both the
> master and emacs-26 branches.
>
> // Eric




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28096; Package emacs. (Wed, 30 May 2018 10:48:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: xristos <xristos <at> sdf.org>
Cc: xristos <xristos <at> sdf.lonestar.org>, 28096 <at> debbugs.gnu.org,
 Eric Skoglund <eric <at> pagefault.se>
Subject: Re: bug#28096: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Wed, 30 May 2018 06:47:46 -0400
tags 28096 + confirmed
found 28096 26.1
severity 28096 minor
quit

xristos <xristos <at> sdf.org> writes:

> This is still an open issue for me on Emacs 26.1 (Linux and OSX).

Yup, I can reproduce it.  One minor question, what does the "C-a-k" mean
in your original report?





Added tag(s) confirmed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 30 May 2018 10:48:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 26.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 30 May 2018 10:48:02 GMT) Full text and rfc822 format available.

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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28096; Package emacs. (Wed, 30 May 2018 12:14:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: xristos <xristos <at> sdf.lonestar.org>, xristos <xristos <at> sdf.org>,
 28096 <at> debbugs.gnu.org, Eric Skoglund <eric <at> pagefault.se>
Subject: Re: bug#28096: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Wed, 30 May 2018 13:13:02 +0100
[Message part 1 (text/plain, inline)]
Noam Postavsky <npostavs <at> gmail.com> writes:

> One minor question, what does the "C-a-k" mean
> in your original report?

I think Xristos meant C-a C-k.

The only thing needed to make ielm file name completion work on my
system (see signature for its details) is to add ?\s to
comint-file-name-chars, e.g.:

[ielm.diff (text/x-diff, inline)]
diff --git a/lisp/ielm.el b/lisp/ielm.el
index b4ad69e4c7..4bb6e752e8 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -546,6 +546,8 @@ inferior-emacs-lisp-mode
   (set (make-local-variable 'paragraph-start) comint-prompt-regexp)
   (setq comint-input-sender 'ielm-input-sender)
   (setq comint-process-echoes nil)
+  (unless (string-match-p " " comint-file-name-chars)
+    (setq comint-file-name-chars (concat " " comint-file-name-chars)))
   (set (make-local-variable 'completion-at-point-functions)
        '(comint-replace-by-expanded-history
          ielm-complete-filename elisp-completion-at-point))
[Message part 3 (text/plain, inline)]
As for shell, file name completion only seems to breaks down for me when
completing a relative file name argument to the cd command in
particular:

0. emacs -Q
1. M-x shell RET
2. cd /tmp/
   [shell doesn't seem to support dynamic cd arguments such as
    "$(mktemp -d)".]
3. mkdir dir\ one dir\ two RET
4. cd /tmp/dir TAB
   [Completes to "/tmp/dir\ ".]
5. TAB
   [Offers "dir\ one/" and "dir\ two/" as completion candidates.]
6. o TAB
   [Completes to "/tmp/dir\ one/".]

Replacing cd with ls (or pretty much any other string, let alone valid
command) in step 4 exhibits the same correct behaviour.  Doing so in
OP's recipe (which tries to complete relative file names), however, does
not seem to struggle in the same way as cd completion:

Steps 0-3 as before.
4. ls dir TAB
   [Completes to "dir\ ".]
5. TAB
   [Offers "dir\ one/" and "dir\ two/" as completion candidates.]
5. o TAB
   [Completes to "/tmp/dir\ one/".]

I'm not familiar with the workings of shell, but it seems like it's
trying to be smart about cd completion and falling a bit short.

-- 
Basil

In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-05-27 built on thunk
Repository revision: 0f48d18fd2a30f29cc3592a835d2a2254c9b0afb
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid

"${SHELL}" --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28096; Package emacs. (Wed, 30 May 2018 13:45:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: xristos <xristos <at> sdf.org>, 28096 <at> debbugs.gnu.org,
 Eric Skoglund <eric <at> pagefault.se>
Subject: Re: bug#28096: 25.2;
 c-a-p/shell/ielm: Broken directory completion for directories that
 contain spaces
Date: Wed, 30 May 2018 14:44:35 +0100
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> I'm not familiar with the workings of shell, but it seems like it's
> trying to be smart about cd completion and falling a bit short.

After a bit more digging (see bug#11348 and bug#11607), it looks like
the culprit is pcomplete/cd.  I'm far from familiar with pcomplete, and
edebugging pcomplete-entries and pcomplete--entries did not reveal
anything obviously amiss to me, so my current workaround, inspired by
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=11348#26, is to:

(with-eval-after-load 'shell
  (setq shell-dynamic-complete-functions
        (delq #'pcomplete-completions-at-point
              shell-dynamic-complete-functions)))

-- 
Basil




This bug report was last modified 7 years and 25 days ago.

Previous Next


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