.dir-locals.el 10 KB

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