Function: autoconf-parameter-count
autoconf-parameter-count is a byte-compiled function defined in
autoconf-edit.el.gz.
Signature
(autoconf-parameter-count)
Documentation
Return the number of parameters to the function on the current line.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/ede/autoconf-edit.el.gz
(defun autoconf-parameter-count ()
"Return the number of parameters to the function on the current line."
(save-excursion
(beginning-of-line)
(let* ((end-of-cmd
(save-excursion
(if (re-search-forward "(" (line-end-position) t)
(progn
(forward-char -1)
(forward-sexp 1)
(point))
;; Else, just return EOL.
(line-end-position))))
(cnt 0))
(save-restriction
(narrow-to-region (line-beginning-position) end-of-cmd)
(condition-case nil
(progn
(down-list 1)
(while (re-search-forward ", ?" end-of-cmd t)
(setq cnt (1+ cnt)))
(cond ((> cnt 1)
;; If the # is > 1, then there is one fewer , than args.
(1+ cnt))
((not (looking-at "\\s-*)"))
;; If there are 0 args, then we have to see if there is one arg.
(1+ cnt))
(t
;; Else, just return the 0.
cnt)))
(error 0))))))