bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57905: [PATCH] Fix eshell directory and executable completion on act


From: Eli Zaretskii
Subject: 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@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]