Function: dir-locals--sort-variables

dir-locals--sort-variables is a byte-compiled function defined in files.el.gz.

Signature

(dir-locals--sort-variables VARIABLES)

Documentation

Sort VARIABLES so that applying them in order has the right effect.

The variables are compared by dir-locals--get-sort-score. Directory entries are then recursively sorted using the same criteria.

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun dir-locals--sort-variables (variables)
  "Sort VARIABLES so that applying them in order has the right effect.
The variables are compared by `dir-locals--get-sort-score'.
Directory entries are then recursively sorted using the same
criteria."
  (setq variables (sort variables
                        (lambda (a b)
                          (< (dir-locals--get-sort-score a)
                             (dir-locals--get-sort-score b)))))
  (dolist (n variables)
    (when (stringp (car n))
      (setcdr n (dir-locals--sort-variables (cdr n)))))

  variables)