Skip to content

mimo84/emacsclient-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Emacs Client Wrapper Script

Demo Video

You can watch the demo for this video here: https://youtu.be/pQr6pnnZ6sA

What is it

This is a utility script that wraps Emacs client in order to automatically run a server configured to use a chemacs2 profile or a init-directory. It is going to pass to emacsclient all the extra options that are not read out by the script. For the options you can pass to emacsclient refer to: https://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html

How is different than just running emacsclient -a?

It differs because when running emacsclient with -a option I did not find a way to specify a profile or an init-directory, which didn’t involve changing the startup script. Also the script has some utility functions such as -l that is going to list all the socket files currently available in the system.

Dependencies

This script expects emacs and emacsclient to be in the system and available. Also uses lsof to be installed in the system.

profile option

In order to use the --profile option in the script, chemacs2 is expected to be installed and configured in the system.

init-directory option

The init-directory option relies on Emacs being v29.

Examples

Basic usage

ec 

Emacs server already running

It will open a new instance of emacsclient in a frame, called with -c option.

Emacs server is not running

In this case is going to call emacsclient with =-a ”= option, which is going to start the server for the default profile of Emacs.

Specify a profile or init-directory

ec --profile <chemacs2-profile-name>
# or
ec --init-directory ~/init-directory

Emacs server already running

It’s going to just call Emacs client, since the socket already exists and it’s not required to create a new one. If you really want to run a second server besides you can always run the regular command:

emacs --bg-daemon=<deamon-name> --init-directory ~/init-directory

and then call the script with the -s option for Emacs client to reference to that particular daemon that wants to be used.

ec -s <daemon-name>

Emacs server is not running

It is going to start a new Emacs instance with a particular init-directory or profile, and then it’s going to run the client associated with it.

List available Emacs server
ec -l 

It will return a list of open Emacs sockets using lsof.

Kill an Emacs server

ec -k

Or a specific daemon instance:

ec -k -s <name>

Support for all the options that can be provided to emacsclient

Just a few examples:

Open emacsclient on a particular file and line number

ec +18 ~/dotfiles/.config/conf.el

Open emacsclient using a different daemon

ec -s deamon-name +12 ~/my-file.org 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages