From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#16260: 24.3.50; shell-command-completion and removal of exec-directory from exec-path Date: Thu, 26 Dec 2013 22:26:29 +0200 Message-ID: <83txdv4ave.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1388089643 20763 80.91.229.3 (26 Dec 2013 20:27:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Dec 2013 20:27:23 +0000 (UTC) Cc: Jarek Czekalski To: 16260@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 26 21:27:28 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VwHWf-0003mx-58 for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Dec 2013 21:27:25 +0100 Original-Received: from localhost ([::1]:46850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHWe-0000JK-Ob for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Dec 2013 15:27:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHWS-0000I4-Lk for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:27:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwHWI-0003M4-Rj for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:27:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHWI-0003Ly-Nk for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:27:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VwHWI-0005ku-ED for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2013 20:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16260 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138808961522106 (code B ref -1); Thu, 26 Dec 2013 20:27:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Dec 2013 20:26:55 +0000 Original-Received: from localhost ([127.0.0.1]:44529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VwHWB-0005kT-4y for submit@debbugs.gnu.org; Thu, 26 Dec 2013 15:26:55 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49868) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VwHW9-0005kL-Ct for submit@debbugs.gnu.org; Thu, 26 Dec 2013 15:26:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwHVz-0003I7-RT for submit@debbugs.gnu.org; Thu, 26 Dec 2013 15:26:53 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHVz-0003I3-PC for submit@debbugs.gnu.org; Thu, 26 Dec 2013 15:26:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHVs-0000Gf-CK for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:26:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwHVk-0003H4-OY for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:26:36 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:52193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwHVk-0003G1-GG for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 15:26:28 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MYF00100KMWSG00@a-mtaout22.012.net.il> for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2013 22:26:27 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MYF001ZWKS2OM50@a-mtaout22.012.net.il>; Thu, 26 Dec 2013 22:26:27 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82630 Archived-At: 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'? As Jarek pointed out in his patch for bug #15461, the doc string of shell-dynamic-complete-command hints on the reason: This function is similar to `comint-dynamic-complete-filename', except that it searches `exec-path' (minus the trailing Emacs library path) for completion candidates. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It talks about "Emacs library path", but actually means the libexec directory, which is normally the value of exec-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. 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. In GNU Emacs 24.3.50.187 (i686-pc-mingw32) of 2013-12-26 on HOME-C4E4A596F7 Bzr revision: 115758 fgallina@gnu.org-20131226164519-xccapciswuo6gvid Windowing system distributor `Microsoft Corp.', version 5.1.2600 Configured using: `configure --prefix=/d/usr --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-2 -g3'' Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r t - e m Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process w32notify w32 multi-tty emacs)