Function: editorconfig--get-dir-local-variables

editorconfig--get-dir-local-variables is a byte-compiled function defined in editorconfig.el.gz.

Signature

(editorconfig--get-dir-local-variables)

Documentation

Return the directory local variables specified via EditorConfig.

Meant to be used on hack-dir-local-get-variables-functions.

Source Code

;; Defined in /usr/src/emacs/lisp/editorconfig.el.gz
(defun editorconfig--get-dir-local-variables ()
  "Return the directory local variables specified via EditorConfig.
Meant to be used on `hack-dir-local-get-variables-functions'."
  (when (stringp buffer-file-name)
    (let* ((props (editorconfig-call-get-properties-function buffer-file-name))
           (alist (if (< 0 (hash-table-count props))
                      (editorconfig--get-local-variables props))))
      ;; FIXME: If there's `/foo/.editorconfig', `/foo/bar/.dir-locals.el',
      ;; and `/foo/bar/baz/.editorconfig', it would be nice to return two
      ;; pairs here, so that hack-dir-local can give different priorities
      ;; to the `/foo/.editorconfig' settings compared to those of
      ;; `/foo/bar/baz/.editorconfig', but we can't just convert the
      ;; settings from each file individually and let hack-dir-local merge
      ;; them because hack-dir-local doesn't have the notion of "unset",
      ;; and because the conversion of `indent_size' depends on `tab_width'.
      (when alist
        (cons
         (file-name-directory (editorconfig-core-get-nearest-editorconfig
                               buffer-file-name))
         alist)))))