c-eldoc mode displays the arguments of C functions while one is programming.
git clone git://github.com/nflath/c-eldoc.git
This version takes the function declarations from preprocessor output, thus allowing one to use it with system-dependent functions from any library. This was developed as a response to CEDET, which I was unable to use. If you know how to make this feature work in CEDET (I believe it is called
‘summary-mode’), please post the method here. This approach is somewhat simpler than that of CEDET.
It currently only works with the C language.
This file requires the new eldoc functions available in Emacs 22. You’ll also need a GNU-compatible version of
cpp. This shouldn’t be a problem for most people running GNU/Linux systems. I have not tested this on XEmacs yet. Please post if it works.
(install-elisp-from-emacswiki "c-eldoc.el")if you have InstallElisp, or download Lisp:c-eldoc.el from the ElispArea and save to your emacs-lisp directory.
;; add in your commonly used packages/include directories here, for ;; example, SDL or OpenGL. this shouldn't slow down cpp, even if ;; you've got a lot of them (setq c-eldoc-includes "`pkg-config gtk+-2.0 --cflags` -I./ -I../ ") (load "c-eldoc") (add-hook 'c-mode-hook 'c-turn-on-eldoc-mode)
Replaced English with installation code. You should not force users to translate English into code. – rubikitch
The code here makes a few changes to Paul Pogonyshev’s c-eldoc mode, originally posted on emacs-devel . Paul’s version worked using TAGS, but this version has eliminated this restriction, allowing one to use it with any function that is
#included at the top of the C file. It is essentially the same speed, but one no longer needs to make a large
TAGS file for
/usr/include. When Paul first posted, there was some talk of putting it in a future release of GNU Emacs, but I have yet to see this actually happen.
In 2010, Nathaniel Flath added caching to this file to make it usable on large projects, “like the emacs codebase”.
I think caching symbol-info into alist or hashtable is better than calculating symbol-info EVERY TIME. It is immutable until the source file and included files are modified. – rubikitch
Nathaniel’s patch has resolved this issue. :) – MattStrange?
if you replace the grep command and the function-name pattern (2 times in the code) like below, you could get complex macros/functions working like printf or others from stdio.h.
c-eldoc-grep "'[^a-zA-Z_0-9]" function-name "[\s]*('" ))
The preprocessed-source buffers don’t (always?) go away when the main buffer does. – KenRaeburn?
For another take on c-eldoc, see this article.