.dir-locals.el

Table of Contents

.dir-locals.el holds directory local variables/bindings. With it you can have all files under that directory to have special variable values, such as “for all files under ~/org-roam, their frame title would include ”roam“”

((nil . ((indent-tabs-mode . t)
         (fill-column . 80)

         (mode . auto-fill)))
 (c-mode . ((c-file-style . "BSD")
            (subdirs . nil)))
 ("src/imported"
  . ((nil . ((change-log-default-name
              . "ChangeLog.local"))))))

1. trusting .dir-locals.el variables

(add-to-list 'safe-local-variable-values '(var . value)) ;; a specific value
(put 'var 'safe-local-variable #'stringp) ;; a varialbe that is of string type

2. project root

((nil . ((obsidian-specify-path (locate-dominating-file default-directory ".dir-locals.el"))
         )))

3. links

Backlinks

emacs

Emacs is an editor featuring:

Author: Linfeng He

Created: 2024-04-14 Sun 03:26