Function: pcomplete-long-option-completion-table

pcomplete-long-option-completion-table is a byte-compiled function defined in pcomplete.el.gz.

Signature

(pcomplete-long-option-completion-table OPTIONS)

Documentation

Make a completion table for a list of OPTIONS.

OPTIONS should be a list of option strings; if a string ends in
"=", it's an option that accepts a value.

Source Code

;; Defined in /usr/src/emacs/lisp/pcomplete.el.gz
(defun pcomplete-long-option-completion-table (options)
  "Make a completion table for a list of OPTIONS.
OPTIONS should be a list of option strings; if a string ends in
\"=\", it's an option that accepts a value."
  (lambda (string pred action)
    (pcase action
      ('nil                             ; try-completion
       (let ((result (try-completion string options pred)))
         ;; If the completion ends in "=", then it's not really
         ;; complete yet: we expect a value after the "=".  Return the
         ;; original STRING in this case instead of t to indicate
         ;; that.
         (if (and (eq result t) (string-suffix-p "=" string))
             string
           result)))
      ('t                               ; all-completions
       ;; Don't list completions when the boundary starts after an "=".
       (unless (and (string-suffix-p "=" string)
                    (member string options))
         (all-completions string options pred)))
      ('lambda                          ; test-completion
       (test-completion string options pred))
      (`(boundaries . ,suffix)          ; completion-boundaries
       ;; As above, if the completion ends in "=", then it's not
       ;; complete yet.  The completion's boundary should start after
       ;; the "=" to indicate that that's where subsequent completions
       ;; will occur.
       (if (and (string-suffix-p "=" string)
                (member string options))
           `(boundaries ,(length string) . ,(length suffix))
         (completion-boundaries string options pred suffix))))))