Function: jinx--save-dir

jinx--save-dir is a natively compiled function defined in jinx.el.

Signature

(jinx--save-dir ACTION KEY WORD)

Documentation

Add or remove WORD from directory-local variable, or format word with KEY.

Uses a .dir-locals.el file in the current directory or any parent directory. If no .dir-locals.el file is found, it is created in the project root. If no project root is found, it is created in the current directory. ACTION can be add, remove, has, format.

Source Code

;; Defined in /nix/store/b5jnxgwmlp7hh60wfrx7amhrmrpfcqqi-emacs-packages-deps/share/emacs/site-lisp/elpa/jinx-20260926.912/jinx.el
(defun jinx--save-dir (action key word)
  "Add or remove WORD from directory-local variable, or format word with KEY.
Uses a .dir-locals.el file in the current directory or any parent
directory.  If no .dir-locals.el file is found, it is created in the
project root.  If no project root is found, it is created in the current
directory.  ACTION can be add, remove, has, format."
  (pcase-exhaustive action
    ((or 'add 'remove)
     (jinx--save-local-word action 'jinx-dir-local-words word)
     (let ((default-directory
            (or (locate-dominating-file default-directory ".dir-locals.el")
                (when-let* ((proj (project-current)))
                  (declare-function project-root "project")
                  (project-root proj))
                default-directory)))
       (save-window-excursion
         (if (equal jinx-dir-local-words "")
             (delete-dir-local-variable nil 'jinx-dir-local-words)
           (add-dir-local-variable nil 'jinx-dir-local-words jinx-dir-local-words)))))
    ('has (member word (split-string jinx-dir-local-words)))
    ('format `((,(char-to-string key) ,word "Directory")))))