unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Suggest improve emacs setting in 'The Perfect Setup'
@ 2022-12-30  0:54 Feng Shu
  2022-12-31 23:17 ` Joshua Branson
  2023-01-06 16:07 ` Simon Tournier
  0 siblings, 2 replies; 10+ messages in thread
From: Feng Shu @ 2022-12-30  0:54 UTC (permalink / raw)
  To: guix-devel


Hello:

In 'The Perfect Setup', we suggest user to use the below emacs config:

```
;; Assuming the Guix checkout is in ~/src/guix.
(with-eval-after-load 'geiser-guile
  (add-to-list 'geiser-guile-load-path "~/src/guix"))
```

This config need user to deal with %load-path of guix, which seem to be
a hard job for new guile user for many dirs of guix and other guix channels,
why not suggest new user to use the below config:

```
(setq geiser-guile-binary (list "guix" "repl"))
```

or:

```
(setq geiser-guile-binary (list "guix" "repl" "-L" "/path/to/user-own-config-dir"))
```

when user just want to develop his own guix config, just run:

```
emacs
```

guix and other channels installed by 'guix pull' will be used properly.

when user want to develop in guix.git, he just run emacs like the below:

```
./pre-inst-env emacs
```

The below is my guix emacs config, seem to work:

--------------------------------------------------------------------------------

(require 'geiser)
(require 'geiser-guile)
(require 'guix)
(require 'magit)

;; ** My own guix config.
(defvar eh-geeguix-dir (expand-file-name "~/geeguix"))

;; ** Let geiser-guile use 'guix repl'
(setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))

;; ** guix-devel-mode
(add-hook 'scheme-mode-hook #'guix-devel-mode)

;; ** Get guix dir installed by 'guix pull'.
(defun eh-guix-dir ()
  (file-name-as-directory
   (cl-find-if
    (lambda (dir)
      (file-exists-p (expand-file-name "guix.scm" dir)))
    (directory-files
     (expand-file-name "~/.cache/guix/checkouts/")
     t))))

;; ** copyright-update
(when (eh-guix-dir)
  (let* ((dir (eh-guix-dir))
         (file (expand-file-name "etc/copyright.el" dir)))
    (when (file-exists-p file)
      (load-file file)
      ;; (add-hook 'after-save-hook 'copyright-update)
      (setq copyright-names-regexp
            (format "%s <%s>" user-full-name user-mail-address)))))

;; ** tempel 
(when (eh-guix-dir)
  (let* ((dir (eh-guix-dir))
         (path (expand-file-name "etc/snippets/tempel/*" dir)))
    (add-to-list 'tempel-path path)))



-- 



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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2022-12-30  0:54 Suggest improve emacs setting in 'The Perfect Setup' Feng Shu
@ 2022-12-31 23:17 ` Joshua Branson
  2023-01-01 19:53   ` Feng Shu
                     ` (2 more replies)
  2023-01-06 16:07 ` Simon Tournier
  1 sibling, 3 replies; 10+ messages in thread
From: Joshua Branson @ 2022-12-31 23:17 UTC (permalink / raw)
  To: Feng Shu; +Cc: guix-devel

Feng Shu <tumashu@163.com> writes:

> Hello:
>
> In 'The Perfect Setup', we suggest user to use the below emacs config:
>
> ```
> ;; Assuming the Guix checkout is in ~/src/guix.
> (with-eval-after-load 'geiser-guile
>   (add-to-list 'geiser-guile-load-path "~/src/guix"))
> ```
>
> This config need user to deal with %load-path of guix, which seem to be
> a hard job for new guile user for many dirs of guix and other guix channels,
> why not suggest new user to use the below config:
>

How about you go ahead and make a patch on guix-patches@gnu.org, that
way this issue is not forgotten?

>
> ```
> (setq geiser-guile-binary (list "guix" "repl"))
> ```
>
>
> or:
>
> ```
> (setq geiser-guile-binary (list "guix" "repl" "-L" "/path/to/user-own-config-dir"))
> ```
>
> when user just want to develop his own guix config, just run:
>
> ```
> emacs
> ```
>
> guix and other channels installed by 'guix pull' will be used properly.
>
> when user want to develop in guix.git, he just run emacs like the below:
>
> ```
> ./pre-inst-env emacs
> ```
>
> The below is my guix emacs config, seem to work:
>
> --------------------------------------------------------------------------------
>
> (require 'geiser)
> (require 'geiser-guile)
> (require 'guix)
> (require 'magit)
>
> ;; ** My own guix config.
> (defvar eh-geeguix-dir (expand-file-name "~/geeguix"))
>
> ;; ** Let geiser-guile use 'guix repl'
> (setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))
>
> ;; ** guix-devel-mode
> (add-hook 'scheme-mode-hook #'guix-devel-mode)
>
> ;; ** Get guix dir installed by 'guix pull'.
> (defun eh-guix-dir ()
>   (file-name-as-directory
>    (cl-find-if
>     (lambda (dir)
>       (file-exists-p (expand-file-name "guix.scm" dir)))
>     (directory-files
>      (expand-file-name "~/.cache/guix/checkouts/")
>      t))))
>
> ;; ** copyright-update
> (when (eh-guix-dir)
>   (let* ((dir (eh-guix-dir))
>          (file (expand-file-name "etc/copyright.el" dir)))
>     (when (file-exists-p file)
>       (load-file file)
>       ;; (add-hook 'after-save-hook 'copyright-update)
>       (setq copyright-names-regexp
>             (format "%s <%s>" user-full-name user-mail-address)))))
>
> ;; ** tempel
> (when (eh-guix-dir)
>   (let* ((dir (eh-guix-dir))
>          (path (expand-file-name "etc/snippets/tempel/*" dir)))
>     (add-to-list 'tempel-path path)))

I would also add:

(add-hook! 'scheme-mode-hook #'display-fill-column-indicator-mode)

This creates a vertical line that reminds you that your code should fit
inside 80 columns.

Possible also mention how to set up page break lines:

https://github.com/purcell/page-break-lines


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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2022-12-31 23:17 ` Joshua Branson
@ 2023-01-01 19:53   ` Feng Shu
  2023-01-01 20:35   ` jbranso
  2023-06-08 22:08   ` Mekeor Melire
  2 siblings, 0 replies; 10+ messages in thread
From: Feng Shu @ 2023-01-01 19:53 UTC (permalink / raw)
  To: Joshua Branson; +Cc: guix-devel

Joshua Branson <jbranso@dismail.de> writes:

> Feng Shu <tumashu@163.com> writes:
>
>> Hello:
>>
>> In 'The Perfect Setup', we suggest user to use the below emacs config:
>>
>> ```
>> ;; Assuming the Guix checkout is in ~/src/guix.
>> (with-eval-after-load 'geiser-guile
>>   (add-to-list 'geiser-guile-load-path "~/src/guix"))
>> ```
>>
>> This config need user to deal with %load-path of guix, which seem to be
>> a hard job for new guile user for many dirs of guix and other guix channels,
>> why not suggest new user to use the below config:
>>
>
> How about you go ahead and make a patch on guix-patches@gnu.org, that
> way this issue is not forgotten?

Maybe we can add an example emacs config for develop guix in etc directory.

>
>>
>> ```
>> (setq geiser-guile-binary (list "guix" "repl"))
>> ```
>>
>>
>> or:
>>
>> ```
>> (setq geiser-guile-binary (list "guix" "repl" "-L" "/path/to/user-own-config-dir"))
>> ```
>>
>> when user just want to develop his own guix config, just run:
>>
>> ```
>> emacs
>> ```
>>
>> guix and other channels installed by 'guix pull' will be used properly.
>>
>> when user want to develop in guix.git, he just run emacs like the below:
>>
>> ```
>> ./pre-inst-env emacs
>> ```
>>
>> The below is my guix emacs config, seem to work:
>>
>> --------------------------------------------------------------------------------
>>
>> (require 'geiser)
>> (require 'geiser-guile)
>> (require 'guix)
>> (require 'magit)
>>
>> ;; ** My own guix config.
>> (defvar eh-geeguix-dir (expand-file-name "~/geeguix"))
>>
>> ;; ** Let geiser-guile use 'guix repl'
>> (setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))
>>
>> ;; ** guix-devel-mode
>> (add-hook 'scheme-mode-hook #'guix-devel-mode)
>>
>> ;; ** Get guix dir installed by 'guix pull'.
>> (defun eh-guix-dir ()
>>   (file-name-as-directory
>>    (cl-find-if
>>     (lambda (dir)
>>       (file-exists-p (expand-file-name "guix.scm" dir)))
>>     (directory-files
>>      (expand-file-name "~/.cache/guix/checkouts/")
>>      t))))
>>
>> ;; ** copyright-update
>> (when (eh-guix-dir)
>>   (let* ((dir (eh-guix-dir))
>>          (file (expand-file-name "etc/copyright.el" dir)))
>>     (when (file-exists-p file)
>>       (load-file file)
>>       ;; (add-hook 'after-save-hook 'copyright-update)
>>       (setq copyright-names-regexp
>>             (format "%s <%s>" user-full-name user-mail-address)))))
>>
>> ;; ** tempel
>> (when (eh-guix-dir)
>>   (let* ((dir (eh-guix-dir))
>>          (path (expand-file-name "etc/snippets/tempel/*" dir)))
>>     (add-to-list 'tempel-path path)))
>
> I would also add:
>
> (add-hook! 'scheme-mode-hook #'display-fill-column-indicator-mode)
>
> This creates a vertical line that reminds you that your code should fit
> inside 80 columns.
>
> Possible also mention how to set up page break lines:
>
> https://github.com/purcell/page-break-lines

-- 



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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2022-12-31 23:17 ` Joshua Branson
  2023-01-01 19:53   ` Feng Shu
@ 2023-01-01 20:35   ` jbranso
  2023-01-01 21:05     ` Feng Shu
  2023-01-02 21:36     ` jbranso
  2023-06-08 22:08   ` Mekeor Melire
  2 siblings, 2 replies; 10+ messages in thread
From: jbranso @ 2023-01-01 20:35 UTC (permalink / raw)
  To: Feng Shu; +Cc: guix-devel

January 1, 2023 2:54 PM, "Feng Shu" <tumashu@163.com> wrote:

> Joshua Branson <jbranso@dismail.de> writes:
> 
>> Feng Shu <tumashu@163.com> writes:
>> 
>>> Hello:
>>> 
>>> In 'The Perfect Setup', we suggest user to use the below emacs config:
>>> 
>>> ```
>>> ;; Assuming the Guix checkout is in ~/src/guix.
>>> (with-eval-after-load 'geiser-guile
>>> (add-to-list 'geiser-guile-load-path "~/src/guix"))
>>> ```
>>> 
>>> This config need user to deal with %load-path of guix, which seem to be
>>> a hard job for new guile user for many dirs of guix and other guix channels,
>>> why not suggest new user to use the below config:
>> 
>> How about you go ahead and make a patch on guix-patches@gnu.org, that
>> way this issue is not forgotten?
> 
> Maybe we can add an example emacs config for develop guix in etc directory.

That's a good idea!  I think there is/was a guix developer trying to write an
emacs configuration specifically to hack on guix...

> 
>>> ```
>>> (setq geiser-guile-binary (list "guix" "repl"))
>>> ```
>>> 
>>> or:
>>> 
>>> ```
>>> (setq geiser-guile-binary (list "guix" "repl" "-L" "/path/to/user-own-config-dir"))
>>> ```
>>> 
>>> when user just want to develop his own guix config, just run:
>>> 
>>> ```
>>> emacs
>>> ```
>>> 
>>> guix and other channels installed by 'guix pull' will be used properly.
>>> 
>>> when user want to develop in guix.git, he just run emacs like the below:
>>> 
>>> ```
>>> ./pre-inst-env emacs
>>> ```
>>> 
>>> The below is my guix emacs config, seem to work:
>>> 
>>> --------------------------------------------------------------------------------
>>> 
>>> (require 'geiser)
>>> (require 'geiser-guile)
>>> (require 'guix)
>>> (require 'magit)
>>> 
>>> ;; ** My own guix config.
>>> (defvar eh-geeguix-dir (expand-file-name "~/geeguix"))
>>> 
>>> ;; ** Let geiser-guile use 'guix repl'
>>> (setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))
>>> 
>>> ;; ** guix-devel-mode
>>> (add-hook 'scheme-mode-hook #'guix-devel-mode)
>>> 
>>> ;; ** Get guix dir installed by 'guix pull'.
>>> (defun eh-guix-dir ()
>>> (file-name-as-directory
>>> (cl-find-if
>>> (lambda (dir)
>>> (file-exists-p (expand-file-name "guix.scm" dir)))
>>> (directory-files
>>> (expand-file-name "~/.cache/guix/checkouts/")
>>> t))))
>>> 
>>> ;; ** copyright-update
>>> (when (eh-guix-dir)
>>> (let* ((dir (eh-guix-dir))
>>> (file (expand-file-name "etc/copyright.el" dir)))
>>> (when (file-exists-p file)
>>> (load-file file)
>>> ;; (add-hook 'after-save-hook 'copyright-update)
>>> (setq copyright-names-regexp
>>> (format "%s <%s>" user-full-name user-mail-address)))))
>>> 
>>> ;; ** tempel
>>> (when (eh-guix-dir)
>>> (let* ((dir (eh-guix-dir))
>>> (path (expand-file-name "etc/snippets/tempel/*" dir)))
>>> (add-to-list 'tempel-path path)))
>> 
>> I would also add:
>> 
>> (add-hook! 'scheme-mode-hook #'display-fill-column-indicator-mode)
>> 
>> This creates a vertical line that reminds you that your code should fit
>> inside 80 columns.
>> 
>> Possible also mention how to set up page break lines:
>> 
>> https://github.com/purcell/page-break-lines
> 
> --


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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2023-01-01 20:35   ` jbranso
@ 2023-01-01 21:05     ` Feng Shu
  2023-01-02 21:36     ` jbranso
  1 sibling, 0 replies; 10+ messages in thread
From: Feng Shu @ 2023-01-01 21:05 UTC (permalink / raw)
  To: jbranso; +Cc: guix-devel

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

jbranso@dismail.de writes:


> That's a good idea!  I think there is/was a guix developer trying to write an
> emacs configuration specifically to hack on guix...

The below is my current guix emacs config, I do not know whether it is
suitable for an example, maybe someone can try it :-)

If suitable, I will try to send a patch.


[-- Attachment #2: eh-guix.el --]
[-- Type: application/emacs-lisp, Size: 5127 bytes --]

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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2023-01-01 20:35   ` jbranso
  2023-01-01 21:05     ` Feng Shu
@ 2023-01-02 21:36     ` jbranso
  2023-01-03  1:18       ` Feng Shu
  1 sibling, 1 reply; 10+ messages in thread
From: jbranso @ 2023-01-02 21:36 UTC (permalink / raw)
  To: Feng Shu; +Cc: guix-devel

January 1, 2023 4:06 PM, "Feng Shu" <tumashu@163.com> wrote:

> jbranso@dismail.de writes:
> 
>> That's a good idea! I think there is/was a guix developer trying to write an
>> emacs configuration specifically to hack on guix...
> 
> The below is my current guix emacs config, I do not know whether it is
> suitable for an example, maybe someone can try it :-)
> 
> If suitable, I will try to send a patch.

I would go ahead and send a patch to guix-patches.  It might be a good idea to 
review someone else' patch.  Guix is in need of patch reviewers.  :)

I should probably take my own advice and review someone else's patch too.  :)

Joshua


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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2023-01-02 21:36     ` jbranso
@ 2023-01-03  1:18       ` Feng Shu
  0 siblings, 0 replies; 10+ messages in thread
From: Feng Shu @ 2023-01-03  1:18 UTC (permalink / raw)
  To: jbranso; +Cc: guix-devel

jbranso@dismail.de writes:

> January 1, 2023 4:06 PM, "Feng Shu" <tumashu@163.com> wrote:
>
>> jbranso@dismail.de writes:
>> 
>>> That's a good idea! I think there is/was a guix developer trying to write an
>>> emacs configuration specifically to hack on guix...
>> 
>> The below is my current guix emacs config, I do not know whether it is
>> suitable for an example, maybe someone can try it :-)
>> 
>> If suitable, I will try to send a patch.
>
> I would go ahead and send a patch to guix-patches.  It might be a good idea to 
> review someone else' patch.  Guix is in need of patch reviewers.  :)

Good news.

>
> I should probably take my own advice and review someone else's patch too.  :)
>
> Joshua


-- 



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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2022-12-30  0:54 Suggest improve emacs setting in 'The Perfect Setup' Feng Shu
  2022-12-31 23:17 ` Joshua Branson
@ 2023-01-06 16:07 ` Simon Tournier
  2023-01-07 22:43   ` Feng Shu
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Tournier @ 2023-01-06 16:07 UTC (permalink / raw)
  To: Feng Shu, guix-devel

Hi,

Thanks for sharing.  Interesting to see other config.


On Fri, 30 Dec 2022 at 08:54, Feng Shu <tumashu@163.com> wrote:

> ;; ** Let geiser-guile use 'guix repl'
> (setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))

Be careful, this can bite you. :-)  Guile is run with --no-auto-compile
so the debugger is probably not working as expected.  See [1,2].

1: https://yhetil.org/guix/86o7ss1u49.fsf@gmail.com
2: https://yhetil.org/guix/87lenve3t2.fsf@gnu.org


> ;; ** Get guix dir installed by 'guix pull'.
> (defun eh-guix-dir ()
>   (file-name-as-directory
>    (cl-find-if
>     (lambda (dir)
>       (file-exists-p (expand-file-name "guix.scm" dir)))
>     (directory-files
>      (expand-file-name "~/.cache/guix/checkouts/")
>      t))))

Well, I do not know what you do with this but if you manually write in
this directory, then “guix pull” could be then broken.


Cheers,
simon


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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2023-01-06 16:07 ` Simon Tournier
@ 2023-01-07 22:43   ` Feng Shu
  0 siblings, 0 replies; 10+ messages in thread
From: Feng Shu @ 2023-01-07 22:43 UTC (permalink / raw)
  To: Simon Tournier; +Cc: guix-devel

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi,
>
> Thanks for sharing.  Interesting to see other config.
>
>
> On Fri, 30 Dec 2022 at 08:54, Feng Shu <tumashu@163.com> wrote:
>
>> ;; ** Let geiser-guile use 'guix repl'
>> (setq geiser-guile-binary (list "guix" "repl" "-L" eh-geeguix-dir))
>
> Be careful, this can bite you. :-)  Guile is run with --no-auto-compile
> so the debugger is probably not working as expected.  See [1,2].
>
> 1: https://yhetil.org/guix/86o7ss1u49.fsf@gmail.com2: https://yhetil.org/guix/87lenve3t2.fsf@gnu.org
>
>
>> ;; ** Get guix dir installed by 'guix pull'.
>> (defun eh-guix-dir ()
>>   (file-name-as-directory
>>    (cl-find-if
>>     (lambda (dir)
>>       (file-exists-p (expand-file-name "guix.scm" dir)))
>>     (directory-files
>>      (expand-file-name "~/.cache/guix/checkouts/")
>>      t))))
>
> Well, I do not know what you do with this but if you manually write in
> this directory, then “guix pull” could be then broken.

I just read tempel templates and copyright.el from this directory.
maybe I should read them from another dir, but I do not know where,

in "~/.config/guix/current/share" seem can not find them.

>
>
> Cheers,
> simon

-- 



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

* Re: Suggest improve emacs setting in 'The Perfect Setup'
  2022-12-31 23:17 ` Joshua Branson
  2023-01-01 19:53   ` Feng Shu
  2023-01-01 20:35   ` jbranso
@ 2023-06-08 22:08   ` Mekeor Melire
  2 siblings, 0 replies; 10+ messages in thread
From: Mekeor Melire @ 2023-06-08 22:08 UTC (permalink / raw)
  To: Joshua Branson; +Cc: Feng Shu, guix-devel

2022-12-31 18:17 jbranso@dismail.de:

> Possible also mention how to set up page break lines: 
> https://github.com/purcell/page-break-lines

By the way, another good alternative to that Emacs package is: 
https://depp.brause.cc/form-feed/

But I don't think that either of these packages should be 
mentioned in The Perfect Setup. They don't relate to Guix 
specifically.


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

end of thread, other threads:[~2023-06-08 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30  0:54 Suggest improve emacs setting in 'The Perfect Setup' Feng Shu
2022-12-31 23:17 ` Joshua Branson
2023-01-01 19:53   ` Feng Shu
2023-01-01 20:35   ` jbranso
2023-01-01 21:05     ` Feng Shu
2023-01-02 21:36     ` jbranso
2023-01-03  1:18       ` Feng Shu
2023-06-08 22:08   ` Mekeor Melire
2023-01-06 16:07 ` Simon Tournier
2023-01-07 22:43   ` Feng Shu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).