[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is TAB-completion in shell not working for some commands?
From: |
Marius Hofert |
Subject: |
Re: Why is TAB-completion in shell not working for some commands? |
Date: |
Wed, 9 Nov 2011 18:51:11 +0100 |
On 2011-11-09, at 18:38 , Jonathan Oddie wrote:
>
> Hi Marius,
>
>> 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.
>
> 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
>
>> [snip]
>
>>
>> => 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?
>
> 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:
>
> (add-to-list 'exec-path "/some/path/here")
>
> 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.
>
> 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 ;-)
>
> 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.
Re: Why is TAB-completion in shell not working for some commands?, Jonathan Oddie, 2011/11/09