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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (Emacs bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#3250: marked as done (23.0.93; tab completion flakey with 
 tramp when insert-default-directory is nil)
Date: Mon, 11 May 2009 15:40:07 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 11 May 2009 11:33:21 -0400
with message-id <jwvd4afirll.fsf-monnier+emacsbugreports <at> gnu.org>
and subject line Re: bug#3250: 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
has caused the Emacs bug report #3250,
regarding 23.0.93; tab completion flakey with tramp when insert-default-directory is nil
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact help-debbugs <at> gnu.org
immediately.)


-- 
3250: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3250
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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


[Message part 3 (message/rfc822, inline)]
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.


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

Previous Next


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