* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. @ 2011-10-19 4:53 Thierry Volpiatto 2011-10-20 2:31 ` Stefan Monnier 0 siblings, 1 reply; 13+ messages in thread From: Thierry Volpiatto @ 2011-10-19 4:53 UTC (permalink / raw) To: 9793 Hi all, Eshell completion (pcomplete) fail when a hostname starting with "t" is present in "~/.ssh/config". To reproduce: Create such a shortcut in "~/.ssh/config" say "toto". Start eshell. enter: cd \t and try to complete with <tab> (we want to complete to /tmp here) In GNU Emacs 24.0.90.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2011-10-18 on thierry-MM061 Windowing system distributor `The X.Org Foundation', version 11.0.11004000 configured using `configure '--with-x-toolkit=lucid' '--without-gconf' '--without-gsettings'' 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: fr_FR.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Org-Agenda Week Diary Ddl Grid Minor modes in effect: TeX-PDF-mode: t auto-image-file-mode: t show-paren-mode: t display-time-mode: t recentf-mode: t savehist-mode: t minibuffer-depth-indicate-mode: t diff-auto-refine-mode: t anything-completion-mode: t anything-dired-mode: Enable anything completion in Dired functions. Bindings affected are C, R, S, H. This is deprecated for Emacs24+ users, use `ac-mode' instead. shell-dirtrack-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-g s <return> M-n <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> C-j <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <right> <right> <right> C-h f <return> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <down> <up> <down> <up> q <down> <down> <down> <down> <down> C-z l <return> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <right> <backspace> M-x c o m p l e <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <return> <backspace> <backspace> <backspace> <backspace> d e M-x <return> <backspace> <backspace> <backspace> <backspace> <backspace> ( d e f <backspace> M-x c o m p l e t i o n <down> <down> <down> <down> <down> <return> C-< C-x k <return> M-x l i s p <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <return> <left> C-h f C-z C-g <right> <backspace> <backspace> C-z 1 <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <return> <left> <left> <left> <left> <left> <left> <left> C-c a a C-x C-² M-x r e p o < return> Recent messages: Preparing diary...done Preparing diary...done Preparing diary...done Preparing diary...done Preparing diary...done Preparing diary...done Preparing diary...done Invalid face reference: quote [181 times] Invalid face reference: quote [125 times] Load-path shadows: None found. Features: (shadow epa-mail emacsbug flow-fill smiley gnus-cite mail-extr qp gnus-async gnus-bcklg gnus-ml nndraft nnmh utf-7 nnimap utf7 nnml nnfolder netrc network-stream starttls tls gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache gnus-dired debug find-func cal-iso preview prv-emacs tex-buf reftex-vcr reftex-dcr reftex-auc reftex imenu reftex-vars font-latex latex tex-style tex latexenc conf-mode newcomment vc-git xgit-dvc xgit xgit-annotate rect dvc-annotate xgit-log dvc-revlist vc-rcs sh-script xhg-dvc xhg xhg-annotate xhg-mq xhg-log dvc-diff uniquify dvc-fileinfo bzr-core xdarcs-core xgit-core xhg-core xmtn-minimal naquadah-theme em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner em-alias esh-var esh-io esh-cmd esh-ext esh-proc esh-groups eshell esh-module esh-mode align-let server slime-xref-browser slime-banner slime-tramp slime-asdf slime-fancy slime-fontifying-fu slime-package-fu slime-references slime-scratch slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-repl image-file newsticker newst-treeview newst-plainview newst-reader newst-ticker newst-backend xdvi-search em-term term ehelp electric pdbtrack whitespace paren time winner mime-w3m mime eword-decode mel path-util mime-parse std11 luna mime-def mcharset mcs-20 mcs-e20 pces pces-e20 pces-20 broken pcustom poe w3m-load help-mode view avoid tramp-cache tramp-sh recentf tree-widget savehist googlecl google-maps google-maps-static google-maps-geocode google-maps-base json simple-call-tree el-expectations el-mock csv2org iedit zop-to-char mule-util alist pym static apel-ver product elscreen smallurl mm-url xml-weather rectangle-utils tv-utils pcvs pcvs-parse pcvs-info pcvs-defs pcvs-util auto-document autodoc mb-depth ioccur moz cl-info slime hideshow hyperspec slime-autoloads ledger-config ledger esh-arg esh-util woman man esh-toggle em-xtra flymake ipython python-mode info-look ansi-color executable eldoc-eval eldoc no-word regex-tool dired-extension image-dired yaoddmuse skeleton sgml-mode emms-mplayer-config emms-playlist-limit emms-volume emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-lastfm-client parse-time emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time emms-lyrics emms-url hl-line emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer emms-info emms-streams later-do emms-source-playlist emms-source-file emms-player-simple emms-setup emms emms-compat dvc-init bzr-gnus tla-gnus xgit-gnus xhg-gnus gnus-art mm-uu mml2015 mm-view mml-smime smime dig nnir gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader dvc-gnus tla-core tla-autoconf tla-defs dvc-log vc vc-dispatcher dvc-unified dvc-tips add-log diff-mode ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff dvc-autoloads dvc-core dvc-lisp dvc-buffers dvc-ui dvc-register dvc-utils dvc-emacs ewoc dvc-defs dvc-site htmlize-hack htmlize muse-colors muse-docbook muse-texinfo texnfo-upd texinfo muse-latex muse-html muse-xml-common muse-wiki cus-edit cus-start cus-load muse-publish muse-project muse-protocols muse-regexps muse muse-nested-tags muse-mode muse-autoloads org-config-thierry org-crypt cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs vc-hg org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-agenda appt diary-lib diary-loaddefs org-annotation-helper org-capture org-mks remember org-remember org-datetree config-w3m w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb w3m-ems wid-edit w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util addressbook-bookmark message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol bookmark-uzbl-handler bookmark-firefox-handler bookmark-extensions org ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete org-list org-faces org-compat org-entities org-macs noutline outline cal-menu calendar cal-loaddefs bookmark pp init-anything-thierry anything-describe-keybindings anything-delicious anything-mercurial anything-stgit anything-config browse-url rx anything-match-plugin xml url url-proxy url-privacy url-expand url-methods url-history url-cookie url-util url-parse url-vars mailcap grep compile tramp tramp-compat shell pcomplete comint ring format-spec tramp-loaddefs dired-x dired-aux dired regexp-opt ffap thingatpt anything warnings epa-file epa derived epg epg-config auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util time-date mm-util mail-prsvr password-cache usage-memo eev-thierry edmacro kmacro iterator eev-all eev-mini-steps eev-browse-url eev-langs eev-compose eev-glyphs disp-table eev-insert eev-steps eev-bounded eev easy-mmode advice help-fns advice-preload cl w3m-wget preview-latex tex-site auto-loads info easymenu tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting font-render-setting x-toolkit x multi-tty emacs) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-19 4:53 bug#9793: 24.0.90; Unwanted tramp connection on eshell completion Thierry Volpiatto @ 2011-10-20 2:31 ` Stefan Monnier 2011-10-20 18:46 ` Thierry Volpiatto 0 siblings, 1 reply; 13+ messages in thread From: Stefan Monnier @ 2011-10-20 2:31 UTC (permalink / raw) To: Thierry Volpiatto; +Cc: 9793 > Eshell completion (pcomplete) fail when a hostname starting with "t" is > present in "~/.ssh/config". I have a "Host trex" entry in my ~/.ssh/config. > Start eshell. > enter: cd \t and try to complete with <tab> (we want to complete to /tmp > here) % emacs -Q M-x eshell cd /t TAB just gives me /tmp without any Tramp messages. IOW I can't reproduce it. Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-20 2:31 ` Stefan Monnier @ 2011-10-20 18:46 ` Thierry Volpiatto 2011-10-20 20:43 ` Stefan Monnier 0 siblings, 1 reply; 13+ messages in thread From: Thierry Volpiatto @ 2011-10-20 18:46 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793 Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Eshell completion (pcomplete) fail when a hostname starting with "t" is >> present in "~/.ssh/config". > > I have a "Host trex" entry in my ~/.ssh/config. > >> Start eshell. >> enter: cd \t and try to complete with <tab> (we want to complete to /tmp >> here) > > % emacs -Q > M-x eshell > cd /t TAB > just gives me /tmp without any Tramp messages. > > IOW I can't reproduce it. Because you didn't load tramp. Connect first to your "trex" or anything else, then close this, and run eshell and retry the above. For me too, if i start emacs -Q and i go strait to eshell, all work fine. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-20 18:46 ` Thierry Volpiatto @ 2011-10-20 20:43 ` Stefan Monnier 2011-10-20 21:17 ` Thierry Volpiatto 2011-10-22 9:39 ` Michael Albinus 0 siblings, 2 replies; 13+ messages in thread From: Stefan Monnier @ 2011-10-20 20:43 UTC (permalink / raw) To: Thierry Volpiatto; +Cc: 9793 > Because you didn't load tramp. > Connect first to your "trex" or anything else, then close this, and run > eshell and retry the above. > For me too, if i start emacs -Q and i go strait to eshell, all work fine. Ah, I see, I can reproduce it now: % emacs -Q M-x load-library RET tramp RET M-x eshell RET cd /t TAB At that point, Tramp tried to connect to `tic' and to `tequila' (the hosts mentioned in ~/.ssh/known_hosts that start with `t'). Note that I'm not sure that ~/.ssh/config is relevant, because it only seems to show entries from my ~/.ssh/known_hosts. Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-20 20:43 ` Stefan Monnier @ 2011-10-20 21:17 ` Thierry Volpiatto 2011-10-22 9:39 ` Michael Albinus 1 sibling, 0 replies; 13+ messages in thread From: Thierry Volpiatto @ 2011-10-20 21:17 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793 Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Because you didn't load tramp. >> Connect first to your "trex" or anything else, then close this, and run >> eshell and retry the above. >> For me too, if i start emacs -Q and i go strait to eshell, all work fine. > > Ah, I see, I can reproduce it now: > > % emacs -Q > M-x load-library RET tramp RET > M-x eshell RET > cd /t TAB > > At that point, Tramp tried to connect to `tic' and to `tequila' (the > hosts mentioned in ~/.ssh/known_hosts that start with `t'). > > Note that I'm not sure that ~/.ssh/config is relevant, because it only > seems to show entries from my ~/.ssh/known_hosts. Yes you are right, didn't think at this one. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-20 20:43 ` Stefan Monnier 2011-10-20 21:17 ` Thierry Volpiatto @ 2011-10-22 9:39 ` Michael Albinus 2011-10-22 10:39 ` Thierry Volpiatto 2011-10-23 17:47 ` Stefan Monnier 1 sibling, 2 replies; 13+ messages in thread From: Michael Albinus @ 2011-10-22 9:39 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793, Thierry Volpiatto Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Because you didn't load tramp. >> Connect first to your "trex" or anything else, then close this, and run >> eshell and retry the above. >> For me too, if i start emacs -Q and i go strait to eshell, all work fine. > > Ah, I see, I can reproduce it now: > > % emacs -Q > M-x load-library RET tramp RET > M-x eshell RET > cd /t TAB > > At that point, Tramp tried to connect to `tic' and to `tequila' (the > hosts mentioned in ~/.ssh/known_hosts that start with `t'). `pcomplete-dirs' uses `file-directory-p' as predicate, which is applied to all completion candidates. The following patch ought to fix it: --8<---------------cut here---------------start------------->8--- *** /home/albinus/src/emacs/lisp/pcomplete.el.~106161~ 2011-10-22 11:31:11.996458454 +0200 --- /home/albinus/src/emacs/lisp/pcomplete.el 2011-10-22 11:30:20.796204566 +0200 *************** *** 948,954 **** (defsubst pcomplete-dirs (&optional regexp) "Complete amongst a list of directories." ! (pcomplete-entries regexp 'file-directory-p)) ;; generation of completion lists --- 948,957 ---- (defsubst pcomplete-dirs (&optional regexp) "Complete amongst a list of directories." ! (pcomplete-entries regexp ! (lambda (dir) ! (or (file-remote-p (expand-file-name dir)) ! (file-directory-p dir))))) ;; generation of completion lists --8<---------------cut here---------------end--------------->8--- Comments? > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-22 9:39 ` Michael Albinus @ 2011-10-22 10:39 ` Thierry Volpiatto 2011-10-23 17:47 ` Stefan Monnier 1 sibling, 0 replies; 13+ messages in thread From: Thierry Volpiatto @ 2011-10-22 10:39 UTC (permalink / raw) To: Michael Albinus; +Cc: 9793 Michael Albinus <michael.albinus@gmx.de> writes: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >>> Because you didn't load tramp. >>> Connect first to your "trex" or anything else, then close this, and run >>> eshell and retry the above. >>> For me too, if i start emacs -Q and i go strait to eshell, all work fine. >> >> Ah, I see, I can reproduce it now: >> >> % emacs -Q >> M-x load-library RET tramp RET >> M-x eshell RET >> cd /t TAB >> >> At that point, Tramp tried to connect to `tic' and to `tequila' (the >> hosts mentioned in ~/.ssh/known_hosts that start with `t'). > > `pcomplete-dirs' uses `file-directory-p' as predicate, which is applied > to all completion candidates. The following patch ought to fix it: > > *** /home/albinus/src/emacs/lisp/pcomplete.el.~106161~ 2011-10-22 11:31:11.996458454 +0200 > --- /home/albinus/src/emacs/lisp/pcomplete.el 2011-10-22 11:30:20.796204566 +0200 > *************** > *** 948,954 **** > > (defsubst pcomplete-dirs (&optional regexp) > "Complete amongst a list of directories." > ! (pcomplete-entries regexp 'file-directory-p)) > > ;; generation of completion lists > > --- 948,957 ---- > > (defsubst pcomplete-dirs (&optional regexp) > "Complete amongst a list of directories." > ! (pcomplete-entries regexp > ! (lambda (dir) > ! (or (file-remote-p (expand-file-name dir)) > ! (file-directory-p dir))))) > > ;; generation of completion lists > > > Comments? Work fine here, thank you very much. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-22 9:39 ` Michael Albinus 2011-10-22 10:39 ` Thierry Volpiatto @ 2011-10-23 17:47 ` Stefan Monnier 2011-10-24 12:25 ` Michael Albinus 1 sibling, 1 reply; 13+ messages in thread From: Stefan Monnier @ 2011-10-23 17:47 UTC (permalink / raw) To: Michael Albinus; +Cc: 9793, Thierry Volpiatto > `pcomplete-dirs' uses `file-directory-p' as predicate, which is applied > to all completion candidates. The following patch ought to fix it: > --8<---------------cut here---------------start------------->8--- > *** /home/albinus/src/emacs/lisp/pcomplete.el.~106161~ 2011-10-22 11:31:11.996458454 +0200 > --- /home/albinus/src/emacs/lisp/pcomplete.el 2011-10-22 11:30:20.796204566 +0200 > *************** > *** 948,954 **** > (defsubst pcomplete-dirs (&optional regexp) > "Complete amongst a list of directories." > ! (pcomplete-entries regexp 'file-directory-p)) > ;; generation of completion lists > --- 948,957 ---- > (defsubst pcomplete-dirs (&optional regexp) > "Complete amongst a list of directories." > ! (pcomplete-entries regexp > ! (lambda (dir) > ! (or (file-remote-p (expand-file-name dir)) > ! (file-directory-p dir))))) > ;; generation of completion lists > --8<---------------cut here---------------end--------------->8--- > Comments? This looks like a workaround rather than a fix. Also, I notice that in `shell' (rather than `eshell') the problem does not occur. So I'd like to better understand what's going on. Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-23 17:47 ` Stefan Monnier @ 2011-10-24 12:25 ` Michael Albinus 2011-10-24 14:20 ` Stefan Monnier 0 siblings, 1 reply; 13+ messages in thread From: Michael Albinus @ 2011-10-24 12:25 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793, Thierry Volpiatto Stefan Monnier <monnier@iro.umontreal.ca> writes: > This looks like a workaround rather than a fix. Also, I notice that in > `shell' (rather than `eshell') the problem does not occur. So I'd like > to better understand what's going on. In shell just the local file names are taken for completion. I don't know how this is implemented, maybe via pcompletion tables? In eshell, all file names are good for completion, also remote ones. This is valid, because "cd /sudo::" is a valid command in eshell. But this makes the trouble with the completion predicate `file-directory-p'. > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-24 12:25 ` Michael Albinus @ 2011-10-24 14:20 ` Stefan Monnier 2011-10-25 10:41 ` Michael Albinus 0 siblings, 1 reply; 13+ messages in thread From: Stefan Monnier @ 2011-10-24 14:20 UTC (permalink / raw) To: Michael Albinus; +Cc: 9793, Thierry Volpiatto >> This looks like a workaround rather than a fix. Also, I notice that in >> `shell' (rather than `eshell') the problem does not occur. So I'd like >> to better understand what's going on. > In shell just the local file names are taken for completion. I don't > know how this is implemented, maybe via pcompletion tables? Both use pretty much the same pcomplete code. I think I finally figured out what is the difference between the two cases: if you set pcomplete-file-ignore and pcomplete-dir-ignore in shell-mode like it is set in eshell, the same problem shows up. So what happens is: - in eshell-mode - file-name-all-completions returns '("tic:" "tequila:" "tmp/") - completion-file-name-table then checks the predicate (which combines file-directory-p with regexp matching to avoid CVS and a few other directories). - this calls (file-directory-p "tequila:") in the "/" dir, which triggers Tramp. - in shell-mode - file-name-all-completions returns '("tic:" "tequila:" "tmp/") - completion-file-name-table then checks the predicate (file-directory-p) - file-directory-p is *not* called because completion-file-name-table handles it specially (just checks the presence of a terminating "/"). I still don't understand why in eshell, tramp-maybe-open-connection is called within the following backtrace: tramp-completion-file-name-handler(file-directory-p "/tequila:") file-directory-p("tequila:") whereas when I manually call (let ((default-directory "/")) (file-directory-p "tequila:")) tramp-maybe-open-connection is called within the following backtrace: tramp-completion-file-name-handler(expand-file-name "tequila:" "/") file-directory-p("tequila:") > In eshell, all file names are good for completion, also remote > ones. This is valid, because "cd /sudo::" is a valid command in > eshell. In shell-mode completion also understands Tramp file names (yup, that's a bug, we should probably default comint-file-name-prefix to "/:/"), so that's not the problem. > But this makes the trouble with the completion predicate > `file-directory-p'. Yup, I think we should somehow make it so Tramp can say (file-directory-p "/tequila:") => t without trying to connect to tequila (after all, even if we can't connect to tequila, this is still a "directory", just one we currently can't access). Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-24 14:20 ` Stefan Monnier @ 2011-10-25 10:41 ` Michael Albinus 2011-10-25 12:16 ` Stefan Monnier 0 siblings, 1 reply; 13+ messages in thread From: Michael Albinus @ 2011-10-25 10:41 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793, Thierry Volpiatto Stefan Monnier <monnier@iro.umontreal.ca> writes: > Both use pretty much the same pcomplete code. > > I think I finally figured out what is the difference between the two > cases: if you set pcomplete-file-ignore and pcomplete-dir-ignore > in shell-mode like it is set in eshell, the same problem shows up. > > So what happens is: > - in eshell-mode > - file-name-all-completions returns '("tic:" "tequila:" "tmp/") > - completion-file-name-table then checks the predicate (which combines > file-directory-p with regexp matching to avoid CVS and a few other > directories). > - this calls (file-directory-p "tequila:") in the "/" dir, which > triggers Tramp. > - in shell-mode > - file-name-all-completions returns '("tic:" "tequila:" "tmp/") > - completion-file-name-table then checks the predicate (file-directory-p) > - file-directory-p is *not* called because completion-file-name-table > handles it specially (just checks the presence of a terminating "/"). Thanks for the explanation. I start to understand (honestly, all this programmable completion is out of my understanding). > I still don't understand why in eshell, tramp-maybe-open-connection is > called within the following backtrace: > tramp-completion-file-name-handler(file-directory-p "/tequila:") > file-directory-p("tequila:") > whereas when I manually call > (let ((default-directory "/")) (file-directory-p "tequila:")) > tramp-maybe-open-connection is called within the following backtrace: > tramp-completion-file-name-handler(expand-file-name "tequila:" "/") > file-directory-p("tequila:") Tramp has some code to guess whether it is in completion mode. Check of `non-essential' is one proof, checking the last keyboard input (being TAB, or not) is another one. If Tramp finds out that it is in completion mode, it suppresses some remote actions, like expand-file-name. Since your code (let ((default-directory "/")) (file-directory-p "tequila:")) does not show an evidence of the completion mode, all remote actions are performed. The actions for `file-directory-p' are never been suppressed, that's why Tramp performs them also when being in completion mode. >> In eshell, all file names are good for completion, also remote >> ones. This is valid, because "cd /sudo::" is a valid command in >> eshell. > > In shell-mode completion also understands Tramp file names (yup, that's > a bug, we should probably default comint-file-name-prefix to "/:/"), so > that's not the problem. Better not. There are still needed checks in shell.el, which are applied to remote files. `comint-file-name-prefix keeps the remote part of those files. See for example Bug#6764. >> But this makes the trouble with the completion predicate >> `file-directory-p'. > > Yup, I think we should somehow make it so Tramp can say > (file-directory-p "/tequila:") => t > without trying to connect to tequila (after all, even if we can't > connect to tequila, this is still a "directory", just one we currently > can't access). That was the intention of my patch :-) Return t in case of remote files. Inside Tramp it could be behave such a way when it detects it is in completion mode. That means, when `non-essential' is set to t. Shall I do it this way? > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-25 10:41 ` Michael Albinus @ 2011-10-25 12:16 ` Stefan Monnier 2011-10-25 12:56 ` Michael Albinus 0 siblings, 1 reply; 13+ messages in thread From: Stefan Monnier @ 2011-10-25 12:16 UTC (permalink / raw) To: Michael Albinus; +Cc: 9793, Thierry Volpiatto > Tramp has some code to guess whether it is in completion mode. Yuck! > Check of `non-essential' is one proof, Actually, no. non-essential could be used for other things than completion. > checking the last keyboard input (being TAB, or not) is another one. Yuck! > If Tramp finds out that it is in completion mode, it suppresses some > remote actions, like expand-file-name. Since your code > (let ((default-directory "/")) (file-directory-p "tequila:")) > does not show an evidence of the completion mode, all remote actions are > performed. OK, so now I know why the two behaved differently. > The actions for `file-directory-p' are never been suppressed, that's why > Tramp performs them also when being in completion mode. Good. >> In shell-mode completion also understands Tramp file names (yup, that's >> a bug, we should probably default comint-file-name-prefix to "/:/"), so >> that's not the problem. > Better not. There are still needed checks in shell.el, which are applied > to remote files. `comint-file-name-prefix keeps the remote part of those > files. I do not propose to remove the variable. Only to make it default to "/:/" (instead of just ""). >>> But this makes the trouble with the completion predicate >>> `file-directory-p'. >> Yup, I think we should somehow make it so Tramp can say >> (file-directory-p "/tequila:") => t >> without trying to connect to tequila (after all, even if we can't >> connect to tequila, this is still a "directory", just one we currently >> can't access). > That was the intention of my patch :-) > Return t in case of remote files. But that's not what I suggest. I suggest to "blindly" return t for /<host>: only (as well as things like /ssh:<host>: I guess), but not for /<host>:<path> where we'd still connect and test whether it's indeed a directory. > Inside Tramp it could be behave such a way when it detects it is in > completion mode. That means, when `non-essential' is set to t. Shall I > do it this way? I suggest to do that regardless of whether we're in completion mode or not. Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#9793: 24.0.90; Unwanted tramp connection on eshell completion. 2011-10-25 12:16 ` Stefan Monnier @ 2011-10-25 12:56 ` Michael Albinus 0 siblings, 0 replies; 13+ messages in thread From: Michael Albinus @ 2011-10-25 12:56 UTC (permalink / raw) To: Stefan Monnier; +Cc: 9793-done, Thierry Volpiatto Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Tramp has some code to guess whether it is in completion mode. > > Yuck! > >> Check of `non-essential' is one proof, > > Actually, no. non-essential could be used for other things than completion. Yes. But in the context of Tramp it is a good indicator. > But that's not what I suggest. I suggest to "blindly" return t for > /<host>: only (as well as things like /ssh:<host>: I guess), but not for > /<host>:<path> where we'd still connect and test whether it's indeed > a directory. > >> Inside Tramp it could be behave such a way when it detects it is in >> completion mode. That means, when `non-essential' is set to t. Shall I >> do it this way? > > I suggest to do that regardless of whether we're in completion mode > or not. I've committed such a patch. It is good anyway, because it adds an optimitation for Tramp. This shall solve this bug. However, do we have other other primitive file name operations, which are used for file name completion? We should handle them as well. > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-10-25 12:56 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-19 4:53 bug#9793: 24.0.90; Unwanted tramp connection on eshell completion Thierry Volpiatto 2011-10-20 2:31 ` Stefan Monnier 2011-10-20 18:46 ` Thierry Volpiatto 2011-10-20 20:43 ` Stefan Monnier 2011-10-20 21:17 ` Thierry Volpiatto 2011-10-22 9:39 ` Michael Albinus 2011-10-22 10:39 ` Thierry Volpiatto 2011-10-23 17:47 ` Stefan Monnier 2011-10-24 12:25 ` Michael Albinus 2011-10-24 14:20 ` Stefan Monnier 2011-10-25 10:41 ` Michael Albinus 2011-10-25 12:16 ` Stefan Monnier 2011-10-25 12:56 ` Michael Albinus
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).