← 返回 Skills 市场
calsys456

Emacs Control

作者 April & May & June · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
96
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install emacs-control
功能描述
Control Emacs. Search, edit, navigate, and pair programming with user
使用说明 (SKILL.md)

Emacs Control Skill

Use emacsctl to interact with running Emacs.

CLI Usage

emacsctl [options]... [arguments]...

Options:
  -i, --insert                Perform insertion
  -r, --replace               Perform replacement
  -b, --buffer BUFFER         Buffer for insertion or replacement. Current buffer by default
  -s, --save                  Save the buffer after insertion or replacement
  -p, --position INSERT_POSITION
  -l, --line INSERT_LINE
  -c, --column INSERT_COLUMN
      --start-position REPLACE_START_POSITION
      --end-position REPLACE_END_POSITION
      --start-line REPLACE_START_LINE
      --end-line REPLACE_END_LINE
  -h, --help

emacsctl needs configure for both agent and Emacs side. Check https://github.com/calsys456/emacsctl for proper setup and notice user if possible when emacsctl not found or returned connection failure

Eval

Basically, emacsctl retrieve a string of S-expressions, either from first argument or stdin, then read and eval them with progn inside Emacs, and print the return value of the last expression.

emacsctl '(emacs-version)'
# with pipe
echo '(emacs-version)' | emacsctl 
# => "GNU Emacs XX.X.XX"

# Use HEREDOC for multi-line input or input with quote
# Note that HEREDOC has trailing newline
emacsctl \x3C\x3CEOF
(defun multi-line-function ()
  (message "Hello my user")
  'return-to-me)
(multi-line-function)
EOF
# => return-to-me

Be careful with interactive or blocking functions (like read-string, y-or-n-p) as they will hang.

When mistake happened, suggest user to undo or revert. only undo in yourself (e.g. emacsctl '(undo)') if nothing important or you are confident to do so.

BE CAREFUL WHEN EVAL

Insert

When -i specified, emacsctl will perform insertion with given string, file or stdin:

# Insert "Hello" at line 50, column 15 of buffer emacsctl.el
emacsctl -i -b "emacsctl.el" -l 50 -c 15 -p 100 "Hello"

# Insert your-code at point 100 of current buffer
emacsctl -i -p 100 \x3C\x3CEOF
\x3Cyour-code>
EOF

# Insert the content of ~/gpl-3.0.txt at the current point of current buffer, and save the buffer
emacsctl -i -s ~/gpl-3.0.txt

Replace

When -r specified, emacsctl can perform buffer content replacement in two style: replacing range or replacing certain text.

Replacing Range

Specify --start-position and --end-position, or --start-line and --end-line to replace a range:

# Replace first 5 characters of buffer emacsctl.el with "XXXXX"
emacsctl -r -b "emacsctl.el" --start-position 1 --end-position 5 "XXXXX"

# Replace line 50-100 of the current buffer with your-code, and save the buffer
emacsctl -r --start-line 50 --end-line 100 -s \x3C\x3CEOF
\x3Cyour-code>
EOF

Replacing Certain Text

Give 2 strings or files, to replace the first (old-text) to second (new-text):

# Replace nearest "(require 'function)" form of buffer emacsctl.el to the content of ~/function.el
emacsctl -r -b "emacsctl.el" "(require 'function)" ~/function.el

# Replace `to-be-refined` function to `refined` function in current buffer
emacsctl -r \x3C(cat \x3C\x3COLD_TEXT
(defun to-be-refined ()
  (message "replace me"))
OLD_TEXT
) \x3C\x3CNEW_TEXT
(defun refined ()
  (message "new message"))
NEW_TEXT

If there's multiple occurrence of old-text, only the one nearest from current point will be replaced. For bulk replacement or regex-based replacement, write ELisp instead.

Interface

Here is some specially designed ELisp functions for agent use, start with emacsctl- and return informative Lisp plist. Call them with Eval if possible.

Point and Mark

Use (emacsctl-point-info &optional (surrounding 2)) and (emacsctl-mark-info &optional (surrounding 2)) for information and surrounding contents for point and mark.

The current point is marked out using "█" and current mark is using "▄".

Buffer

Use (emacsctl-buffer-info &optional (buffer (current-buffer))) for buffer state and metadata.

Use (emacsctl-buffer-imenu &optional (buffer (current-buffer))) for buffer overview.

Fuzzy-match normal buffers using (emacsctl-buffer-list &optional match). Use (emacsctl-hidden-buffer-list &optional match) similarly for hidden buffers.

Grep Buffer

Use (emacsctl-grep pattern &optional (buffer (current-buffer))) to grep buffer content. It will return match result and surroundings.

Use Emacs-specific regular expression. Try to construct regex with rx or regexp-* functions if there's difficult.

Read Buffer

Function: (emacsctl-read-buffer &key (buffer (current-buffer)) line (start-line line) (end-line line) position (start-position (or position (point-min))) (end-position (or position (point-max))) (surrounding 2) full-p)

Examples:

;; Read a region
(emacsctl-read-buffer :start-position \x3Cpoint-number> :end-position \x3Cpoint-number>)
;; Read lines
(emacsctl-read-buffer :start-line \x3Cline-number> :end-line \x3Cline-number>)
;; Get region around line
(emacsctl-read-buffer :line \x3Cline-number> :surrounding 20)
;; Retrieve FULL content of the buffer (USE WITH CAUTION)
(emacsctl-read-buffer :buffer \x3Cbuffer> :full-p t)

Window

Use (emacsctl-query-window) to view the window layout of current frame. Use (emacsctl-select-window \x3Cindex>) to switch to a window using the index returned by query.

Kill Ring (Pasteboard)

Use (emacsctl-query-kill-ring) for a brief view of the kill-ring. Write ELisp code to search in-detail.

Environment Inquiries

To search symbol, use (emacsctl-search-symbol \x3Cpattern>); For command, use (emacsctl-search-command \x3Cpattern>); For function, use (emacsctl-search-function \x3Cpattern>); For variable, use (emacsctl-search-variable \x3Cpattern>). They will return useful informations.

Pattern will be breaked down by dashes and matched in substring. Accurate query will get better detail.

Tips

The emacs-control skill is not for replacing other tool calls. Emacs is for bodied humans but not you. Use other file-based tools for efficient work, and emacsctl only if it is really needed or user asked to.

安全使用建议
This skill can evaluate arbitrary Emacs Lisp inside your Emacs and can read or modify buffers and files — powerful but risky. Before installing: (1) verify the upstream `emacsctl` project linked in the SKILL.md and confirm you trust that binary; (2) be aware the metadata does not declare `emacsctl` as a required binary or provide an install step (this mismatch is suspicious); (3) avoid running the skill when sensitive files or buffers are open, and require explicit user confirmation before any 'full buffer' read or file insertion; (4) consider running emacsctl in a restricted/sandboxed Emacs instance or test environment first; (5) request the author to update metadata to declare the dependency and to add explicit prompts/constraints in SKILL.md for potentially sensitive operations.
功能分析
Type: OpenClaw Skill Name: emacs-control Version: 0.1.0 The `emacs-control` skill provides a CLI tool (`emacsctl`) that allows an AI agent to execute arbitrary Emacs Lisp code via an `eval` function, which can be leveraged to run shell commands on the host system. Additionally, the skill provides functions to read any buffer content and the kill-ring (clipboard history) in `SKILL.md`. While these capabilities are aligned with the stated goal of controlling Emacs, the lack of restrictions on Lisp evaluation presents a significant security risk for arbitrary code execution and data exposure. (Reference: https://github.com/calsys456/emacsctl)
能力评估
Purpose & Capability
The SKILL.md explicitly depends on a CLI named `emacsctl` and links to a GitHub repository for setup, yet the registry metadata lists no required binaries or install steps. A consumer would legitimately expect the skill to require the `emacsctl` binary (or to install it), so the metadata and instructions are inconsistent. The skill otherwise matches its stated purpose of controlling Emacs.
Instruction Scope
Runtime instructions instruct the agent to send arbitrary S-expressions to Emacs for read/eval, read full buffer contents (full-p), access the kill ring, grep buffers, read files into buffers, and perform insert/replace operations. Arbitrary eval in Emacs Lisp and the ability to read whole buffers or local files are powerful and can expose sensitive data. The SKILL.md does not constrain or require explicit user confirmation before potentially sensitive reads or evals (beyond a general warning).
Install Mechanism
There is no install spec (instruction-only), so nothing will be written to disk by the registry install process. However, the skill expects an external `emacsctl` binary to be present (and links to a third-party GitHub project) but does not declare this dependency in metadata.
Credentials
The skill requests no environment variables or credentials, which is proportionate. That said, via `emacsctl` it can read arbitrary Emacs buffers and local files (examples include reading ~/gpl-3.0.txt and 'full' buffer reads) — these are not declared as credentials but are sensitive data sources. The skill gives the agent broad read/write access to the user's Emacs environment without explicit metadata signaling that capability.
Persistence & Privilege
The skill is not marked always:true, does not request elevated registry privileges, and is user-invocable. It does not attempt to modify other skills or agent-wide settings according to the provided files.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install emacs-control
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /emacs-control 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Initial release of emacs-control skill. - Enables programmatic control of a running Emacs instance via the `emacsctl` command-line utility. - Supports insertion and replacement of text, buffer navigation, saving, and buffer selection. - Provides CLI options for precise positioning, line/column selection, and range replacements. - Documents special Emacs Lisp helper functions for interacting with point, mark, buffer info, windows, kill-ring, and environment inquiries. - Warns users to use this skill judiciously, preferring file-based tools unless Emacs interaction is specifically needed or requested.
元数据
Slug emacs-control
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Emacs Control 是什么?

Control Emacs. Search, edit, navigate, and pair programming with user. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 96 次。

如何安装 Emacs Control?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install emacs-control」即可一键安装,无需额外配置。

Emacs Control 是免费的吗?

是的,Emacs Control 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Emacs Control 支持哪些平台?

Emacs Control 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Emacs Control?

由 April & May & June(@calsys456)开发并维护,当前版本 v0.1.0。

💬 留言讨论