guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#58652] Creating home-emacs-service-type


From: Zain Jabbar
Subject: [bug#58652] Creating home-emacs-service-type
Date: Thu, 20 Oct 2022 11:30:36 -1000

Aloha All,

Thank you for your input.

> Note that you reverted the patch direction.

Please forgive me for that. Is it possible to explain what I did
wrong? I will outline my steps to help you figure out what I did
incorrectly.

1. I cloned the repo
2. Used =guix shell -D guix=
3. Ran =./bootstrap=
4. Ran =./configure --localstatedir=/var=
5. Ran =make && make check=. By the way, my =make check= had a failed
test, I don't know if that was expected.
6. Made some commits
7. I used =git diff HEAD origin/HEAD > my-guix-patch.patch=.

I might have messed around too much in my cloned repo, throwing something off.

> You should also take an extra-files argument, e.g. to add custom.el or
> other elisp files that init.el might refer to.

Understood. Attached as a new patch. =home-emacs-configuration= now
has an extra field =extra-files=. To use it, input a list of file
objects. The service will splice them into
=$XDG_CONFIG_HOME/emacs/{FILE}=. Here is an example configuration.
Using =guix home container= will allow you to see the file =greetings=
with contents "hello world" in =.config/emacs/=.

#+BEGIN_SRC scheme
(use-modules (gnu home services emacs)
     (gnu home)
     (guix gexp)
     (gnu packages)
     (ice-9 pretty-print)
     (gnu services))

(home-environment
 (services
  (list
   (service home-emacs-service-type
    (home-emacs-configuration
     (packages
      (list
       (specification->package "bash")
       (specification->package "emacs-next")))
     (extra-files (list (scheme-file "greetings" '(hello world)
#:splice? #:t))))))))
#+END_SRC

> Also, I'm not certain if "scheme-file" is the right primitive here –
> Emacs Lisp does differ from Scheme, e.g. in keyword syntax among
> others.

I agree; using =scheme-file= for =emacs-lisp= feels blasphemous. There
are some odd errors associated with this method too. For example,
=#'foo= is the shorthand for =(function foo)= in Emacs Lisp but gets
turned into =(syntax foo)= when using Guile. Meaning a pure drag and
drop =init.el >> guile-sexp= has some things that need to be changed.
The fact that Emacs-Lisp and Guile Scheme use S-Expressions was
something I wanted to leverage. It becomes easy to write Elisp in the
parens of the =init= parameter because there is no context switching
(e.g. lispy works, cape-symbols works for Elisp in Scheme).

I am open to other forms of inputting the text in the files. This is a
bit high maka maka, but I would also like to see how "elegant" the
other methods of inserting Elisp look. That is, can we make it
desirable for people to integrate Elisp into Guile Scheme moreso than
a =local-file= declaration. Using backquotes and S-Expressions allows
for some variables from Guile to be placed into the Emacs
configuration like the system type, user names, and emails.

On Thu, Oct 20, 2022 at 2:54 AM Liliana Marie Prikler
<liliana.prikler@ist.tugraz.at> wrote:
>
> Am Mittwoch, dem 19.10.2022 um 15:59 -1000 schrieb Zain Jabbar:
> > Aloha Guix Development Team,
> >
> > First submission of a patch to this mail service. Hopefully this
> > works. I welcome any and all feedback.
> >
> > Attached is a patch which creates a new file
> > =/gnu/home/services/emacs.scm= which defines a new service
> > =home-emacs-service-type= and a configuration for said service
> > =home-emacs-configuration=. The configuration contains a list of
> > packages to add to the home-profile, and a list of expressions to add
> > into Emacs' =init.el= and =early-init.el=.
> Note that you reverted the patch direction.
>
> > Here is an example of a home environment file which:
> >
> > Adds the following packages:
> > - =bash=
> > - =emacs-next=
> > - =emacs-debbugs=
> > - =emacs-evil=
> > - =emacs-paredit=
> > - =emacs-anzu=
> >
> > Overwrites the =.config/emacs/init.el= with:
> > #+BEGIN_SRC emacs-lisp
> > (evil-mode 1)
> > #+END_SRC
> >
> > Overwrites the =.config/emacs/early-init.el= with:
> > #+BEGIN_SRC emacs-lisp
> > (setq warning-suppress-log-types '((comp) (comp))) (setq
> > warning-suppress-types '((comp) (comp)))
> > #+END_SRC
> >
> > #+BEGIN_SRC scheme
> > (use-modules (gnu home services emacs)
> >      (gnu home)
> >      (gnu packages)
> >      (ice-9 pretty-print)
> >      (gnu services))
> >
> > (define-public minimal-home-environment
> >   (home-environment
> >    (services
> >     (list
> >      (service home-emacs-service-type
> >       (home-emacs-configuration
> >        (packages
> > (list
> > (specification->package "bash")
> > (specification->package "emacs-next")
> > (specification->package "emacs-debbugs")
> > (specification->package "emacs-evil")
> > (specification->package "emacs-paredit")
> > (specification->package "emacs-anzu")))
> >        (init '((evil-mode 1)))
> >        (early-init '((setq warning-suppress-log-types '((comp)
> > (comp)))
> >      (setq warning-suppress-types '((comp) (comp)))))))))))
> >
> > minimal-home-environment
> > #+END_SRC
> You should also take an extra-files argument, e.g. to add custom.el or
> other elisp files that init.el might refer to.
>
> Also, I'm not certain if "scheme-file" is the right primitve here –
> Emacs Lisp does differ from Scheme, e.g. in keyword syntax among
> others.
>
> Cheers



--
Mahalo,
Zain Jabbar

Attachment: home-emacs-service-type-extra-files.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]