From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marius Hofert Newsgroups: gmane.emacs.help Subject: Re: Why is TAB-completion in shell not working for some commands? Date: Wed, 9 Nov 2011 18:51:11 +0100 Message-ID: References: <8BF2824B-97AC-4722-8F2C-C572C5F558FF@gmail.com> <1E4EE682-3100-41C9-A4C5-1E537BF01647@math.ethz.ch> <1979BC10-E138-4B26-83BD-CBBBEC6F09CC@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1320861093 22568 80.91.229.12 (9 Nov 2011 17:51:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Nov 2011 17:51:33 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Jonathan Oddie Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 09 18:51:29 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ROCJ5-000701-EA for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Nov 2011 18:51:27 +0100 Original-Received: from localhost ([::1]:44329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROCIz-0000m8-Ur for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Nov 2011 12:51:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:53843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROCIu-0000l8-GC for help-gnu-emacs@gnu.org; Wed, 09 Nov 2011 12:51:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROCIt-0002gh-Br for help-gnu-emacs@gnu.org; Wed, 09 Nov 2011 12:51:16 -0500 Original-Received: from edge10.ethz.ch ([82.130.75.186]:23242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROCIt-0002gL-3D for help-gnu-emacs@gnu.org; Wed, 09 Nov 2011 12:51:15 -0500 Original-Received: from CAS11.d.ethz.ch (172.31.38.211) by edge10.ethz.ch (82.130.75.186) with Microsoft SMTP Server (TLS) id 14.1.339.1; Wed, 9 Nov 2011 18:51:12 +0100 Original-Received: from 77-58-145-155.dclient.hispeed.ch (77.58.145.155) by CAS11.d.ethz.ch (172.31.38.211) with Microsoft SMTP Server (TLS) id 14.1.339.1; Wed, 9 Nov 2011 18:51:12 +0100 In-Reply-To: <1979BC10-E138-4B26-83BD-CBBBEC6F09CC@gmail.com> X-Mailer: Apple Mail (2.1251.1) X-Originating-IP: [77.58.145.155] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.130.75.186 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82827 Archived-At: On 2011-11-09, at 18:38 , Jonathan Oddie wrote: >=20 > Hi Marius, >=20 >> 1) If I start emacs from the terminal, TAB-completion works (as = reported earlier). Now the emacs I start from the terminal is actally = (output of "which emacs"): >> /Applications/Emacs.app/Contents/MacOS//emacs >> and not the /Applications/Emacs.app (the GUI version one clicks on in = the dock). So when I started emacs from the terminal, I used Options -> = Keep in Dock to keep that in the dock instead of = /Applications/Emacs.app. Starting the former, I again did not have = TAB-completion, so it only works when (really) starting emacs from the = terminal (which is funny cause I thought I can get rid of the Mac's = terminal since I have a shell in emacs...) >> Don't know if that makes sense to the experts, I just wanted to = report on this. >=20 > Those two are actually the same > thing. /Applications/Emacs.app/Contents/MacOS/emacs is just the > executable file hidden inside the Emacs.app bundle. So it really does > depend on starting from the Terminal and picking up your PATH > settings. okay >=20 >> [snip] >=20 >>=20 >> =3D> Clearly, the /opt-directories are missing. I haven't tried but = one might just add all directories from PATH to exec-path, but whenever = I change PATH, I have to remember to do the same for exec-path. Is there = a nicer way? >=20 > Yes, I'd try adding your /opt directories to `exec-path' first and see = if that fixes > the problem. You can either something like the (setq exec-path (append = ... )) solution in my last email, or the following: >=20 > (add-to-list 'exec-path "/some/path/here") >=20 > Note that you might *also* need to set the environment PATH variable > from within Emacs; that's the line with `mapconcat' in my prev > email. As I said, I forget exactly how each of these things interacts > with shell-mode's tab-completion. >=20 > If that works, the nicer solution would probably involve having your > .emacs run a short shell script to print out and parse the value of > PATH set in your .bashrc (or wherever), and set PATH and `exec-path' > based on that. I'll try and work out a quick hack for this later this > evening, if someone doesn't beat me to it ;-) >=20 > cheers, > Jonathan Okay, in the meantime, I tried something like: (setq exec-path (getenv "PATH")) but that of course failed. I then put in: (setq exec-path (append exec-path '("/opt/local/bin"))); set exec-path (setenv "PATH" (mapconcat 'identity exec-path ":")); set PATH and restarted emacs. Still no TAB-completion :-( If that helps, I originally had the following to get the same PATH as in = the terminal: (setq explicit-bash-args (list "--login" "-i")) (that with the seq exec-path command above also did not work, though) I'll try what you suggested in your recent mail, soon.