Claude Code Plugins

Community-maintained marketplace

Feedback

Use when inspecting or modifying Emacs variables - provides elisp patterns for variable handling, customization, and state management

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name emacs-variables
description Use when inspecting or modifying Emacs variables - provides elisp patterns for variable handling, customization, and state management

Emacs Variables 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 t for differentiation
  • Standard Emacs faces (font-lock-*-face) are acceptable as they adapt to themes

Variable Basics

Define variable

(defvar my-var "default" "Documentation string.")
(defvar my-var nil)  ; define without overwriting

Set variable

(setq my-var "value")
(setq var1 "val1" var2 "val2")  ; multiple

Get variable value

my-var  ; just use the symbol
(symbol-value 'my-var)  ; programmatic access

Buffer-Local Variables

Make buffer-local

(make-local-variable 'my-var)
(setq-local my-var "buffer-specific")

Define as buffer-local by default

(defvar-local my-buffer-var nil "Always buffer-local.")

Get value in other buffer

(buffer-local-value 'my-var other-buffer)

Check if buffer-local

(local-variable-p 'my-var)
(local-variable-if-set-p 'my-var)

User Options (Customizable)

Define custom option

(defcustom my-option "default"
  "Documentation for option."
  :type 'string
  :group 'my-group)

Common :type values

:type 'boolean
:type 'string
:type 'integer
:type '(choice (const nil) (string :tag "Custom"))
:type '(repeat string)

Variable Inspection

Check if bound

(boundp 'my-var)  ; is it defined?

Describe variable

(describe-variable 'my-var)  ; interactive

Get documentation

(documentation-property 'my-var 'variable-documentation)

Let Bindings

Local binding

(let ((x 1)
      (y 2))
  (+ x y))  ; x, y only exist here

Sequential binding

(let* ((x 1)
       (y (+ x 1)))  ; y can use x
  y)

Dynamic Binding

Temporarily change variable

(let ((some-global-var "temporary"))
  ;; functions called here see temporary value
  (do-something))
;; original value restored

Common pattern

(let ((inhibit-read-only t))
  ;; can modify read-only buffer here
  (erase-buffer))

Hash Tables

Create hash table

(make-hash-table :test 'equal)

Access hash table

(gethash key table)
(gethash key table default)
(puthash key value table)
(remhash key table)

Iterate hash table

(maphash (lambda (key value)
           ;; process key, value
           )
         table)

Property Lists

Get property

(plist-get '(:a 1 :b 2) :a)  ; => 1

Put property

(plist-put plist :key value)

In symbol properties

(get 'my-symbol 'property)
(put 'my-symbol 'property value)

Common Patterns

Safe variable access

(when (boundp 'maybe-var)
  (symbol-value 'maybe-var))

Toggle boolean

(setq my-flag (not my-flag))

Increment/modify

(cl-incf counter)
(cl-decf counter)
(push item my-list)
(pop my-list)

Environment variables

(getenv "PATH")
(setenv "MY_VAR" "value")

Mode-line variables

;; For e-ink: use weight/slant, not colors
(setq my-mode-line-string
      (propertize " [Status]"
                  'face '(:weight bold)
                  'help-echo "Tooltip text"))

Hooks

Add to hook

(add-hook 'some-mode-hook #'my-function)
(add-hook 'some-mode-hook #'my-function nil t)  ; buffer-local

Remove from hook

(remove-hook 'some-mode-hook #'my-function)

Run hooks

(run-hooks 'my-hook)
(run-hook-with-args 'my-hook arg1 arg2)