GNU bug report logs - #16260
24.3.50; shell-command-completion and removal of exec-directory from exec-path

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Thu, 26 Dec 2013 20:27:02 UTC

Severity: minor

Found in version 24.3.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 16260 <at> debbugs.gnu.org, Jarek Czekalski <jarekczek <at> poczta.onet.pl>
Subject: bug#16260: 24.3.50; shell-command-completion and removal of exec-directory from exec-path
Date: Wed, 20 Jan 2021 03:35:56 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> shell--command-completion-data has this FIXME comment:
>
>   (defun shell--command-completion-data ()
>     "Return the completion data for the command at point."
>     (let* ((filename (or (comint-match-partial-filename) ""))
> 	   (start (if (zerop (length filename)) (point) (match-beginning 0)))
> 	   (end (if (zerop (length filename)) (point) (match-end 0)))
> 	   (filenondir (file-name-nondirectory filename))
> 	   (path-dirs (cdr (reverse exec-path))) ;FIXME: Why `cdr'?

This code now looks like:

	 (path-dirs
	  ;; Ignore `exec-directory', the last entry in `exec-path'.
          (append (cdr (reverse (exec-path)))
	          (if (and (memq system-type '(windows-nt ms-dos))
                           (not (file-remote-p default-directory)))
                      '("."))))

[...]

> However, just clipping away the last member of exec-path list only
> does TRT in the default case.  It will not work if either of the
> following happens:
>
>   . The user changes epaths.h to specify more than a single directory
>
>   . EMACSPATH is set in the environment
>
> To get this right, we should record at startup time the value of
> exec-path before appending $PATH to it, and then filter out the
> directories recorded at that time in shell--command-completion-data.

I haven't looked further at this (since the FIXME is gone), but it this
something that needs further work?

> As a minor nit, the doc string of shell-dynamic-complete-command
> should not talk about "library path", which is a non-existing term in
> Emacs, but instead mention exec-directory.

This doc string doesn't mention "library path" any more.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 144 days ago.

Previous Next


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