From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57905: [PATCH] Fix eshell directory and executable completion on action t Date: Sun, 18 Sep 2022 10:40:36 +0300 Message-ID: <83fsgpyvt7.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24583"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57905@debbugs.gnu.org To: Daniel Pettersson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 18 09:41:23 2022 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 1oZovb-0006Hp-58 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Sep 2022 09:41:23 +0200 Original-Received: from localhost ([::1]:42192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZovZ-00028W-Rh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Sep 2022 03:41:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZovG-00028J-3p for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 03:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oZovF-0005W6-S6 for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 03:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oZovF-0007xb-Mn for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 03:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Sep 2022 07:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57905 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 57905-submit@debbugs.gnu.org id=B57905.166348684730571 (code B ref 57905); Sun, 18 Sep 2022 07:41:01 +0000 Original-Received: (at 57905) by debbugs.gnu.org; 18 Sep 2022 07:40:47 +0000 Original-Received: from localhost ([127.0.0.1]:47704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZov0-0007x1-Nh for submit@debbugs.gnu.org; Sun, 18 Sep 2022 03:40:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZouy-0007wo-RA for 57905@debbugs.gnu.org; Sun, 18 Sep 2022 03:40:45 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZout-0005Pq-Gd; Sun, 18 Sep 2022 03:40:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UY/JQxWi9bcuMINaXZIsJdynfTGKvjT2YtdOShjlJMU=; b=Zjy0DijnWVfG COl7R+WhhuR1W+OgV3dzeRTmWmdRscMcVn52O01C9lPrkFZIo0CC8zynjkXqZtVp3j/YzMTWPEPAS nVyJvDoKTaoppHHD921gbG22ON86GffEq7aiK37gBNPT7zixK/BP2pNv3nXvwM8RY1J2ZnDffgxMP eLJUXQXVGjE0xDbMNYJjSK+77l1btB1jy6xOq8DJpJAg3C1BJYnBty0CaTwqTq21oD5UXmUE9FcWi +jguzeixsVzSxfvjhAEsop1LqQ0j1N8+4RORZK4Zd5MgS6qMhXtzy6PlgB3cJBD6vuonjOd/vrhNd qoS8o9U00c3zOAvDfRICWQ==; Original-Received: from [87.69.77.57] (port=2741 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZoup-000231-8p; Sun, 18 Sep 2022 03:40:39 -0400 In-Reply-To: (message from Daniel Pettersson on Sun, 18 Sep 2022 00:55:48 +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:242934 Archived-At: > From: Daniel Pettersson > Date: Sun, 18 Sep 2022 00:55:48 +0200 > > +(defun eshell--pcomplete-executables () > + "Complete amongs a list of directories and executables. > + > +Wrapper for `pcomplete-executables' or `pcomplete-dirs-or-entries', > +depending on the value of `eshell-force-execution'. > + > +Adds path prefix to candidates independent of `action' value." > + ;; `pcomplete-entries' returns filenames without path on `action' t > + ;; use current string directory as done in `completion-file-name-table' > + ;; when `action' is nil to construct executable candidates. > + (let* ((table (if eshell-force-execution > + (pcomplete-dirs-or-entries nil #'file-readable-p) > + (pcomplete-executables)))) > + (lambda (string pred action) > + (let ((cands (funcall table string pred action))) > + (if (eq action t) > + (let ((specdir (file-name-directory string))) > + (mapcar > + (lambda (cand) > + (if (stringp cand) > + (concat specdir cand) > + cand)) > + cands)) > + cands))))) Please don't use 'concat' to create a file name with leading directories; instead, please use file-name-concat.