all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Guillaume Le Vaillant <glv@posteo.net>
To: Andrew Wong <brosasaki@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Emacs Daemon Service
Date: Wed, 15 May 2024 12:45:29 +0000	[thread overview]
Message-ID: <877cfvkzva.fsf@kitej> (raw)
In-Reply-To: <0BF7ECBF-292F-4EC7-9033-D61762D2300B@gmail.com> (Andrew Wong's message of "Sun, 12 May 2024 17:41:08 -0400")

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

Andrew Wong <brosasaki@gmail.com> skribis:

> Greetings!
>
> Recently I’ve been trying to have an Emacs daemon start in the background on
> login. On Guix, I’ve found some interesting behavior in that an Emacs started
> with no args and then the command “server-start” will then be available to
> subsequent emacsclient calls, but an “emacs —daemon” is inaccessible, even if
> I call the command from my WM startup.
>
> 1. Does anyone understand why Guix’s design results in this behavior?
> 2. How can I set up a service in my configure-home.scm to start emacs —daemon
> (and have it be available) on login? I found a post from 2019 about it, but it
> must be outdated as it doesn’t mention the Guix home feature.
>
> Thank you for your assistance,
> Andrew

Hi.
In my Guix home configuration, I use the following service to start an
Emacs server:

--8<---------------cut here---------------start------------->8---
(define (emacs-server-shepherd-service config)
  (list (shepherd-service
         (documentation "Emacs server.")
         (provision '(emacs-server))
         (start #~(make-forkexec-constructor
                   (list #$(file-append emacs "/bin/emacs")
                         "--fg-daemon")))
         (stop #~(make-kill-destructor)))))

(define home-emacs-server-service-type
  (service-type
   (name 'home-emacs-server)
   (extensions (list (service-extension home-shepherd-service-type
                                        emacs-server-shepherd-service)))
   (default-value #f)
   (description "Run Emacs in server mode.")))

(home-environment
  ...
  (services
   (list ...
         (service home-emacs-server-service-type)
         ...)))
--8<---------------cut here---------------end--------------->8---

Then, using "emacsclient -n -c some-file" works.

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

  reply	other threads:[~2024-05-15 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12 21:41 Emacs Daemon Service Andrew Wong
2024-05-15 12:45 ` Guillaume Le Vaillant [this message]
2024-05-15 21:53   ` Andrew Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cfvkzva.fsf@kitej \
    --to=glv@posteo.net \
    --cc=brosasaki@gmail.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.