How do I setup code completion in Emacs for Lisp? I have code completion
in the REPL buffer, but not in the Lisp file editing buffers. I saw a
demo video of Uncommon web and it seems that it's possible to add code
completion to file editing buffers also. Does anyone know how to do
this? Thanks
-Jeff
The first hit for a Google search on the three words emacs,
completion, lisp was this:
<http://www.delorie.com/gnu/docs/emacs/emacs_294.html>, and it says
it's M-TAB. If this conflicts with your window manager (it did with
mine), you'll have to reconfigure it or Emacs.
Wolfram
Jeffery Zhang <····@cornell.edu> writes:
> How do I setup code completion in Emacs for Lisp? I have code
> completion in the REPL buffer, but not in the Lisp file editing
> buffers. I saw a demo video of Uncommon web and it seems that it's
> possible to add code completion to file editing buffers also. Does
> anyone know how to do this? Thanks
>
> -Jeff
If you're using SLIME, it's already there - just use C-TAB in Lisp
buffers.
Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and C-Tab
just does nothing. Do you know what is the actual M-x command for it?
This way I might be able to bind Tab to it.
Jeffery Zhang wrote:
> How do I setup code completion in Emacs for Lisp? I have code completion
> in the REPL buffer, but not in the Lisp file editing buffers. I saw a
> demo video of Uncommon web and it seems that it's possible to add code
> completion to file editing buffers also. Does anyone know how to do
> this? Thanks
>
> -Jeff
Jeffery Zhang <····@cornell.edu> writes:
> Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
> C-Tab just does nothing. Do you know what is the actual M-x command
> for it? This way I might be able to bind Tab to it.
From describe-key on it:
M-TAB (translated from <M-tab>) runs the command lisp-complete-symbol
which is an interactive compiled Lisp function in `lisp.el'.
It is bound to M-TAB.
(lisp-complete-symbol &optional predicate)
Perform completion on Lisp symbol preceding point.
Compare that symbol against the known Lisp symbols.
If no characters can be completed, display a list of possible completions.
Repeating the command at that point scrolls the list.
Can I rebind the functions?
Ari Johnson wrote:
> Jeffery Zhang <····@cornell.edu> writes:
>
>
>>Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
>>C-Tab just does nothing. Do you know what is the actual M-x command
>>for it? This way I might be able to bind Tab to it.
>
>
> From describe-key on it:
>
> M-TAB (translated from <M-tab>) runs the command lisp-complete-symbol
> which is an interactive compiled Lisp function in `lisp.el'.
> It is bound to M-TAB.
> (lisp-complete-symbol &optional predicate)
>
> Perform completion on Lisp symbol preceding point.
> Compare that symbol against the known Lisp symbols.
> If no characters can be completed, display a list of possible completions.
> Repeating the command at that point scrolls the list.
Jeffery Zhang wrote:
> Can I rebind the functions?
Yeah, a more useful rebinding is something along the lines of
(slime-define-key [tab] 'slime-indent-and-complete-symbol)
that way tab 'just works' whether you're indenting or completing.
Jeffery Zhang <····@cornell.edu> writes:
> Can I rebind the functions?
Nothing stops you from it. Also, if you have trouble in the future,
you should try posting on comp.emacs. There are a lot of people who
use Emacs but don't code in Common Lisp, and you'll get better help as
a result. :)
Ah good advice. Will do that.
Ari Johnson wrote:
> Jeffery Zhang <····@cornell.edu> writes:
>
>
>>Can I rebind the functions?
>
>
> Nothing stops you from it. Also, if you have trouble in the future,
> you should try posting on comp.emacs. There are a lot of people who
> use Emacs but don't code in Common Lisp, and you'll get better help as
> a result. :)
Jeffery Zhang <····@cornell.edu> writes:
> Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
> C-Tab just does nothing. Do you know what is the actual M-x command
> for it? This way I might be able to bind Tab to it.
>
> Jeffery Zhang wrote:
>> How do I setup code completion in Emacs for Lisp? I have code
>> completion in the REPL buffer, but not in the Lisp file editing
>> buffers. I saw a demo video of Uncommon web and it seems that it's
>> possible to add code completion to file editing buffers also. Does
>> anyone know how to do this? Thanks
>> -Jeff
slime-complete-symbol
But it actually should have been C-c TAB. Sorry.
Jeffery Zhang <····@cornell.edu> writes:
> Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
> C-Tab just does nothing. Do you know what is the actual M-x command
> for it? This way I might be able to bind Tab to it.
This is probably because your Lisp buffers are not in the SLIME minor
mode.
-
\ Troels "Athas" Henriksen
/\ - Insert witty signature
Jeffery Zhang <····@cornell.edu> writes:
> Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
> C-Tab just does nothing. Do you know what is the actual M-x command
> for it? This way I might be able to bind Tab to it.
>
> Jeffery Zhang wrote:
>> How do I setup code completion in Emacs for Lisp? I have code
>> completion in the REPL buffer, but not in the Lisp file editing
>> buffers. I saw a demo video of Uncommon web and it seems that it's
>> possible to add code completion to file editing buffers also. Does
>> anyone know how to do this? Thanks
>> -Jeff
If you want to bind the tab key to code completion, put the following in your
init.el file.
(defun my-set-indent-and-complete-symbol()
(local-set-key [tab] 'slime-indent-and-complete-symbol))
;feel free to use some other key combination
(add-hook 'slime-mode-hook 'my-set-indent-and-complete-symbol)
;;you can add other modes also, for example:
(add-hook 'emacs-lisp-mode-hook 'my-set-indent-and-complete-symbol)
HTH.
--
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html
,----
| WHY SHOULD WE SAVE TIGER?
| Ans: Saving the tiger means saving mankind..
|
| Help http://pudang.tripod.com/
| or https://secure.worldwildlife.org/forms/tiger_appeal_1.cfm
`----
Jeffery Zhang <····@cornell.edu> writes:
> Neither C-Tab nor M-Tab works. M-Tab is switch app in Windows, and
> C-Tab just does nothing. Do you know what is the actual M-x command
> for it? This way I might be able to bind Tab to it.
>
> Jeffery Zhang wrote:
>> How do I setup code completion in Emacs for Lisp? I have code
>> completion in the REPL buffer, but not in the Lisp file editing
>> buffers. I saw a demo video of Uncommon web and it seems that it's
>> possible to add code completion to file editing buffers also. Does
>> anyone know how to do this? Thanks
>> -Jeff
Possibly a stupid question, but are you sure your lisp file is in
slime mode? I only ask because depending on how slime has been
installed and what you are using for your lisp file extensions, it is
not unusual for slime mode not to be automatically enabled when
editing lisp files.
Tim
--
tcross (at) rapttech dot com dot au
Jeffery Zhang wrote:
> How do I setup code completion in Emacs for Lisp? I have code completion
> in the REPL buffer, but not in the Lisp file editing buffers. I saw a
> demo video of Uncommon web and it seems that it's possible to add code
> completion to file editing buffers also. Does anyone know how to do
> this? Thanks
As others have pointed out Alt-Tab doesn't work as normal on MS
Windows, buy Esc-Tab does.
But I find it most useful to load all the relevant files for a project
and then use M-/