.dir-locals.el: Add .go to completion-ignored-extensions.
[jackhill/guix/guix.git] / .dir-locals.el
1 ;; Per-directory local variables for GNU Emacs 23 and later.
2
3 ((nil
4 . ((fill-column . 78)
5 (tab-width . 8)
6 (sentence-end-double-space . t)
7
8 ;; For use with 'bug-reference-prog-mode'.
9 (bug-reference-bug-regexp
10 . "\\(<https?://\\bugs\\.gnu\\.org/\\([0-9]+\\)>\\)")
11 (bug-reference-url-format . "https://bugs.gnu.org/%s")
12
13 (eval . (add-to-list 'completion-ignored-extensions ".go"))
14
15 ;; Emacs-Guix
16 (eval . (setq-local guix-directory
17 (locate-dominating-file default-directory
18 ".dir-locals.el")))
19 ;; YASnippet
20 (eval . (with-eval-after-load
21 'yasnippet
22 (let ((guix-yasnippets
23 (expand-file-name
24 "etc/snippets"
25 (locate-dominating-file default-directory
26 ".dir-locals.el"))))
27 (unless (member guix-yasnippets yas-snippet-dirs)
28 (add-to-list 'yas-snippet-dirs guix-yasnippets)
29 (yas-reload-all)))))
30
31 ;; Geiser
32 ;; This allows automatically setting the `geiser-guile-load-path'
33 ;; variable when using various Guix checkouts (e.g., via git worktrees).
34 (eval . (let ((root-dir-unexpanded (locate-dominating-file
35 default-directory ".dir-locals.el")))
36 ;; While Guix should in theory always have a .dir-locals.el
37 ;; (we are reading this file, after all) there seems to be a
38 ;; strange problem where this code "escapes" to some other buffers,
39 ;; at least vc-mode. See:
40 ;; https://lists.gnu.org/archive/html/guix-devel/2020-11/msg00296.html
41 ;; Upstream report: <https://bugs.gnu.org/44698>
42 ;; Hence the following "when", which might otherwise be unnecessary;
43 ;; it prevents causing an error when root-dir-unexpanded is nil.
44 (when root-dir-unexpanded
45 (let* ((root-dir (expand-file-name root-dir-unexpanded))
46 ;; Workaround for bug https://issues.guix.gnu.org/43818.
47 (root-dir* (directory-file-name root-dir)))
48
49 (unless (boundp 'geiser-guile-load-path)
50 (defvar geiser-guile-load-path '()))
51 (make-local-variable 'geiser-guile-load-path)
52 (require 'cl-lib)
53 (cl-pushnew root-dir* geiser-guile-load-path
54 :test #'string-equal)))))))
55
56 (c-mode . ((c-file-style . "gnu")))
57 (scheme-mode
58 .
59 ((indent-tabs-mode . nil)
60 (eval . (put 'eval-when 'scheme-indent-function 1))
61 (eval . (put 'call-with-prompt 'scheme-indent-function 1))
62 (eval . (put 'test-assert 'scheme-indent-function 1))
63 (eval . (put 'test-assertm 'scheme-indent-function 1))
64 (eval . (put 'test-equalm 'scheme-indent-function 1))
65 (eval . (put 'test-equal 'scheme-indent-function 1))
66 (eval . (put 'test-eq 'scheme-indent-function 1))
67 (eval . (put 'call-with-input-string 'scheme-indent-function 1))
68 (eval . (put 'call-with-port 'scheme-indent-function 1))
69 (eval . (put 'guard 'scheme-indent-function 1))
70 (eval . (put 'lambda* 'scheme-indent-function 1))
71 (eval . (put 'substitute* 'scheme-indent-function 1))
72 (eval . (put 'match-record 'scheme-indent-function 2))
73
74 ;; 'modify-inputs' and its keywords.
75 (eval . (put 'modify-inputs 'scheme-indent-function 1))
76 (eval . (put 'replace 'scheme-indent-function 1))
77
78 ;; 'modify-phases' and its keywords.
79 (eval . (put 'modify-phases 'scheme-indent-function 1))
80 (eval . (put 'replace 'scheme-indent-function 1))
81 (eval . (put 'add-before 'scheme-indent-function 2))
82 (eval . (put 'add-after 'scheme-indent-function 2))
83
84 (eval . (put 'modify-services 'scheme-indent-function 1))
85 (eval . (put 'with-directory-excursion 'scheme-indent-function 1))
86 (eval . (put 'with-file-lock 'scheme-indent-function 1))
87 (eval . (put 'with-file-lock/no-wait 'scheme-indent-function 1))
88 (eval . (put 'with-profile-lock 'scheme-indent-function 1))
89 (eval . (put 'with-writable-file 'scheme-indent-function 2))
90
91 (eval . (put 'package 'scheme-indent-function 0))
92 (eval . (put 'package/inherit 'scheme-indent-function 1))
93 (eval . (put 'origin 'scheme-indent-function 0))
94 (eval . (put 'build-system 'scheme-indent-function 0))
95 (eval . (put 'bag 'scheme-indent-function 0))
96 (eval . (put 'gexp->derivation 'scheme-indent-function 1))
97 (eval . (put 'graft 'scheme-indent-function 0))
98 (eval . (put 'operating-system 'scheme-indent-function 0))
99 (eval . (put 'file-system 'scheme-indent-function 0))
100 (eval . (put 'manifest-entry 'scheme-indent-function 0))
101 (eval . (put 'manifest-pattern 'scheme-indent-function 0))
102 (eval . (put 'substitute-keyword-arguments 'scheme-indent-function 1))
103 (eval . (put 'with-store 'scheme-indent-function 1))
104 (eval . (put 'with-external-store 'scheme-indent-function 1))
105 (eval . (put 'with-error-handling 'scheme-indent-function 0))
106 (eval . (put 'with-mutex 'scheme-indent-function 1))
107 (eval . (put 'with-atomic-file-output 'scheme-indent-function 1))
108 (eval . (put 'call-with-compressed-output-port 'scheme-indent-function 2))
109 (eval . (put 'call-with-decompressed-port 'scheme-indent-function 2))
110 (eval . (put 'call-with-gzip-input-port 'scheme-indent-function 1))
111 (eval . (put 'call-with-gzip-output-port 'scheme-indent-function 1))
112 (eval . (put 'call-with-lzip-input-port 'scheme-indent-function 1))
113 (eval . (put 'call-with-lzip-output-port 'scheme-indent-function 1))
114 (eval . (put 'signature-case 'scheme-indent-function 1))
115 (eval . (put 'emacs-batch-eval 'scheme-indent-function 0))
116 (eval . (put 'emacs-batch-edit-file 'scheme-indent-function 1))
117 (eval . (put 'emacs-substitute-sexps 'scheme-indent-function 1))
118 (eval . (put 'emacs-substitute-variables 'scheme-indent-function 1))
119 (eval . (put 'with-derivation-narinfo 'scheme-indent-function 1))
120 (eval . (put 'with-derivation-substitute 'scheme-indent-function 2))
121 (eval . (put 'with-status-report 'scheme-indent-function 1))
122 (eval . (put 'with-status-verbosity 'scheme-indent-function 1))
123 (eval . (put 'with-build-handler 'scheme-indent-function 1))
124
125 (eval . (put 'mlambda 'scheme-indent-function 1))
126 (eval . (put 'mlambdaq 'scheme-indent-function 1))
127 (eval . (put 'syntax-parameterize 'scheme-indent-function 1))
128 (eval . (put 'with-monad 'scheme-indent-function 1))
129 (eval . (put 'mbegin 'scheme-indent-function 1))
130 (eval . (put 'mwhen 'scheme-indent-function 1))
131 (eval . (put 'munless 'scheme-indent-function 1))
132 (eval . (put 'mlet* 'scheme-indent-function 2))
133 (eval . (put 'mlet 'scheme-indent-function 2))
134 (eval . (put 'mparameterize 'scheme-indent-function 2))
135 (eval . (put 'run-with-store 'scheme-indent-function 1))
136 (eval . (put 'run-with-state 'scheme-indent-function 1))
137 (eval . (put 'wrap-program 'scheme-indent-function 1))
138 (eval . (put 'wrap-script 'scheme-indent-function 1))
139 (eval . (put 'with-imported-modules 'scheme-indent-function 1))
140 (eval . (put 'with-extensions 'scheme-indent-function 1))
141 (eval . (put 'with-parameters 'scheme-indent-function 1))
142 (eval . (put 'let-system 'scheme-indent-function 1))
143 (eval . (put 'with-build-variables 'scheme-indent-function 2))
144
145 (eval . (put 'with-database 'scheme-indent-function 2))
146 (eval . (put 'call-with-database 'scheme-indent-function 1))
147 (eval . (put 'call-with-transaction 'scheme-indent-function 1))
148 (eval . (put 'with-statement 'scheme-indent-function 3))
149 (eval . (put 'call-with-retrying-transaction 'scheme-indent-function 1))
150 (eval . (put 'call-with-savepoint 'scheme-indent-function 1))
151 (eval . (put 'call-with-retrying-savepoint 'scheme-indent-function 1))
152
153 (eval . (put 'call-with-container 'scheme-indent-function 1))
154 (eval . (put 'container-excursion 'scheme-indent-function 1))
155 (eval . (put 'eventually 'scheme-indent-function 1))
156
157 (eval . (put 'call-with-progress-reporter 'scheme-indent-function 1))
158 (eval . (put 'with-repository 'scheme-indent-function 2))
159 (eval . (put 'with-temporary-git-repository 'scheme-indent-function 2))
160 (eval . (put 'with-environment-variables 'scheme-indent-function 1))
161 (eval . (put 'with-fresh-gnupg-setup 'scheme-indent-function 1))
162
163 (eval . (put 'with-paginated-output-port 'scheme-indent-function 1))
164
165 (eval . (put 'with-shepherd-action 'scheme-indent-function 3))
166
167 (eval . (put 'with-http-server 'scheme-indent-function 1))
168
169 ;; This notably allows '(' in Paredit to not insert a space when the
170 ;; preceding symbol is one of these.
171 (eval . (modify-syntax-entry ?~ "'"))
172 (eval . (modify-syntax-entry ?$ "'"))
173 (eval . (modify-syntax-entry ?+ "'"))
174
175 ;; Emacs 28 changed the behavior of 'lisp-fill-paragraph', which causes the
176 ;; first line of package descriptions to extrude past 'fill-column', and
177 ;; somehow that is deemed more correct upstream (see:
178 ;; https://issues.guix.gnu.org/56197).
179 (eval . (progn
180 (require 'lisp-mode)
181 (defun emacs27-lisp-fill-paragraph (&optional justify)
182 (interactive "P")
183 (or (fill-comment-paragraph justify)
184 (let ((paragraph-start
185 (concat paragraph-start
186 "\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)"))
187 (paragraph-separate
188 (concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
189 (fill-column (if (and (integerp emacs-lisp-docstring-fill-column)
190 (derived-mode-p 'emacs-lisp-mode))
191 emacs-lisp-docstring-fill-column
192 fill-column)))
193 (fill-paragraph justify))
194 ;; Never return nil.
195 t))
196 (setq-local fill-paragraph-function #'emacs27-lisp-fill-paragraph)))))
197
198 (emacs-lisp-mode . ((indent-tabs-mode . nil)))
199 (texinfo-mode . ((indent-tabs-mode . nil)
200 (fill-column . 72))))