[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Autocompletion of Emacs Lisp Symbols in Buffer

From: Dirk80
Subject: Autocompletion of Emacs Lisp Symbols in Buffer
Date: Thu, 6 May 2010 06:30:31 -0700 (PDT)

When I'm in lisp-interaction-mode or emacs-lisp mode, i.e. I'm writing
emacs-lisp code in a buffer, then I would like to have the feature of
autocompletion when I'm pressing tab.

I'm typing insert-buf. Then the possible completions would be:

The completion algorithm of the minibuffer can do this. But I would like to
have that feature when I'm programming code in a normal buffer.

My idea is the following:
I know that obarray contains the symbol table. So I wrote a fucntion which
inserts all symbols of obarray into a buffer. 

(defun insert-obarray-entries-into-temp-buffer (symbol)
    (set-buffer (get-buffer-create "*temp*"))
    (insert (concat (symbol-name symbol) "\n"))))

(mapatoms 'insert-obarray-entries-into-temp-buffer obarray)

Now I can use (dabbrev-expand nil). I have a smart-tab function in my .emacs
file. This function is bound to "tab" and calls (dabbrev-expand nil) when
point is for example at the end of a word.

Ok, I have more or less a solution. But I think that my solution is just a
workaround. And each time, when a new symbol is inserted into obarray I
would have to update the temporary created buffer.

How would you solve this problem or have you already solved it?

Thank you!

View this message in context:
Sent from the Emacs - Help mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]