tags:

views:

155

answers:

6

...just like packages do.

I use Emacs (maybe, it can offer some kind of solution).

For example (defun the-very-very-long-but-good-name () ...) is not to useful later in code. But the name like Fn-15 or the first letters abbreviation is not useful too. Is it possible either to have an alias like for packages or to access the documentation string while trying to recall the function's name?

In other words, is it possible for functions to mix somehow self-documenting and short names?

A: 

If your problem is that you can't remember a very long function name, but you remember PART of the name, that's what "apropos" is for. In my Emacs, I have "C-h a" bound to "hyper-apropos". You enter a substring of the symbol you're looking for, and it lists all the matches.

David M. Karr
My problem is that I want both short names and descriptions, I think.
avp
A: 

You could simply have a function that just calls another function.

Marcin
You would loose documentation then.
leppie
A: 

I dont know Emacs, but wouldn't (define shortname longnamefunctionblahblah) work?

leppie
Well... First, it is not automatic. Second, I need to care about it myself. Third, it is clunky... :(
avp
A: 

you can use (defmacro ...) to alias a function

dsm
avp
+10  A: 

You want defalias. (defalias 'newname oldname) will preserve documentation and even show "newname is an alias for `oldname'" when its documentation is requested.

Allen
Hm, how to use it? I can't find it in CL-USER and others...
avp
Ctrl-H f defalias well get you wehre you need to go.
Jonathan Arkell
+1  A: 

If it's all the typing which makes continual use of long names undesirable, then yes, emacs can help. Check out abbrev-mode. Also well thought-of in this context is hippie-expand.

If it's a question of readability, that's harder.

fivebells