help-gnu-emacs
[Top][All Lists]
Advanced

[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.

Example:
I'm typing insert-buf. Then the possible completions would be:
insert-buf
insert-buffer
insert-buffer-substring-no-properties
insert-buffer-substring-as-yank
insert-buffer-substring

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)
  (save-excursion
    (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!

Greetings,
Dirk
-- 
View this message in context: 
http://old.nabble.com/Autocompletion-of-Emacs-Lisp-Symbols-in-Buffer-tp28473645p28473645.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





reply via email to

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