From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#61221: 30.0.50; [PATCH] Support completion of quoted variable refs in Eshell Date: Thu, 23 Feb 2023 14:11:54 -0800 Message-ID: References: <0e3cf425-be9d-4759-d024-ac07ccecba9c@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8999"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61221-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 23 23:13:21 2023 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 1pVJq4-0002Bi-Si for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Feb 2023 23:13:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVJpo-0000FS-L7; Thu, 23 Feb 2023 17:13:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVJpn-0000Eq-8U for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 17:13:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVJpn-0005f6-0e for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 17:13:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVJpm-00056t-Lo for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 17:13:02 -0500 Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2023 22:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61221 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 61221@debbugs.gnu.org, jporterbugs@gmail.com, jporterbugs@gmail.com Original-Received: via spool by 61221-done@debbugs.gnu.org id=D61221.167719032419563 (code D ref 61221); Thu, 23 Feb 2023 22:13:02 +0000 Original-Received: (at 61221-done) by debbugs.gnu.org; 23 Feb 2023 22:12:04 +0000 Original-Received: from localhost ([127.0.0.1]:35505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVJop-00055T-NB for submit@debbugs.gnu.org; Thu, 23 Feb 2023 17:12:04 -0500 Original-Received: from mail-pl1-f182.google.com ([209.85.214.182]:35465) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVJoo-00054v-Ix for 61221-done@debbugs.gnu.org; Thu, 23 Feb 2023 17:12:03 -0500 Original-Received: by mail-pl1-f182.google.com with SMTP id e9so9702465plh.2 for <61221-done@debbugs.gnu.org>; Thu, 23 Feb 2023 14:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=zoMzDtDAXM8XYbLcrl99dcQNWGcnDWPO4chCeYeM3f8=; b=cevjaITIQcglSgfAsCOZkykPRJlYyFege5Bn1D7wv+cqqCccgLbhpEvZvcElqG7PNt I7/QMfxFK8C4QU1G/q1l33V6u4ITMad1tHCpHZqyapPPbzqCNcTa/0uSR7AEe5ZJZ2Wk 6tnW4bZD99eKicpXrPvQOzOZqlDI9O1UDZs2u+ASX4JkA5MdAXIYTmEKZ8qNBQISiV65 Pop5TTgfFuku2qqgQM2nTk74S1Q47BDdigCAx30oJOiZKoSBdMpRFW6/a+88nPFBZCsq JcbkIG6J66qYsMkyPyiAoI3qGPMpMtS+syOQD+/PYYTIT5YG/Q+3PD7iN2Mehkt9qWE3 5awA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zoMzDtDAXM8XYbLcrl99dcQNWGcnDWPO4chCeYeM3f8=; b=obBYCi18LjuHv0rKXS26VN36FZosJoxWub7iy/p4PmTj+XXwRFXg4R95h6cp3ryby4 1JqWe+S/lcfZSryh9/EzjJlK+ZdEZAzEM4s/Ks/yqO350sf9o2fm3BzlPdOIeXGyECKF 2GrIqgzZwnpvBC3lDFjPkIxtxuPC6tN1RuRuHt7Lv4GrI6Cruehp7nVxWtwn2JDgOa34 kDG9VFeqh7CWRgCAPMm035I9hlaYmBl+2+aBx/L0wKMcffAy+jjxf3ugSbaPpA8q1M1p RaXtJI5t3T1EuRDF/yypGSPkftkStOth+Fq8gIFjkR2td9xLDdnQfD+K5XjH/2rM6qMc ed5g== X-Gm-Message-State: AO0yUKUlsT3ygr4w04rIXsN06pMwELmmg9rPw4t6Tx0f9nGLgVKunGwv 0ho8TYlmVufsfRhSja7e1Ps= X-Google-Smtp-Source: AK7set9nHrNR3k5NrCxDJO+Go2z9YrsYU/dCD1YKJJo7DfPIDdDBZKWCOeYUG+83MUFs54aTi6Pmig== X-Received: by 2002:a17:90b:1e02:b0:233:af77:c075 with SMTP id pg2-20020a17090b1e0200b00233af77c075mr14019750pjb.36.1677190316420; Thu, 23 Feb 2023 14:11:56 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id r13-20020a17090a690d00b002309279baf8sm165902pjj.43.2023.02.23.14.11.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Feb 2023 14:11:55 -0800 (PST) Content-Language: en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256531 Archived-At: On 2/23/2023 10:02 AM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > The patches look good, feel free to push, AFAIC. Thanks, merged as 9d48c9844b. >> + (mapcar (lambda (x) (car x)) > > Aka (mapcar #'car Fixed. >> + (setq pcomplete-stub (substring arg (match-beginning 1)) >> + delimiter (match-string 2 arg)) > > You could let-bind `delimiter` here instead of let-binding it earlier > and then `setq`ing it here. Better for karma and marginally more > efficient (avoids the creation of a `cons` cell to contain the value of > the var). Done. >> + (append (eshell-envvar-names) >> + (all-completions argname obarray 'boundp)) >> + #'string-lessp))) > > Since you use #' for `string-lessp`, it would make sense to use #' for > `boundp` as well :-) Fixed. >> + ('lambda ; test-completion >> + (let ((result (test-completion string names pred))) >> + (if (eq result t) string result))) > > Hmm... why not just always return `result`? As I understand it, returning 't' means "there is just one matching completion, and the match is exact"[1], but in this case, that's not really true: after completing "~user/" there are still more matching completions (the contents of the user's home directory). This is really just trying to match what happens when calling 'completion-file-name-table': (completion-file-name-table "~user/" nil nil) => "~user/" (try-completion "~user/" '("~user/") nil) => t So if we get 't' from 'try-completion', we "downgrade" that to the original string. [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Completion.html