GNU bug report logs - #57905
[PATCH] Fix eshell directory and executable completion on action t

Previous Next

Package: emacs;

Reported by: Daniel Pettersson <daniel <at> dpettersson.net>

Date: Sun, 18 Sep 2022 07:08:03 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 57905 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Pettersson <daniel <at> dpettersson.net>
Cc: 57905 <at> debbugs.gnu.org
Subject: Re: bug#57905: [PATCH] Fix eshell directory and executable completion
 on action t
Date: Sun, 18 Sep 2022 10:40:36 +0300
> From: Daniel Pettersson <daniel <at> dpettersson.net>
> 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.




This bug report was last modified 2 years and 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.