← スキル一覧に戻る

emacs-buffer
by jingtaozf
Native Emacs SDK for Claude Code with org-mode as the interactive UI
⭐ 0🍴 0📅 2026年1月24日
SKILL.md
name: emacs-buffer description: Use when manipulating Emacs buffers - provides elisp patterns for listing, switching, creating, killing, and working with buffer contents
Emacs Buffer Skill
Display Guidelines
E-ink Monitor Compatibility: User uses an e-ink monitor that only supports black, white, and grey.
- NEVER use colors (
:foreground "red",:foreground "cyan", etc.) - Use
:weight bold,:weight light,:slant italic,:underline tfor differentiation - Standard Emacs faces (font-lock-*-face) are acceptable as they adapt to themes
Buffer Basics
Get current buffer
(current-buffer) ; returns buffer object
(buffer-name) ; returns buffer name string
(buffer-file-name) ; returns file path or nil
Switch to buffer
(switch-to-buffer "buffer-name")
(set-buffer "buffer-name") ; doesn't change window display
(pop-to-buffer "buffer-name") ; shows in new window
Create buffer
(get-buffer-create "*my-buffer*")
(with-current-buffer (get-buffer-create "*my-buffer*")
;; work in buffer
)
Kill buffer
(kill-buffer "buffer-name")
(kill-buffer (current-buffer))
Buffer Contents
Read buffer text
(buffer-string) ; entire buffer
(buffer-substring start end) ; region
(buffer-substring-no-properties start end) ; without text properties
Insert text
(insert "text")
(insert-buffer-substring other-buffer start end)
Erase buffer
(erase-buffer)
(delete-region start end)
Buffer Properties
Check buffer state
(buffer-modified-p) ; unsaved changes?
(buffer-live-p buf) ; buffer exists?
(get-buffer "name") ; returns buffer or nil
Set buffer properties
(set-buffer-modified-p nil) ; mark as saved
(rename-buffer "new-name")
Buffer Lists
List all buffers
(buffer-list) ; all buffers
(mapcar #'buffer-name (buffer-list)) ; just names
Filter buffers
;; Get file-visiting buffers
(seq-filter #'buffer-file-name (buffer-list))
;; Get buffers matching pattern
(seq-filter (lambda (b)
(string-match-p "\\*claude" (buffer-name b)))
(buffer-list))
Working with Buffer Positions
Point operations
(point) ; current position
(point-min) ; buffer start
(point-max) ; buffer end
(goto-char pos) ; move to position
Save and restore position
(save-excursion
;; point and buffer restored after body
(goto-char (point-min))
(search-forward "text"))
Temporary Buffers
with-temp-buffer
(with-temp-buffer
(insert "temporary content")
(buffer-string)) ; returns content, buffer killed after
Generate new buffer
(generate-new-buffer "*unique-name*")
Buffer-Local Variables
Set buffer-local
(setq-local my-var "value")
(make-local-variable 'my-var)
Check if buffer-local
(local-variable-p 'my-var)
(buffer-local-value 'my-var some-buffer)
Common Patterns
Process buffer safely
(when-let ((buf (get-buffer "*my-buffer*")))
(with-current-buffer buf
;; work with buffer
))
Create output buffer
(let ((buf (get-buffer-create "*output*")))
(with-current-buffer buf
(erase-buffer)
(insert "Output:\n")
(insert result))
(display-buffer buf))
Find buffer by mode
(seq-find (lambda (b)
(with-current-buffer b
(derived-mode-p 'org-mode)))
(buffer-list))
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です