Function: gud-lldb-fetch-completions

gud-lldb-fetch-completions is a byte-compiled function defined in gud.el.gz.

Signature

(gud-lldb-fetch-completions CONTEXT COMMAND)

Documentation

Return the data to complete the LLDB command before point.

This is what the Python function we installed at initialization time returns, as a Lisp list. Maximum number of completions requested from LLDB is controlled by gud-lldb-max-completions, which see.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gud.el.gz
(defun gud-lldb-fetch-completions (context command)
  "Return the data to complete the LLDB command before point.
This is what the Python function we installed at initialization
time returns, as a Lisp list.
Maximum number of completions requested from LLDB is controlled
by `gud-lldb-max-completions', which see."
  (let* ((process (get-buffer-process gud-comint-buffer))
         (to-complete (concat context command))
         (output-buffer (get-buffer-create "*lldb-completions*")))
    ;; Send the completion command with output to our buffer
    (with-current-buffer output-buffer
      (erase-buffer))
    (comint-redirect-send-command-to-process
     (format "script --language python -- gud_complete('%s', %d)"
             to-complete gud-lldb-max-completions)
     output-buffer process nil t)
    ;; Wait for output
    (unwind-protect
        (while (not comint-redirect-completed)
          (accept-process-output process 2))
      (comint-redirect-cleanup))
    ;; Process the completion output.
    (with-current-buffer output-buffer
      (goto-char (point-min))
      (when (search-forward "gud-completions: ##" nil t)
        (read (current-buffer))))))