     (limit . nil)))
 
 (provide 'auto-complete-c-headers)
-;;; auto-complete-c-headers.el ends here+;;; auto-complete-c-headers.el ends here

(defvar achead:ac-prefix "#\\(?:include\\|import\\)[ \t]*[<\"][ \t]*\\([^\"<>' \t\r\n]+\\)"
  "`prefix' value for `auto-complete'")

(defun achead:get-include-directories-from-options (cmd-line-options)
  "Extract include directory names from command line options
  like (\"-I~/.local/include/\" \"-I~/src/include/\")."

  "Get all header files under `basedir' as if -I option is
enabled for directories returned by
`achead:get-include-directories-function'."
  (let ((remote (and achead:inspect-remote-directories
                     (file-remote-p default-directory))))
    (loop with dir-suffix = (or basedir "")
          with include-base-dirs = (delete-duplicates (funcall achead:get-include-directories-function)
                                                      :test 'string=)
          for include-base in include-base-dirs
          append (loop with dir = (file-name-directory (concat (file-name-as-directory include-base)
                                                               dir-suffix))
                       with files = (achead:file-list-for-directory (concat remote dir))
                       for file in files
                       ;; FIXME: Are there a good way to bind variable inside a loop (`with' cannot capture `file')?
                       ;; (concat dir file) should be bounded to a variable like `real-path'
                       when (or (file-directory-p (concat dir file))
                                (and achead:include-patterns (achead:path-should-be-displayed (concat dir file))))
                       collect (cons (if (file-directory-p (concat dir file))
                                         (concat dir-suffix (concat file "/"))
                                       (concat dir-suffix file))
                                     (concat dir file)))))
  )

(defvar achead:ac-latest-results-alist nil
  "Keeps latest results, which is a list of (candidate . header-path).")
