* [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets.
@ 2022-08-03 14:51 Andrew Tropin
2022-08-10 20:26 ` Maxim Cournoyer
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Tropin @ 2022-08-03 14:51 UTC (permalink / raw)
To: 56955
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
* .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)))
;; Geiser
;; This allows automatically setting the `geiser-guile-load-path'
--
2.37.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets.
2022-08-03 14:51 [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets Andrew Tropin
@ 2022-08-10 20:26 ` Maxim Cournoyer
2022-08-17 5:11 ` Andrew Tropin
0 siblings, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2022-08-10 20:26 UTC (permalink / raw)
To: Andrew Tropin; +Cc: 56955
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets.
2022-08-10 20:26 ` Maxim Cournoyer
@ 2022-08-17 5:11 ` Andrew Tropin
2022-09-01 21:18 ` Maxim Cournoyer
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Tropin @ 2022-08-17 5:11 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 56955
[-- Attachment #1.1: Type: text/plain, Size: 1368 bytes --]
On 2022-08-10 16:26, Maxim Cournoyer wrote:
> 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.
That's right, attaching v2 with the fix.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: v2-0001-.dir-locals.el-Add-guix-yasnippets.patch --]
[-- Type: text/x-patch, Size: 1294 bytes --]
From 43ab1f3da75cd8bb719b664c42f23f053b3fbb69 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Wed, 3 Aug 2022 17:51:48 +0300
Subject: [PATCH v2] .dir-locals.el: Add guix yasnippets.
* .dir-locals.el (eval): Add guix yasnippets.
---
.dir-locals.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/.dir-locals.el b/.dir-locals.el
index e4c1da8026..6fa0ec8bc6 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -14,6 +14,17 @@
(eval . (setq-local guix-directory
(locate-dominating-file default-directory
".dir-locals.el")))
+ ;; YASnippet
+ (eval . (with-eval-after-load
+ 'yasnippet
+ (let ((guix-yasnippets
+ (expand-file-name
+ "etc/snippets"
+ (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)))))
;; Geiser
;; This allows automatically setting the `geiser-guile-load-path'
--
2.37.1
[-- Attachment #1.3: Type: text/plain, Size: 37 bytes --]
--
Best regards,
Andrew Tropin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets.
2022-08-17 5:11 ` Andrew Tropin
@ 2022-09-01 21:18 ` Maxim Cournoyer
0 siblings, 0 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2022-09-01 21:18 UTC (permalink / raw)
To: Andrew Tropin; +Cc: 56955
Hi Andrew,
[...]
>> Perhaps what it could do is check if the yas-snippet-dirs already has
>> the guix snippets directory, and do nothing if it does.
>
> That's right, attaching v2 with the fix.
>
> From 43ab1f3da75cd8bb719b664c42f23f053b3fbb69 Mon Sep 17 00:00:00 2001
> From: Andrew Tropin <andrew@trop.in>
> Date: Wed, 3 Aug 2022 17:51:48 +0300
> Subject: [PATCH v2] .dir-locals.el: Add guix yasnippets.
>
> * .dir-locals.el (eval): Add guix yasnippets.
> ---
> .dir-locals.el | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index e4c1da8026..6fa0ec8bc6 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -14,6 +14,17 @@
> (eval . (setq-local guix-directory
> (locate-dominating-file default-directory
> ".dir-locals.el")))
> + ;; YASnippet
> + (eval . (with-eval-after-load
> + 'yasnippet
> + (let ((guix-yasnippets
> + (expand-file-name
> + "etc/snippets"
> + (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)))))
Sorry for failing to produce a reply earlier: the above LGTM!
Another small step toward a zero-config Emacs setup for hacking on Guix
:-).
Feel free to push!
Thanks,
Maxim
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-01 21:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 14:51 [bug#56955] [PATCH] .dir-locals.el: Add guix yasnippets Andrew Tropin
2022-08-10 20:26 ` Maxim Cournoyer
2022-08-17 5:11 ` Andrew Tropin
2022-09-01 21:18 ` Maxim Cournoyer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.