run-arbitrary-elisp

Send arbitrary Elisp expressions to a running Emacs daemon via emacsclient.

Updated Mar 29, 2024
One-click install
npx skills add https://github.com/addisonbeck/nix --skill run-arbitrary-elisp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: run-arbitrary-elisp
Source: https://github.com/addisonbeck/nix/tree/main/bobert/skills/run-arbitrary-elisp
Command: npx skills add https://github.com/addisonbeck/nix --skill run-arbitrary-elisp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teaches how to execute arbitrary Elisp against the running Emacs daemon via emacsclient. Use when you need to trigger Emacs actions from a shell: open files, start captures, run magit, query buffer state, or drive any Emacs function without opening a frame.

Core Features & Use Cases

  • Base Invocation Pattern: emacsclient with --socket-name and -e to evaluate Elisp against the daemon.
  • Daemon Health Check & Recovery: perform a health check and restart using launchctl when needed, ensuring the socket is available.
  • Output Handling & Quoting Guidance: capture command results or suppress output as needed, with proper shell quoting.

Quick Start

Run emacsclient with the explicit socket path and a -e expression to evaluate Elisp in the running Emacs daemon.

Frequently Asked Questions about run-arbitrary-elisp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run arbitrary Elisp in Emacs from the shell?

You can run arbitrary Elisp from the shell by using emacsclient with the -e flag and an explicit --socket-name to evaluate expressions against a running Emacs daemon without opening a frame.

Can I trigger Emacs actions like starting captures or running magit from a shell script?

Yes, you can trigger Emacs actions like starting captures or interacting with magit from a shell script by passing the corresponding Elisp expressions to emacsclient for execution against the daemon.

Do I need a running Emacs daemon to evaluate Elisp via emacsclient?

Yes, evaluating Elisp via emacsclient requires a running Emacs daemon managed by launchd, and this includes health checks and restart logic using launchctl to ensure the socket remains available.

How do I handle shell quoting and output when sending Elisp to emacsclient?

To handle shell quoting and output when sending Elisp to emacsclient, apply proper shell quoting to your expressions and capture or suppress command results as needed for your automation script.

Why does my shell-triggered emacsclient command fail to connect to the Emacs daemon?

Your shell-triggered emacsclient command fails when the daemon is not running or the socket is unavailable, requiring a health check and a launchctl restart to recover the connection.