Monday, June 06, 2005

php-show-arglist

Improving the support for php in emacs, shows the argument list for a function in the minibuffer.

php-get-pattern can be found in php-mode.el

(defun php-show-arglist ()
  (interactive)
  (let* ((tagname (php-get-pattern))
         (buf (find-tag-noselect tagname nil nil))
         arglist)
    (save-excursion
      (set-buffer buf)
      (goto-char (point-min))
      (when (re-search-forward
             (format "function[ \t]+%s[ \t]*(\\([^{]*\\))" tagname)
             nil t)
        (setq arglist (buffer-substring-no-properties
                       (match-beginning 1) (match-end 1)))))
    (if arglist
        (message "Arglist for %s: %s" tagname arglist)
        (message "unknown function: %s" tagname))))

No comments: