unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Enable guix-devel-mode only in guix source files
@ 2018-08-17 16:14 Arun Isaac
  2018-08-17 16:44 ` Pierre Neidhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2018-08-17 16:14 UTC (permalink / raw)
  To: help-guix


How do I enable guix-devel-mode only in guix source files? The suggested
method in the manual (shown below) enables guix-devel-mode in all
scheme-mode buffers.

(add-hook 'scheme-mode-hook 'guix-devel-mode)

I know I can write some elisp to find the buffer-file-name, find if it
is in my guix source folder and enable or not enable guix-devel-mode
accordingly. But, I am wondering whether there is any easier way. What
do people here normally do?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-17 16:14 Enable guix-devel-mode only in guix source files Arun Isaac
@ 2018-08-17 16:44 ` Pierre Neidhardt
  2018-08-17 19:46   ` Alex Kost
  0 siblings, 1 reply; 11+ messages in thread
From: Pierre Neidhardt @ 2018-08-17 16:44 UTC (permalink / raw)
  To: Arun Isaac; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

I do exactly what you suggested:

--8<---------------cut here---------------start------------->8---
(defun ambrevar/init-guix ()
  (and buffer-file-name
       (string-match "\\<guix\\>" buffer-file-name) ; Adapt this to your install.
       (guix-devel-mode)))
(add-hook 'scheme-mode-hook 'ambrevar/init-guix)
--8<---------------cut here---------------end--------------->8---

A better approach might be to add it to .dir-locals.el upstream.  What do you
people think?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-17 16:44 ` Pierre Neidhardt
@ 2018-08-17 19:46   ` Alex Kost
  2018-08-19 18:08     ` Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2018-08-17 19:46 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt (2018-08-17 18:44 +0200) wrote:

> I do exactly what you suggested:
>
> (defun ambrevar/init-guix ()
>   (and buffer-file-name
>        (string-match "\\<guix\\>" buffer-file-name) ; Adapt this to your install.
>        (guix-devel-mode)))
> (add-hook 'scheme-mode-hook 'ambrevar/init-guix)
>
> A better approach might be to add it to .dir-locals.el upstream.  What do you
> people think?

I think the less is added to "dir-locals" the better.  Especially, there
shouldn't be any functions there in my opinion.

-- 
Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-17 19:46   ` Alex Kost
@ 2018-08-19 18:08     ` Arun Isaac
  2018-08-20 19:57       ` Alex Kost
  0 siblings, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2018-08-19 18:08 UTC (permalink / raw)
  To: Alex Kost, Pierre Neidhardt; +Cc: help-guix


>> A better approach might be to add it to .dir-locals.el upstream.  What do you
>> people think?
>
> I think the less is added to "dir-locals" the better.  Especially, there
> shouldn't be any functions there in my opinion.

Thanks, Alex and Pierre, for your replies. But, why is adding to
dir-locals not a good idea?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-19 18:08     ` Arun Isaac
@ 2018-08-20 19:57       ` Alex Kost
  2018-08-20 22:18         ` Pierre Neidhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2018-08-20 19:57 UTC (permalink / raw)
  To: Arun Isaac; +Cc: help-guix

Arun Isaac (2018-08-19 23:38 +0530) wrote:

>>> A better approach might be to add it to .dir-locals.el upstream.  What do you
>>> people think?
>>
>> I think the less is added to "dir-locals" the better.  Especially, there
>> shouldn't be any functions there in my opinion.
>
> Thanks, Alex and Pierre, for your replies. But, why is adding to
> dir-locals not a good idea?

It's not a good idea only in my opinion :-)

I personally don't like when someone decides what settings I should use
so much, that I disable all these dir-locals stuff completely (using
'enable-dir-local-variables' variable).

But if I understood this situation correctly, Pierre suggested to:

- add a function to the Guix ".dir-locals.el" (does dir-locals support
  functions at all?)

- the function to set up a third-party package (Emacs-Guix)!  Why Guix
  should do it?

Both these points doesn't look right to me.

-- 
Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-20 19:57       ` Alex Kost
@ 2018-08-20 22:18         ` Pierre Neidhardt
  2018-08-21 15:15           ` Alex Kost
  0 siblings, 1 reply; 11+ messages in thread
From: Pierre Neidhardt @ 2018-08-20 22:18 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]


> - add a function to the Guix ".dir-locals.el" (does dir-locals support
>   functions at all?)

I haven't tested, but currently .dir-locals.el contains

--8<---------------cut here---------------start------------->8---
 (scheme-mode
  .
  (indent-tabs-mode . nil)
--8<---------------cut here---------------end--------------->8---

I suppose we can add

--8<---------------cut here---------------start------------->8---
 (scheme-mode
  .
  (indent-tabs-mode . nil)
  (guix-devel-mode . t)
--8<---------------cut here---------------end--------------->8---

> - the function to set up a third-party package (Emacs-Guix)!  Why Guix
>   should do it?

Sorry, what do you mean?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-20 22:18         ` Pierre Neidhardt
@ 2018-08-21 15:15           ` Alex Kost
  2018-08-21 15:23             ` Pierre Neidhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2018-08-21 15:15 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt (2018-08-21 00:18 +0200) wrote:

>> - add a function to the Guix ".dir-locals.el" (does dir-locals support
>>   functions at all?)
>
> I haven't tested, but currently .dir-locals.el contains
>
>  (scheme-mode
>   .
>   (indent-tabs-mode . nil)
>
> I suppose we can add
>
>  (scheme-mode
>   .
>   (indent-tabs-mode . nil)
>   (guix-devel-mode . t)

Ah, that's what you meant.  I think this is horrible :-)

>> - the function to set up a third-party package (Emacs-Guix)!  Why Guix
>>   should do it?
>
> Sorry, what do you mean?

Guix and Emacs-Guix are separate projects.  And a user is not forced to
use Emacs-Guix, so calling 'guix-devel-mode' will simply fail if
Emacs-Guix is not installed.  So I think this addition to dir-locals
would be a bad decision.

-- 
Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-21 15:15           ` Alex Kost
@ 2018-08-21 15:23             ` Pierre Neidhardt
  2018-08-21 17:12               ` Oleg Pykhalov
  2018-08-22  8:06               ` Alex Kost
  0 siblings, 2 replies; 11+ messages in thread
From: Pierre Neidhardt @ 2018-08-21 15:23 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]


> Ah, that's what you meant.  I think this is horrible :-)

Why?

> And a user is not forced to use Emacs-Guix, so calling 'guix-devel-mode' will
> simply fail if Emacs-Guix is not installed.

I don't know the innards of .dir-locals.el, but if we can somehow check if the
mode is defined, that would solve this issue.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-21 15:23             ` Pierre Neidhardt
@ 2018-08-21 17:12               ` Oleg Pykhalov
  2018-08-22  8:06               ` Alex Kost
  1 sibling, 0 replies; 11+ messages in thread
From: Oleg Pykhalov @ 2018-08-21 17:12 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Alex Kost, help-guix

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Hello.

Pierre Neidhardt <ambrevar@gmail.com> writes:

[…]

>> And a user is not forced to use Emacs-Guix, so calling 'guix-devel-mode' will
>> simply fail if Emacs-Guix is not installed.
>
> I don't know the innards of .dir-locals.el, but if we can somehow check if the
> mode is defined, that would solve this issue.

I think we should the procedure in Emacs-Guix documentation instead of
.dir-locals.el file, because it will be hard for a user to get rid of
unnecessary for Guix project procedure inside .dir-locals.el.

Regards,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-21 15:23             ` Pierre Neidhardt
  2018-08-21 17:12               ` Oleg Pykhalov
@ 2018-08-22  8:06               ` Alex Kost
  2018-08-24 22:30                 ` Ludovic Courtès
  1 sibling, 1 reply; 11+ messages in thread
From: Alex Kost @ 2018-08-22  8:06 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt (2018-08-21 17:23 +0200) wrote:

>> Ah, that's what you meant.  I think this is horrible :-)
>
> Why?

As I explained, configuring third-party packages in dir-locals does not
look right to me.  It may lead to problems if you remember:

  http://lists.gnu.org/archive/html/guix-devel/2018-05/msg00231.html

And in general, I don't like when developers make default settings that
are hard to "fix".  What if I don't want to use 'guix-devel-mode' at
all?  Why do you force me to use it?

That's why I disabled all these dir-locals in my emacs config:
developers often put to ".dir-locals.el" their personal settings.  I
just can't stand it.

-- 
Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Enable guix-devel-mode only in guix source files
  2018-08-22  8:06               ` Alex Kost
@ 2018-08-24 22:30                 ` Ludovic Courtès
  0 siblings, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2018-08-24 22:30 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

Hello,

Alex Kost <alezost@gmail.com> skribis:

> And in general, I don't like when developers make default settings that
> are hard to "fix".  What if I don't want to use 'guix-devel-mode' at
> all?  Why do you force me to use it?
>
> That's why I disabled all these dir-locals in my emacs config:
> developers often put to ".dir-locals.el" their personal settings.  I
> just can't stand it.

I view .dir-locals as a simple way to share project-wide settings among
developers, for settings that implement conventions that the project
follows.

I was thinking of it as something to help developers get started (as in:
the editor will follow some conventions without you having to worry too
much about it), but I also understand and respect the desire to not be
“forced” and to remain in control.

Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-08-24 22:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 16:14 Enable guix-devel-mode only in guix source files Arun Isaac
2018-08-17 16:44 ` Pierre Neidhardt
2018-08-17 19:46   ` Alex Kost
2018-08-19 18:08     ` Arun Isaac
2018-08-20 19:57       ` Alex Kost
2018-08-20 22:18         ` Pierre Neidhardt
2018-08-21 15:15           ` Alex Kost
2018-08-21 15:23             ` Pierre Neidhardt
2018-08-21 17:12               ` Oleg Pykhalov
2018-08-22  8:06               ` Alex Kost
2018-08-24 22:30                 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).