Function: pascal-comp-defun

pascal-comp-defun is a byte-compiled function defined in pascal.el.gz.

Signature

(pascal-comp-defun PASCAL-STR PASCAL-PRED PASCAL-FLAG)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/pascal.el.gz
;; Function passed to completing-read, try-completion or
;; all-completions to get completion on any function name. If
;; predicate is non-nil, it must be a function to be called for every
;; match to check if this should really be a match. If flag is t, the
;; function returns a list of all possible completions. If it is nil
;; it returns a string, the longest possible completion, or t if STR
;; is an exact match. If flag is 'lambda, the function returns t if
;; STR is an exact match, nil otherwise.

(defun pascal-comp-defun (pascal-str pascal-pred pascal-flag)
  (save-excursion
    (let ((pascal-all nil))

      ;; Build regular expression for functions
      (let ((pascal-str (pascal-build-defun-re (if (string= pascal-str "")
                                                   "[a-zA-Z_]"
                                                 pascal-str))))
        (goto-char (point-min))

        ;; Build a list of all possible completions
        (while (re-search-forward pascal-str nil t)
          (push (match-string 2) pascal-all)))

      ;; Now we have built a list of all matches. Give response to caller
      (complete-with-action pascal-flag pascal-all pascal-str pascal-pred))))