Function: pcomplete-do-complete

pcomplete-do-complete is a byte-compiled function defined in pcomplete.el.gz.

Signature

(pcomplete-do-complete STUB COMPLETIONS)

Documentation

Dynamically complete at point using STUB and COMPLETIONS.

This is basically just a wrapper for pcomplete-stub(var)/pcomplete-stub(fun) which does some extra checking, and munging of the COMPLETIONS list.

Source Code

;; Defined in /usr/src/emacs/lisp/pcomplete.el.gz
;; Selection of completions.

(defun pcomplete-do-complete (stub completions)
  "Dynamically complete at point using STUB and COMPLETIONS.
This is basically just a wrapper for `pcomplete-stub' which does some
extra checking, and munging of the COMPLETIONS list."
  (unless (stringp stub)
    (message "Cannot complete argument")
    (throw 'pcompleted nil))
  (if (null completions)
      (ignore
       (if (and stub (> (length stub) 0))
	   (message "No completions of %s" stub)
	 (message "No completions")))
    ;; pare it down, if applicable
    (when (and pcomplete-use-paring pcomplete-seen)
      (setq pcomplete-seen
            (mapcar #'directory-file-name pcomplete-seen))
      (dolist (p pcomplete-seen)
        (add-to-list 'pcomplete-seen
                     (funcall pcomplete-norm-func p)))
      (setq completions
            (apply-partially #'completion-table-with-predicate
                             completions
                             (when pcomplete-seen
                               (lambda (f)
                                 (not (member
                                       (funcall pcomplete-norm-func
                                                (directory-file-name f))
                                       pcomplete-seen))))
                             'strict)))
    ;; OK, we've got a list of completions.
    (if pcomplete-show-list
        ;; FIXME: pay attention to boundaries.
	(pcomplete-show-completions (all-completions stub completions))
      (pcomplete-stub stub completions))))