unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete
@ 2015-01-19 11:19 Samer Masterson
  2021-08-25  9:10 ` Michalis V.
  0 siblings, 1 reply; 5+ messages in thread
From: Samer Masterson @ 2015-01-19 11:19 UTC (permalink / raw)
  To: 19626


1. "emacs -Q"
2. M-x eshell
3. "cd .../"
4. Press tab
Bug: "No completions found" is echoed, even though completions exist.
Exptected: Eshell should have attempted to complete a directory name.



In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-11-18 on samer-dark-horse
Repository revision: b59998eb5b9c4e6e142b530604539c54028acb8d
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04.1 LTS

Configured using:
 `configure --prefix=/home/samer/local'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

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

Major mode: Apropos

Minor modes in effect:
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  global-flycheck-mode: t
  show-paren-mode: t
  flx-ido-mode: t
  guide-key-mode: t
  popwin-mode: t
  projectile-global-mode: t
  projectile-mode: t
  ido-everywhere: t
  tooltip-mode: t
  global-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t

Recent messages:
Quit
No completions of .../sou
Quit [3 times]
Mark saved where search started

Quit [2 times]
Mark saved where search started

Mark saved where search started [2 times]

Quit [2 times]

Load-path shadows:
/home/samer/.emacs.d/elpa/emms-20141104.1238/tq hides /home/samer/local/share/emacs/25.0.50/lisp/emacs-lisp/tq

Features:
(shadow emacsbug apropos ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util ediff company-go sh-script smie
executable make-mode rect eieio-opt conf-mode align js json cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs tabify man go-stacktracer magit-blame cal-move parse-time
org-element org-rmail org-mhe org-irc org-info org-gnus org-docview
org-bibtex bibtex org-bbdb org-w3m org org-macro org-footnote
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs deft wid-edit find-dired
debug windmove pp tramp-cache pcmpl-unix em-unix em-term term disp-table
ehelp em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl
em-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-ext
esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util
cap-words superword subword misc hippie-exp ace-jump-mode company-files
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-capf company-cmake
company-ropemacs company-xcode company-clang company-semantic
company-eclim company-template company-css company-nxml company-bbdb
company imenu dired-aux magit-key-mode magit view tramp tramp-compat
tramp-loaddefs trampver shell pcomplete autorevert filenotify
git-rebase-mode git-commit-mode log-edit pcvs-util add-log epa-file
gnutls network-stream starttls tls mailalias mail-extr sort misearch
multi-isearch mule-util server vc-git diff-mode easy-mmode remember
flycheck help-mode rx subr-x pcase edmacro kmacro mu4e mu4e-speedbar
speedbar sb-image ezimage dframe mu4e-main mu4e-view epa derived epg
browse-url mu4e-headers mu4e-compose mu4e-draft mu4e-actions rfc2368
smtpmail sendmail mu4e-mark mu4e-message html2text mu4e-proc mu4e-utils
doc-view jka-compr image-mode mu4e-lists mu4e-about mu4e-vars message
format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils
mailheader hl-line mu4e-meta ctags paren flx-ido flx saveplace smex
go-eldoc go-mode url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap find-file ffap
url-parse auth-source eieio byte-opt bytecomp byte-compile cl-extra
cconv eieio-core gnus-util time-date mm-util mail-prsvr password-cache
url-vars etags guide-key face-remap popwin projectile advice ibuf-ext
ibuffer pkg-info find-func lisp-mnt epl grep thingatpt help-fns cl-macs
cl gv cl-loaddefs cl-lib ag vc-svn compile comint ansi-color ring ido s
ucs-normalize dash dired go-mode-autoloads info easymenu package
epg-config tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-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 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 make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 1192127 163442)
 (symbols 48 47172 21)
 (miscs 40 5332 3731)
 (strings 32 144171 31134)
 (string-bytes 1 4576347)
 (vectors 16 104892)
 (vector-slots 8 2394117 39473)
 (floats 8 12733 3169)
 (intervals 56 97212 433)
 (buffers 976 239)
 (heap 1024 173448 62749))





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete
  2015-01-19 11:19 bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete Samer Masterson
@ 2021-08-25  9:10 ` Michalis V.
  2021-08-25 11:19   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michalis V. @ 2021-08-25  9:10 UTC (permalink / raw)
  To: Samer Masterson; +Cc: 19626

Samer Masterson <nosefrog@gmail.com> writes:

> 1. "emacs -Q"
> 2. M-x eshell
> 3. "cd .../"
> 4. Press tab
> Bug: "No completions found" is echoed, even though completions exist.
> Exptected: Eshell should have attempted to complete a directory name.
>
>
>
> In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
>  of 2014-11-18 on samer-dark-horse

i cannot reproduce this in 28.0.50. Basically what i did was

mkdir ...

then repeat the steps above. Eshell autocompletes .../ fine, even adding
another similar directory will bring up the dialog:


Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
..../
.../


thanks,
Michalis





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete
  2021-08-25  9:10 ` Michalis V.
@ 2021-08-25 11:19   ` Lars Ingebrigtsen
  2021-08-27 15:28     ` Michalis V.
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-25 11:19 UTC (permalink / raw)
  To: Michalis V.; +Cc: Samer Masterson, 19626

"Michalis V." <mvar.40k@gmail.com> writes:

> i cannot reproduce this in 28.0.50. Basically what i did was
>
> mkdir ...
>
> then repeat the steps above. Eshell autocompletes .../ fine, even adding
> another similar directory will bring up the dialog:

I think eshell has an "extended directory" concept where "..." is
supposed to expand to (I think) all parent directories?  So there isn't
supposed to be any directory literally called "...".

I think.  But I'm not overly familiar with eshell.  Let's see...  Yup:

(defun eshell-expand-multiple-dots (filename)
  "Convert `...' to `../..', `....' to `../../..', etc..


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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete
  2021-08-25 11:19   ` Lars Ingebrigtsen
@ 2021-08-27 15:28     ` Michalis V.
  2021-08-27 16:47       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michalis V. @ 2021-08-27 15:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michalis V., Samer Masterson, 19626

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Michalis V." <mvar.40k@gmail.com> writes:
>
>> i cannot reproduce this in 28.0.50. Basically what i did was
>>
>> mkdir ...
>>
>> then repeat the steps above. Eshell autocompletes .../ fine, even adding
>> another similar directory will bring up the dialog:
>
> I think eshell has an "extended directory" concept where "..." is
> supposed to expand to (I think) all parent directories?  So there isn't
> supposed to be any directory literally called "...".
>
> I think.  But I'm not overly familiar with eshell.  Let's see...  Yup:
>
> (defun eshell-expand-multiple-dots (filename)
>   "Convert `...' to `../..', `....' to `../../..', etc..

oops, i wasn't even aware of this eshell feature, sorry about that!

I did some debugging into how completion works and it looks like
eshell-complete-parse-arguments in em-cmpl.el is responsible for
parsing the arguments before passing them to the generic(?) completion
code. Attached is a patch that adds an additional check at the end of
said defun that will substitute any .../ dots into the proper expanded
form before returning. There are some other defuns that are called by
eshell-complete-parse-arguments, namely eshell-parse-argument(s) but i
*think* this substitution is better suited (read: safer) to be placed to
their caller.
Note that this works for "cd .../", completion for other operations like
cp do not work currently (most probably because cd has its own
implementation in eshell/cd?)

i'm not sure whether this is the correct solution to this problem so if
there are any concerns please let me know and i'll continue the digging

thanks,
Michalis


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: em-cmpl.patch --]
[-- Type: text/x-patch, Size: 822 bytes --]

diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index cbfe0b8154..2352dac7e7 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -377,8 +377,12 @@ eshell-complete-parse-arguments
                           (cl-assert (eq (car result) 'quote))
                           (cadr result))
                       arg)))
-               (if (numberp val)
-                   (setq val (number-to-string val)))
+               (cond ((numberp val)
+                      (setq val (number-to-string val)))
+                     ;; expand .../ etc that only eshell understands to
+                     ;; standard ../../
+                     ((string-match "\\.\\.\\.+/" val)
+                      (setq val (eshell-expand-multiple-dots val))))
                (or val "")))
 	   args)
 	  posns)))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete
  2021-08-27 15:28     ` Michalis V.
@ 2021-08-27 16:47       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27 16:47 UTC (permalink / raw)
  To: Michalis V.; +Cc: Samer Masterson, 19626

"Michalis V." <mvar.40k@gmail.com> writes:

>> (defun eshell-expand-multiple-dots (filename)
>>   "Convert `...' to `../..', `....' to `../../..', etc..
>
> oops, i wasn't even aware of this eshell feature, sorry about that!

I didn't know about it either.  :-)

> i'm not sure whether this is the correct solution to this problem so if
> there are any concerns please let me know and i'll continue the digging

Thanks.  Looking at the code and the patch, that does seem right the
right solution, so I've now pushed it to Emacs 28.  (But I'm not really
very familiar with eshell.)

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-27 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 11:19 bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete Samer Masterson
2021-08-25  9:10 ` Michalis V.
2021-08-25 11:19   ` Lars Ingebrigtsen
2021-08-27 15:28     ` Michalis V.
2021-08-27 16:47       ` Lars Ingebrigtsen

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).