diff mbox series

[bug#56955] .dir-locals.el: Add guix yasnippets.

Message ID 877d3pid5m.fsf@trop.in
State New
Headers show
Series [bug#56955] .dir-locals.el: Add guix yasnippets. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Andrew Tropin Aug. 3, 2022, 2:51 p.m. UTC
* .dir-locals.el (eval): Add guix yasnippets.
---
 .dir-locals.el | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Maxim Cournoyer Aug. 10, 2022, 8:26 p.m. UTC | #1
Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

> * .dir-locals.el (eval): Add guix yasnippets.
> ---
>  .dir-locals.el | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index e4c1da8026..ecaec8de87 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -14,6 +14,15 @@
>       (eval . (setq-local guix-directory
>                           (locate-dominating-file default-directory
>                                                   ".dir-locals.el")))
> +     ;; YASnippet
> +     (eval . (with-eval-after-load
> +                 'yasnippet
> +               (add-to-list 'yas-snippet-dirs
> +                            (expand-file-name
> +                             "etc/snippets"
> +                             (locate-dominating-file default-directory
> +                                                     ".dir-locals.el")))
> +               (yas-reload-all)))

That's an interesting idea, but wouldn't the `yas-reload-all` be
triggered for every module visited?  That may take some time if a user
has lots of snippets in their collection.

Perhaps what it could do is check if the yas-snippet-dirs already has
the guix snippets directory, and do nothing if it does.

Thanks,

Maxim
diff mbox series

Patch

diff --git a/.dir-locals.el b/.dir-locals.el
index e4c1da8026..ecaec8de87 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -14,6 +14,15 @@ 
      (eval . (setq-local guix-directory
                          (locate-dominating-file default-directory
                                                  ".dir-locals.el")))
+     ;; YASnippet
+     (eval . (with-eval-after-load
+                 'yasnippet
+               (add-to-list 'yas-snippet-dirs
+                            (expand-file-name
+                             "etc/snippets"
+                             (locate-dominating-file default-directory
+                                                     ".dir-locals.el")))
+               (yas-reload-all)))
 
      ;; Geiser
      ;; This allows automatically setting the `geiser-guile-load-path'