From 5dd68588ba29895d8d4c70b92aa1cbc45c05b2a1 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Mon, 9 Jan 2023 23:28:29 +0100 Subject: Mark Guix-related eval forms as safe --- tw/home/files/emacs-init.el | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'tw/home/files/emacs-init.el') diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el index dd9c073a..0bea0e57 100644 --- a/tw/home/files/emacs-init.el +++ b/tw/home/files/emacs-init.el @@ -563,4 +563,51 @@ (kbd "el") #'eval-last-sexp (kbd "ep") #'eval-print-last-sexp) +;; Guix-related .dir-locals.el entries. These are fine; don't prompt every time. +(mapc (apply-partially #'add-to-list 'safe-local-eval-forms) + '((modify-syntax-entry 126 "'") + (modify-syntax-entry 36 "'") + (modify-syntax-entry 43 "'") + (progn + (require 'lisp-mode) + (defun emacs27-lisp-fill-paragraph (&optional justify) + (interactive "P") + (or (fill-comment-paragraph justify) + (let ((paragraph-start + (concat paragraph-start "\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)")) + (paragraph-separate + (concat paragraph-separate "\\|\\s-*\".*[,\\.]$")) + (fill-column + (if (and (integerp emacs-lisp-docstring-fill-column) + (derived-mode-p 'emacs-lisp-mode)) + emacs-lisp-docstring-fill-column + fill-column))) + (fill-paragraph justify)) + t)) + (setq-local fill-paragraph-function #'emacs27-lisp-fill-paragraph)) + + ;; Forms used by Guix upstream. + (add-to-list 'completion-ignored-extensions ".go") + (setq-local guix-directory (locate-dominating-file + default-directory ".dir-locals.el")) + (with-eval-after-load 'yasnippet + (let ((guix-yasnippets (expand-file-name + "etc/snippets/yas" + (locate-dominating-file + default-directory ".dir-locals.el")))) + (unless (member guix-yasnippets yas-snippet-dirs) + (add-to-list 'yas-snippet-dirs guix-yasnippets) + (yas-reload-all)))) + (let ((root-dir-unexpanded (locate-dominating-file + default-directory ".dir-locals.el"))) + (when root-dir-unexpanded + (let* ((root-dir (expand-file-name root-dir-unexpanded)) + (root-dir* (directory-file-name root-dir))) + (unless (boundp 'geiser-guile-load-path) + (defvar geiser-guile-load-path 'nil)) + (make-local-variable 'geiser-guile-load-path) + (require 'cl-lib) + (cl-pushnew root-dir* geiser-guile-load-path + :test #'string-equal)))))) + ;;; init.el ends here -- cgit v1.2.3