Re: Emacs in server mode using a Shepherd user service

2019-11-19 Thread brettg




On 19.11.2019 22:58, bre...@posteo.net wrote:

On 19.11.2019 22:57, Maxim Cournoyer wrote:

Hello!

bre...@posteo.net writes:


On 18.11.2019 00:10, Chris Marusich wrote:

Hi Maxim,

Maxim Cournoyer  writes:

I typically start Emacs in server mode using a shepherd user 
service,

so rarely restart Emacs.


If it isn't too much to ask, could you share the configuration you 
use

to accomplish this?  I'd like to do something similar, and I suspect
it's probably one of those things that is "easy to do" if you 
already

know exactly what to do, and rather time-consuming to figure out
otherwise.  Perhaps we could make another Cook Book section about 
it?


Seconding Chris' comment

Brett Gilio


A Cook Book section would indeed be great!  I originally was 
enlightened

by Dave Thompson on how to go about it.

In my ~/.config/shepherd directory, I have two Scheme files:

init.scm
--8<---cut here---start->8---
;;; Shepherd User Services
(load "services.scm")

(register-services
 emacs
 gpg-agent
 jackd
 ibus-daemon
 workrave)

;; Send shepherd into the background.
(action 'shepherd 'daemonize)

;; Services to start when shepherd starts:
(for-each start '(emacs
  gpg-agent
  ibus-daemon
  workrave))
--8<---cut here---end--->8---

services.scm
--8<---cut here---start->8---
(define emacs
  (make 
#:provides '(emacs)
#:requires '()
#:start (make-system-constructor "emacs --daemon")
#:stop (make-system-destructor "emacsclient --eval 
\"(kill-emacs)\"")))


(define ibus-daemon
  (make 
#:provides '(ibus-daemon)
#:requires '()
#:start (make-system-constructor "ibus-daemon --xim --daemonize 
--replace")

#:stop (make-system-destructor "pkill ibus-daemon")))

(define jackd
  (make 
#:provides '(jackd)
#:requires '()
#:start (make-system-constructor "jackd -d alsa &")
#:stop (make-system-destructor "pkill jackd")))

(define gpg-agent
  (let ((pinentry (string-append (getenv "HOME")
 "/.guix-profile/bin/pinentry")))
(make 
  #:provides '(gpg-agent)
  #:requires '()
  #:start (make-system-constructor
   (string-append "gpg-agent --daemon "
  "--pinentry-program " pinentry))
  #:stop (make-system-destructor "gpgconf --kill gpg-agent"

(define workrave
  (make 
#:provides '(workrave)
#:requires '()
#:start (make-system-constructor "workrave &")
#:stop (make-system-destructor "pkill workrave")))
--8<---cut here---end--->8---

I've included all the services I currently use in case they might be 
of

interest.

The last bit that is needed (other than having the required software
installed to your profile, including shepherd), is to launch shepherd
when your session starts:

For me, that is simply calling 'shepherd' in my ~/.xsession, just 
before

the call to my window manager (ratpoison).

I then start Emacs using 'emacsclient -c'.

HTH!

Maxim


Perfect, thank you Maxim!


I also want to throw Alex's git repo out there which is relevant

https://github.com/alezost/shepherd-config



Re: Emacs in server mode using a Shepherd user service

2019-11-19 Thread brettg




On 19.11.2019 22:57, Maxim Cournoyer wrote:

Hello!

bre...@posteo.net writes:


On 18.11.2019 00:10, Chris Marusich wrote:

Hi Maxim,

Maxim Cournoyer  writes:

I typically start Emacs in server mode using a shepherd user 
service,

so rarely restart Emacs.


If it isn't too much to ask, could you share the configuration you 
use

to accomplish this?  I'd like to do something similar, and I suspect
it's probably one of those things that is "easy to do" if you already
know exactly what to do, and rather time-consuming to figure out
otherwise.  Perhaps we could make another Cook Book section about it?


Seconding Chris' comment

Brett Gilio


A Cook Book section would indeed be great!  I originally was 
enlightened

by Dave Thompson on how to go about it.

In my ~/.config/shepherd directory, I have two Scheme files:

init.scm
--8<---cut here---start->8---
;;; Shepherd User Services
(load "services.scm")

(register-services
 emacs
 gpg-agent
 jackd
 ibus-daemon
 workrave)

;; Send shepherd into the background.
(action 'shepherd 'daemonize)

;; Services to start when shepherd starts:
(for-each start '(emacs
  gpg-agent
  ibus-daemon
  workrave))
--8<---cut here---end--->8---

services.scm
--8<---cut here---start->8---
(define emacs
  (make 
#:provides '(emacs)
#:requires '()
#:start (make-system-constructor "emacs --daemon")
#:stop (make-system-destructor "emacsclient --eval 
\"(kill-emacs)\"")))


(define ibus-daemon
  (make 
#:provides '(ibus-daemon)
#:requires '()
#:start (make-system-constructor "ibus-daemon --xim --daemonize 
--replace")

#:stop (make-system-destructor "pkill ibus-daemon")))

(define jackd
  (make 
#:provides '(jackd)
#:requires '()
#:start (make-system-constructor "jackd -d alsa &")
#:stop (make-system-destructor "pkill jackd")))

(define gpg-agent
  (let ((pinentry (string-append (getenv "HOME")
 "/.guix-profile/bin/pinentry")))
(make 
  #:provides '(gpg-agent)
  #:requires '()
  #:start (make-system-constructor
   (string-append "gpg-agent --daemon "
  "--pinentry-program " pinentry))
  #:stop (make-system-destructor "gpgconf --kill gpg-agent"

(define workrave
  (make 
#:provides '(workrave)
#:requires '()
#:start (make-system-constructor "workrave &")
#:stop (make-system-destructor "pkill workrave")))
--8<---cut here---end--->8---

I've included all the services I currently use in case they might be of
interest.

The last bit that is needed (other than having the required software
installed to your profile, including shepherd), is to launch shepherd
when your session starts:

For me, that is simply calling 'shepherd' in my ~/.xsession, just 
before

the call to my window manager (ratpoison).

I then start Emacs using 'emacsclient -c'.

HTH!

Maxim


Perfect, thank you Maxim!



Re: Emacs in server mode using a Shepherd user service

2019-11-19 Thread Maxim Cournoyer
Hello!

bre...@posteo.net writes:

> On 18.11.2019 00:10, Chris Marusich wrote:
>> Hi Maxim,
>>
>> Maxim Cournoyer  writes:
>>
>>> I typically start Emacs in server mode using a shepherd user service,
>>> so rarely restart Emacs.
>>
>> If it isn't too much to ask, could you share the configuration you use
>> to accomplish this?  I'd like to do something similar, and I suspect
>> it's probably one of those things that is "easy to do" if you already
>> know exactly what to do, and rather time-consuming to figure out
>> otherwise.  Perhaps we could make another Cook Book section about it?
>
> Seconding Chris' comment
>
> Brett Gilio

A Cook Book section would indeed be great!  I originally was enlightened
by Dave Thompson on how to go about it.

In my ~/.config/shepherd directory, I have two Scheme files:

init.scm
--8<---cut here---start->8---
;;; Shepherd User Services
(load "services.scm")

(register-services
 emacs
 gpg-agent
 jackd
 ibus-daemon
 workrave)

;; Send shepherd into the background.
(action 'shepherd 'daemonize)

;; Services to start when shepherd starts:
(for-each start '(emacs
  gpg-agent
  ibus-daemon
  workrave))
--8<---cut here---end--->8---

services.scm
--8<---cut here---start->8---
(define emacs
  (make 
#:provides '(emacs)
#:requires '()
#:start (make-system-constructor "emacs --daemon")
#:stop (make-system-destructor "emacsclient --eval \"(kill-emacs)\"")))

(define ibus-daemon
  (make 
#:provides '(ibus-daemon)
#:requires '()
#:start (make-system-constructor "ibus-daemon --xim --daemonize --replace")
#:stop (make-system-destructor "pkill ibus-daemon")))

(define jackd
  (make 
#:provides '(jackd)
#:requires '()
#:start (make-system-constructor "jackd -d alsa &")
#:stop (make-system-destructor "pkill jackd")))

(define gpg-agent
  (let ((pinentry (string-append (getenv "HOME")
 "/.guix-profile/bin/pinentry")))
(make 
  #:provides '(gpg-agent)
  #:requires '()
  #:start (make-system-constructor
   (string-append "gpg-agent --daemon "
  "--pinentry-program " pinentry))
  #:stop (make-system-destructor "gpgconf --kill gpg-agent"

(define workrave
  (make 
#:provides '(workrave)
#:requires '()
#:start (make-system-constructor "workrave &")
#:stop (make-system-destructor "pkill workrave")))
--8<---cut here---end--->8---

I've included all the services I currently use in case they might be of
interest.

The last bit that is needed (other than having the required software
installed to your profile, including shepherd), is to launch shepherd
when your session starts:

For me, that is simply calling 'shepherd' in my ~/.xsession, just before
the call to my window manager (ratpoison).

I then start Emacs using 'emacsclient -c'.

HTH!

Maxim



Re: Emacs in server mode using a Shepherd user service (Was: Re: Emacs in multiple profiles)

2019-11-18 Thread brettg




On 18.11.2019 00:10, Chris Marusich wrote:

Hi Maxim,

Maxim Cournoyer  writes:


I typically start Emacs in server mode using a shepherd user service,
so rarely restart Emacs.


If it isn't too much to ask, could you share the configuration you use
to accomplish this?  I'd like to do something similar, and I suspect
it's probably one of those things that is "easy to do" if you already
know exactly what to do, and rather time-consuming to figure out
otherwise.  Perhaps we could make another Cook Book section about it?


Seconding Chris' comment

Brett Gilio



Emacs in server mode using a Shepherd user service (Was: Re: Emacs in multiple profiles)

2019-11-17 Thread Chris Marusich
Hi Maxim,

Maxim Cournoyer  writes:

> I typically start Emacs in server mode using a shepherd user service,
> so rarely restart Emacs.

If it isn't too much to ask, could you share the configuration you use
to accomplish this?  I'd like to do something similar, and I suspect
it's probably one of those things that is "easy to do" if you already
know exactly what to do, and rather time-consuming to figure out
otherwise.  Perhaps we could make another Cook Book section about it?

-- 
Chris


signature.asc
Description: PGP signature