xiaohongshu
xiaohongshu
emacs-variables
Use when inspecting or modifying Emacs variables - provides elisp patterns for variable handling, customization, and state management
Full skill instructions
E-ink Monitor Compatibility: User uses an e-ink monitor that only supports black, white, and grey.
:foreground "red", :foreground "cyan", etc.):weight bold, :weight light, :slant italic, :underline t for differentiation(defvar my-var "default" "Documentation string.")
(defvar my-var nil) ; define without overwriting
(setq my-var "value")
(setq var1 "val1" var2 "val2") ; multiple
my-var ; just use the symbol
(symbol-value 'my-var) ; programmatic access
(make-local-variable 'my-var)
(setq-local my-var "buffer-specific")
(defvar-local my-buffer-var nil "Always buffer-local.")
(buffer-local-value 'my-var other-buffer)
(local-variable-p 'my-var)
(local-variable-if-set-p 'my-var)
(defcustom my-option "default"
"Documentation for option."
:type 'string
:group 'my-group)
:type 'boolean
:type 'string
:type 'integer
:type '(choice (const nil) (string :tag "Custom"))
:type '(repeat string)
(boundp 'my-var) ; is it defined?
(describe-variable 'my-var) ; interactive
(documentation-property 'my-var 'variable-documentation)
(let ((x 1)
(y 2))
(+ x y)) ; x, y only exist here
(let* ((x 1)
(y (+ x 1))) ; y can use x
y)
(let ((some-global-var "temporary"))
;; functions called here see temporary value
(do-something))
;; original value restored
(let ((inhibit-read-only t))
;; can modify read-only buffer here
(erase-buffer))
IMPORTANT: Emacs has two binding modes - dynamic (default in older code) and lexical.
Literate-elisp files and files without lexical-binding: t use dynamic binding.
In dynamic binding, lambdas don't capture variables - they look them up at runtime:
;; BROKEN in dynamic binding - tn is void at call time
(defun make-broken-fn (name)
(let ((tn name))
(lambda () (message "Name: %s" tn)))) ; tn looked up when called, not defined!
lexical-let (from cl-lib) creates true lexical closures even in dynamic binding mode:
(require 'cl-lib)
;; WORKS - lexical-let captures variables properly
(defun make-working-fn (name)
(lexical-let ((tn name))
(lambda () (message "Name: %s" tn)))) ; tn captured at definition time
Use lexical-let when:
;; Creating multiple closures that each capture different values
(defun make-toggler (tag-name)
"Create a function that toggles TAG-NAME."
(lexical-let ((tn tag-name))
(lambda ()
(interactive)
(toggle-tag tn))))
;; Creating a description function for transient menu
(defun make-description (tag desc)
"Create a description function for TAG with DESC."
(lexical-let ((t tag) (d desc))
(lambda ()
(format "[%s] %s" (if (selected-p t) "X" " ") d))))
For new files, prefer enabling lexical binding in the file header:
;;; my-file.el --- Description -*- lexical-binding: t; -*-
Then regular let creates closures correctly:
;; Works with lexical-binding: t
(defun make-fn (name)
(let ((tn name))
(lambda () (message "Name: %s" tn))))
(make-hash-table :test 'equal)
(gethash key table)
(gethash key table default)
(puthash key value table)
(remhash key table)
(maphash (lambda (key value)
;; process key, value
)
table)
(plist-get '(:a 1 :b 2) :a) ; => 1
(plist-put plist :key value)
(get 'my-symbol 'property)
(put 'my-symbol 'property value)
(when (boundp 'maybe-var)
(symbol-value 'maybe-var))
(setq my-flag (not my-flag))
(cl-incf counter)
(cl-decf counter)
(push item my-list)
(pop my-list)
(getenv "PATH")
(setenv "MY_VAR" "value")
;; For e-ink: use weight/slant, not colors
(setq my-mode-line-string
(propertize " [Status]"
'face '(:weight bold)
'help-echo "Tooltip text"))
(add-hook 'some-mode-hook #'my-function)
(add-hook 'some-mode-hook #'my-function nil t) ; buffer-local
(remove-hook 'some-mode-hook #'my-function)
(run-hooks 'my-hook)
(run-hook-with-args 'my-hook arg1 arg2)
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience