unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Pettersson <daniel@dpettersson.net>
Cc: 57905@debbugs.gnu.org
Subject: bug#57905: [PATCH] Fix eshell directory and executable completion on action t
Date: Sun, 18 Sep 2022 10:40:36 +0300	[thread overview]
Message-ID: <83fsgpyvt7.fsf@gnu.org> (raw)
In-Reply-To: <CAM-j=qtaHudw0Uy6Gw3ymty9senwO6qeAm0ouNPGj1utsfKuQA@mail.gmail.com> (message from Daniel Pettersson on Sun, 18 Sep 2022 00:55:48 +0200)

> 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	other threads:[~2022-09-18  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17 22:55 bug#57905: [PATCH] Fix eshell directory and executable completion on action t Daniel Pettersson
2022-09-18  7:40 ` Eli Zaretskii [this message]
2022-09-18 10:41 ` Lars Ingebrigtsen
2022-09-19  0:31   ` Jim Porter
2022-09-19  8:22     ` Lars Ingebrigtsen
2022-09-19 20:27       ` Daniel Pettersson
2022-09-19 20:35         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fsgpyvt7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=57905@debbugs.gnu.org \
    --cc=daniel@dpettersson.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).