php-functions for emacs
While I originally wrote php-functions in the Summer of 2002, I never
made it especially public or wrote any documentation about it whatsoever.
I hope to remedy that now.
What php-functions does:
One and only one thing... It provides the PHP developer in emacs with
a fast function prototype lookup for PHP's built in functions. (All
the functions in the PHP manual...)
Requirements:
php-functions is an addon to php-mode
for emacs. Thus, obviously, you must be using emacs (xemacs works too)
and have php-mode installed.
Optionally, php-functions works very nicely alongside php-completion,
another php-mode addon that adds PHP function name completion on M-Tab.
I don't know its official site (please let me know if you find it) but
you can download a copy from here.
How php-functions works:
The nutshell version is that php-functions contains a list of all the
functions in the PHP manual, along with their prototype. It exports
the command php-find-function-prototype (for you M-x users) and also
adds a menu item in the PHP menu. Because I'm a realist, and I use it
myself, it also binds to a key shortcut: C-c C-, (that's a comma) is
the default, but you might want to define a different key shortcut in
your .emacs. It's easy, and it's part of the installation instructions
(below).
How to get php-functions:
Just download it from here.
How to install php-functions:
After downloading and ungzipping the elisp library, and assuming that
you have php-mode installed already, all you have to do is load-library
before wanting to use it. I do that in my .emacs with (load-library
"~/php-functions") after I load php-mode.
If you want to bind a different key, say C-c C-p, to php-functions,
add the following chunk to your .emacs.
(define-key php-mode-map
[?\C-c ?\C-p]
'php-find-function-prototype
)
There's one last issue: some emacs installations don't seem to have or
load the subr library, which contains one function that php-functions
currently relies on. So, if you try to install and use php-functions and
get errors about the dolist macro, you can add the following to your .emacs:
(defmacro dolist (spec &rest body)
"(dolist (VAR LIST [RESULT]) BODY...): loop over a list.
Evaluate BODY with VAR bound to each car from LIST, in turn.
Then evaluate RESULT to get return value, default nil."
(let ((temp (make-symbol "--dolist-temp--")))
(list 'let (list (list temp (nth 1 spec)) (car spec))
(list 'while temp
(list 'setq (car spec) (list 'car temp))
(cons 'progn
(append body
(list (list 'setq temp (list 'cdr temp))))))
(if (cdr (cdr spec))
(cons 'progn
(cons (list 'setq (car spec) nil) (cdr (cdr spec))))))))
Happy hacking!
|