Browse Source

Implement multiple, named, emacs server sessions with rofi menu

emacsclient -nc only creates a new client frame to the default emacs server
-a "" automatically starts the server if it is not already running
-s {socket} tries to connect to {socket} server

Combining these options either connects/starts/restarts to a "default" socket (with win+enter and default for editing files), or
connects/starts/restarts to a named socket.
This makes running emacs through a systemd service not necessary anymore, and restarting a crashed emacs automatic.
An emacs server instance can be shut down with save-buffers-kill-emacs.

The accompanying rofi script displays the existing server sockets and enables running a new instance by entering a new name.
master
Maxime Wack 2 years ago
parent
commit
35508d7082
6 changed files with 14 additions and 5 deletions
  1. +1
    -1
      .config/bin/unison-merge-files
  2. +1
    -1
      .config/environment.d/emacs.conf
  3. +1
    -1
      .config/rofi/config
  4. +9
    -0
      .config/rofi/emacsclient
  5. +1
    -1
      .config/sxhkd/sxhkdrc
  6. +1
    -1
      .profile

+ 1
- 1
.config/bin/unison-merge-files View File

@@ -3,7 +3,7 @@ CURRENT1=$1
CURRENT2=$2
NEW=$3
CURRENTARCHOPT=$4
EMACS="emacsclient -c"
EMACS='emacsclient -a "" -ncs default'
if [ x$CURRENTARCHOPT = x ]; then
$EMACS --eval "(emerge-files nil \"$CURRENT1\" \"$CURRENT2\" \"$NEW\")"
else


+ 1
- 1
.config/environment.d/emacs.conf View File

@@ -1,5 +1,5 @@
MOZ_USE_OMTC=1
EDITOR="emacsclient -nc"
EDITOR='emacsclient -a "" -ncs default'
JAVA_HOME="/usr/lib/jvm/default"
LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server
TERMCMD="kitty"


+ 1
- 1
.config/rofi/config View File

@@ -12,4 +12,4 @@ rofi.padding: 10
rofi.bw: 0
rofi.lines: 10
rofi.combi-modi: drun,run
rofi.modi: combi,calc:qalc +u8 -nocurrencies,clipboard:greenclip print,emoji:~/.config/rofi/splatmoji
rofi.modi: combi,calc:qalc +u8 -nocurrencies,clipboard:greenclip print,emacs:~/.config/rofi/emacsclient,emoji:~/.config/rofi/splatmoji

+ 9
- 0
.config/rofi/emacsclient View File

@@ -0,0 +1,9 @@
#!/bin/bash

if [ -z $@ ]
then
ls /run/user/1000/emacs/
else
IFS='';session=$@
emacsclient -a "" -ncs $session
fi

+ 1
- 1
.config/sxhkd/sxhkdrc View File

@@ -107,7 +107,7 @@ super + ctrl + space

# Emacs client
super + Return
emacsclient -nc
emacsclient -a "" -ncs default

# Arandr
XF86Display


+ 1
- 1
.profile View File

@@ -2,7 +2,7 @@
source /etc/profile

export MOZ_USE_OMTC=1
export EDITOR="emacsclient -nc"
export EDITOR='emacsclient -a "" -ncs default'
export JAVA_HOME="/usr/lib/jvm/default"
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server
export TERMCMD="kitty"


Loading…
Cancel
Save