Re: autocomplete [message #43342 is a reply to message #43324] |
Wed, 30 March 2005 08:30   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Wed, 30 Mar 2005 10:48:11 +0200, maarten wrote:
> Hello everybody,
>
> I was wondering whether it is possible to have some sort of
> autocompletion at the IDL prompt in Linux. When working in Matlab for
> example typing the first few letters of a command or file and pressing
> 'tab' results in automatic completing the rest. (the same way the
> xterminal works). Another very useful feature is that when the first few
> letters are typed, pressing 'arrow up' results in only history results
> that start with these letters. Is it possible to have this implemented
> in IDL, or are there any other 'terminal' like command lines that offer
> these features in which IDL can be run. At the moment I am running IDL
> at the command line under Linux.
> I hope someone knows whether this is possible, or that RSINC is working
> on something like this. Because in my opinion it would greatly improve IDL.
>
As David points, out the Emacs mode IDLWAVE (idlwave.org) does this for
you, and more. In fact, the number of things IDLWAVE can complete is
quite remarkable, far more than the shell provide. From the IDLWAVE
manual):
The completion function is context sensitive and figures out what to
complete based location of the point. Here are example lines and what
M-TAB would try to complete when the cursor is on the position marked
with a `_':
plo_ Procedure
x = a_ Function
plot,xra_ Keyword of plot procedure
plot,x,y,/x_ Keyword of plot procedure
plot,min(_ Keyword of min function
obj -> a_ Object method (procedure)
a(2,3) = obj -> a_ Object method (function)
x = obj_new('IDL_ Class name
x = obj_new('MyCl',a_ Keyword to Init method in class MyCl
pro A_ Class name
pro _ Fill in Class:: of first method in this file
!v_ System variable
!version.t_ Structure tag of system variable
self.g_ Class structure tag in methods
state.w_ Structure tag, if tag completion enabled
name = 'a_ File name (default inside quotes)
When in the shell, completing:
c->[Tab] will actually query the shell for the type of object "c" is,
and based completions on that. In the next release, the same will be
true of structure tag completion in the shell.
Regarding the "up-arrow" trick in the shell, I posted some code to do
this inside of IDLWAVE last year, but in my opinion it is better to
use the built-in "comint" commands that Emacs provides for this. For
example, when I want to find an old command, I do
Meta-r tes[RET]
and get:
IDL> print,strpos('test',['t','s'])
This is a full regexp search. You can also browse your full command
history in a buffer as well: C-c C-l. Middle click an entry to insert
it (using search in this buffer is good as well: it give you the
context around your command to see if it is the correct one). The
history is kept from session to session.
Good luck,
JD
|
|
|