From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Michalis V." Newsgroups: gmane.emacs.bugs Subject: bug#19626: 25.0.50; eshell: extended directory syntax ("...") does not complete Date: Fri, 27 Aug 2021 18:28:16 +0300 Message-ID: <87sfyu29gv.fsf@cnu407c2zx.nsn-intra.net> References: <8761c3586l.fsf@gmail.com> <87czq1risd.fsf@cnu407c2zx.nsn-intra.net> <87czq1lqk1.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5377"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "Michalis V." , Samer Masterson , 19626@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 27 17:29:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJdn5-00017R-RA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Aug 2021 17:29:11 +0200 Original-Received: from localhost ([::1]:57328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJdn3-0003to-P6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Aug 2021 11:29:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJdmw-0003tP-C9 for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 11:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJdmw-0001m8-4m for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 11:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mJdmw-0001C3-1J for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 11:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Michalis V." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Aug 2021 15:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19626 X-GNU-PR-Package: emacs Original-Received: via spool by 19626-submit@debbugs.gnu.org id=B19626.16300781164549 (code B ref 19626); Fri, 27 Aug 2021 15:29:01 +0000 Original-Received: (at 19626) by debbugs.gnu.org; 27 Aug 2021 15:28:36 +0000 Original-Received: from localhost ([127.0.0.1]:52762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJdmW-0001BH-9a for submit@debbugs.gnu.org; Fri, 27 Aug 2021 11:28:36 -0400 Original-Received: from mail-wm1-f41.google.com ([209.85.128.41]:55176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJdmR-0001Ar-73 for 19626@debbugs.gnu.org; Fri, 27 Aug 2021 11:28:35 -0400 Original-Received: by mail-wm1-f41.google.com with SMTP id g138so4132222wmg.4 for <19626@debbugs.gnu.org>; Fri, 27 Aug 2021 08:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=02LRMBAnIWnz9jSDrud8mGHV/GNC8ycQA83WEb5l5YA=; b=Tp9sYRezUUZeDWK43JGQIObU+lyF6KnbEFpF5C9TxGTqvQ19eEO1tPUPoFu3rEqrsS 6DF77f2cH5Qq04ISAgPxDr0lU7HTxG+uhBiQY+xfGJkWl/7C9+jqskJCiG160uW6YcZs IMek2sJ39Lw1qs5gcrgWXVuhnNtjbazmG1JR5nADb0UOzShCdPjVR/9ddsDCj3u0mzIh F+StrciTE+YBK+QN9kdeele4KkjdKdcfn+m03xLY4K1yJrvhP+3/ouxXocVcqVBKCVsH U9GQ/qSIZnzDiTXkK/nFZnIgT0aVuMLEaGNp0D1vzCAu7RWc9ftmRwbDeQViRuSYbt7v +o/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=02LRMBAnIWnz9jSDrud8mGHV/GNC8ycQA83WEb5l5YA=; b=kpIsSI15Xp8a/vIZ83e4Pktn0SL0lYPFd5LaSf5PmpiOj/n4HQGj+9jEyYg3QRpj+J cBemgr0JkYZFrZyNlN+MBHkeD7oeXPDHzOcB67+k5ijY0dVnHPbyvN/t9484Z/0k78D4 V4ANLP7Ilnf71ypRUghGKiQkzBTdZ24HMqWtjaKGXsRlGjMy8fNVWaXTkCB/3DMY0TcI YMz+CF4r0PrrH7RNbwO1SODp8ACv5J8s035/yjxH+YMXoSTV3D3OGhU5KIjn2ILIZCMW vS1iYnl5UqB7a8N0dLHThwaTddQbrP+B+YJ4lX/gQwZW11bL1YKcZbaNmlCUx5qVaPq3 iDKg== X-Gm-Message-State: AOAM5334mIVOO7oIvUOoXPLwofVJfvK9a0QeXzciiMkBAoLbR/kyAg7S ISzYQxR5z2p06jxL5+LqqVWsf3KYwmoB6A== X-Google-Smtp-Source: ABdhPJyqNtQAOEUWDmi5VPu6fbOC5cmL78zhv5tCSfdPO/XQPK4HFj9jhxG/uzrKngJhma+2Ej8uiw== X-Received: by 2002:a1c:9d95:: with SMTP id g143mr9657965wme.187.1630078105359; Fri, 27 Aug 2021 08:28:25 -0700 (PDT) Original-Received: from cnu407c2zx.nsn-intra.net (109-178-220-50.pat.ren.cosmote.net. [109.178.220.50]) by smtp.gmail.com with ESMTPSA id u27sm6948528wru.2.2021.08.27.08.28.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Aug 2021 08:28:24 -0700 (PDT) X-Google-Original-From: "Michalis V." In-Reply-To: <87czq1lqk1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 25 Aug 2021 13:19:42 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212823 Archived-At: --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > "Michalis V." 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=em-cmpl.patch 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))) --=-=-=--