GNU bug report logs - #3250
23.0.93; tab completion flakey with tramp when insert-default-directory is nil

Previous Next

Package: emacs;

Reported by: Chris Withers <chris <at> simplistix.co.uk>

Date: Sat, 9 May 2009 17:40:04 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 3250 in the body.
You can then email your comments to 3250 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sat, 09 May 2009 17:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 09 May 2009 17:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Sat, 09 May 2009 18:37:00 +0100
With the following in my .emacs:

(setq insert-default-directory nil)

tab completion when using tramp to access a remote file becomes flakey.
It seems that the notion of the current working directory becomes lost,
so tab completion ends up with doubled up directories, eg:

/home/chris/afolder/afolder

...where afolder doesn't exist, resulting in errors such as the following:

File error: tramp-handle-file-name-all-completions: Couldn't `cd 
/home/chris/afolder/afolder/'

This doesn't happen right away, but I usually end up bumping into it 
when navigating
around a folder structure by inserting .. a number of times in the 
minibuffer window.

In GNU Emacs 23.0.93.1 (i386-mingw-nt5.1.2600)
 of 2009-05-02 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENG
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: GNUmakefile

Minor modes in effect:
  shell-dirtrack-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sat, 09 May 2009 22:45:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 09 May 2009 22:45:05 GMT) Full text and rfc822 format available.

Message #10 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Sat, 09 May 2009 18:37:21 -0400
> (setq insert-default-directory nil)

> tab completion when using tramp to access a remote file becomes flakey.
> It seems that the notion of the current working directory becomes lost,
> so tab completion ends up with doubled up directories, eg:

> /home/chris/afolder/afolder

> ...where afolder doesn't exist, resulting in errors such as the following:

> File error: tramp-handle-file-name-all-completions: Couldn't `cd
> /home/chris/afolder/afolder/'

> This doesn't happen right away, but I usually end up bumping into it when
> navigating
> around a folder structure by inserting .. a number of times in the
> minibuffer window.

I don't know if Michael can fix it based on the above report, but
I expect that a reproducible test case starting from "emacs -Q"
would help.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sat, 09 May 2009 23:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 09 May 2009 23:00:04 GMT) Full text and rfc822 format available.

Message #15 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Sat, 09 May 2009 23:51:49 +0100
Stefan Monnier wrote:
> I don't know if Michael can fix it based on the above report, but
> I expect that a reproducible test case starting from "emacs -Q"
> would help.

really not sure how to go about doing that, is there a how-to anywhere?

fwiw, not sure this is tramp related, I've had similar weirdity when 
just opening local files with (setq insert-default-directory nil).
The minibuffer just seems to get lost as to which directory it's in...

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 21:55:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 21:55:06 GMT) Full text and rfc822 format available.

Message #20 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Sun, 10 May 2009 17:50:41 -0400
> fwiw, not sure this is tramp related, I've had similar weirdity when
> just opening local files with (setq insert-default-directory nil).
> The minibuffer just seems to get lost as to which directory it's in...

Your description is too vague.  Please give exact, step by step
instructions about how to see this bug.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 21:55:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 21:55:08 GMT) Full text and rfc822 format available.

Message #25 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Sun, 10 May 2009 22:53:35 +0100
Chong Yidong wrote:
>> fwiw, not sure this is tramp related, I've had similar weirdity when
>> just opening local files with (setq insert-default-directory nil).
>> The minibuffer just seems to get lost as to which directory it's in...
> 
> Your description is too vague.  Please give exact, step by step
> instructions about how to see this bug.

It's a pretty vague bug :-S

Try:

-(setq insert-default-directory nil) in .emacs
-restart
C-x C-f
..
- then try using tab completion

Trying to get into a parent or the current directory and then using tab 
completion seems to be the root of the problem. I don't know any way of 
doing that other than using '../' as a path, and that seems to be what 
causes the problem.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 22:10:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 22:10:05 GMT) Full text and rfc822 format available.

Message #30 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Sun, 10 May 2009 18:04:14 -0400
Chris Withers <chris <at> simplistix.co.uk> writes:

> -(setq insert-default-directory nil) in .emacs
> -restart
> C-x C-f
> ..
> - then try using tab completion

Pressing TAB shows the contents of my home directory.  This is expected
behavior.  What behavior do you observe?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 22:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 22:15:05 GMT) Full text and rfc822 format available.

Message #35 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Sun, 10 May 2009 23:05:50 +0100
Chong Yidong wrote:
> Chris Withers <chris <at> simplistix.co.uk> writes:
> 
>> -(setq insert-default-directory nil) in .emacs
>> -restart
>> C-x C-f
>> ..
>> - then try using tab completion
> 
> Pressing TAB shows the contents of my home directory.  This is expected
> behavior.  What behavior do you observe?

Did you do the all important '..' to go to a parent directory?
Did you then try and tab-complete into a sub-directory?
Did you have (setq insert-default-directory nil) set in your .emacs file?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 22:30:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 22:30:05 GMT) Full text and rfc822 format available.

Message #40 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Sun, 10 May 2009 18:24:49 -0400
Chris Withers <chris <at> simplistix.co.uk> writes:

>>> -(setq insert-default-directory nil) in .emacs
>>> -restart
>>> C-x C-f
>>> ..
>>> - then try using tab completion
>>
>> Pressing TAB shows the contents of my home directory.  This is expected
>> behavior.  What behavior do you observe?
>
> Did you do the all important '..' to go to a parent directory?

After typing `..', I type TAB.  The text in the minibuffer completes to

  ../

After typing TAB again, Emacs offers a completions list showing the
directories in /home.  This is expected.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Sun, 10 May 2009 22:50:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 10 May 2009 22:50:03 GMT) Full text and rfc822 format available.

Message #45 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 3250 <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Sun, 10 May 2009 23:42:36 +0100
Chong Yidong wrote:
>> Did you do the all important '..' to go to a parent directory?
> 
> After typing `..', I type TAB.  The text in the minibuffer completes to
> 
>   ../
> 
> After typing TAB again, Emacs offers a completions list showing the
> directories in /home.  This is expected.

Okay, here's what I did:

- open a file in a folder
- C-x C-f
- .. TAB to go to parent folder of the folder containing the file you opened
- type 'so' and hit TAB
- minibuffer now shows "../something/", *Completions* shows contents of 
'something' folder
- now delete all characters in the minibuffer with backspace
- hit TAB, *Completions* still shows contents of 'something' folder
- type first two characters of a name in *Completions*, no completion 
happens [1]
- delete those two characters
- type 'so' and hit TAB
- minibuffer now shows "something/"
- hitting TAB one or two more times and *Completions* once more shows 
the contents of 'something' folder
- type first two characters of a name in *Completions*, no completion 
happens and current working directory in minibuffer seems very confused [1]

[1] these bullet points feel like bugs to me...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Mon, 11 May 2009 03:35:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 11 May 2009 03:35:04 GMT) Full text and rfc822 format available.

Message #50 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Sun, 10 May 2009 23:30:50 -0400
> Okay, here's what I did:

> - open a file in a folder
> - C-x C-f
> - .. TAB to go to parent folder of the folder containing the file you opened
> - type 'so' and hit TAB
> - minibuffer now shows "../something/", *Completions* shows contents of
> something' folder
> - now delete all characters in the minibuffer with backspace
> - hit TAB, *Completions* still shows contents of 'something' folder
> - type first two characters of a name in *Completions*, no completion
> happens [1]
> - delete those two characters
> - type 'so' and hit TAB
> - minibuffer now shows "something/"
> - hitting TAB one or two more times and *Completions* once more shows the
> contents of 'something' folder
> - type first two characters of a name in *Completions*, no completion
> happens and current working directory in minibuffer seems very confused [1]

> [1] these bullet points feel like bugs to me...

Thank you.  This should be enough for me (or whoever else gets to it
first, but it looks like a bug in my new completion code) to find
the problem.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Mon, 11 May 2009 08:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Withers <chris <at> simplistix.co.uk>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 11 May 2009 08:20:03 GMT) Full text and rfc822 format available.

Message #55 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 3250 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Mon, 11 May 2009 09:13:27 +0100
Stefan Monnier wrote:
> Thank you.  This should be enough for me (or whoever else gets to it
> first, but it looks like a bug in my new completion code) to find
> the problem.

Does this mean you can reproduce the problem(s)?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3250; Package emacs. (Mon, 11 May 2009 14:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 11 May 2009 14:20:03 GMT) Full text and rfc822 format available.

Message #60 received at 3250 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Mon, 11 May 2009 10:13:25 -0400
>> Thank you.  This should be enough for me (or whoever else gets to it
>> first, but it looks like a bug in my new completion code) to find
>> the problem.
> Does this mean you can reproduce the problem(s)?

Yes,


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 11 May 2009 15:40:07 GMT) Full text and rfc822 format available.

Notification sent to Chris Withers <chris <at> simplistix.co.uk>:
bug acknowledged by developer. (Mon, 11 May 2009 15:40:07 GMT) Full text and rfc822 format available.

Message #65 received at 3250-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chris Withers <chris <at> simplistix.co.uk>
Cc: 3250-done <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
Date: Mon, 11 May 2009 11:33:21 -0400
> Okay, here's what I did:

The recipe I used was:

   > emacs -Q
   C-x C-f
   C-a C-k
   TAB
   left right
   TAB
   left right
   TAB

where you see that default-directory moves up one level each time the
*Completions* buffer is refreshed.

The patch below fixes the problem,


        Stefan


--- simple.el.~1.986.~	2009-05-03 21:41:00.000000000 -0400
+++ simple.el	2009-05-11 11:30:20.000000000 -0400
@@ -5851,20 +5851,23 @@
 ;; after the text of the completion list buffer is written.
 (defun completion-setup-function ()
   (let* ((mainbuf (current-buffer))
-         (mbuf-contents (minibuffer-completion-contents))
-         common-string-length)
+         (base-dir
     ;; When reading a file name in the minibuffer,
-    ;; set default-directory in the minibuffer
-    ;; so it will get copied into the completion list buffer.
+          ;; try and find the right default-directory to set in the
+          ;; completion list buffer.
+          ;; FIXME: Why do we do that, actually?  --Stef
     (if minibuffer-completing-file-name
-	(with-current-buffer mainbuf
-	  (setq default-directory
-                (file-name-directory (expand-file-name mbuf-contents)))))
+              (file-name-as-directory
+               (expand-file-name
+                (substring (minibuffer-completion-contents)
+                           0 (or completion-base-size 0))))))
+         common-string-length)
     (with-current-buffer standard-output
       (let ((base-size completion-base-size)) ;Read before killing localvars.
         (completion-list-mode)
         (set (make-local-variable 'completion-base-size) base-size))
       (set (make-local-variable 'completion-reference-buffer) mainbuf)
+      (if base-dir (setq default-directory base-dir))
       (unless completion-base-size
         ;; This shouldn't be needed any more, but further analysis is needed
         ;; to make sure it's the case.




Message #66 received at 3250-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chris Withers <chris <at> simplistix.co.uk>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 3250-done <at> debbugs.gnu.org
Subject: Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory
 is nil
Date: Mon, 11 May 2009 23:03:54 +0100
Stefan Monnier wrote:
> The patch below fixes the problem,

Any idea which release this will land in and when that will be?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Tue, 09 Jun 2009 14:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 74 days ago.

Previous Next


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