Skip to content
Back to skills

Emacs Org

ASecurity

Use when working with Emacs org-mode - provides elisp patterns for headings, properties, tables, links, and org-mode manipulation

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
developmentgo

Works with

  • cursor

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill emacs-org --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Emacs Org?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Emacs Org
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-emacs-org/badge)](https://www.skillsdirectory.com/skills/majiayu000-emacs-org)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: emacs-org
description: Use when working with Emacs org-mode - provides elisp patterns for headings, properties, tables, links, and org-mode manipulation
---

# Emacs Org-Mode 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

## Org Properties

### Get property with inheritance
```elisp
(org-entry-get nil "PROPERTY_NAME" t)  ; t enables inheritance
```

### Get property without inheritance
```elisp
(org-entry-get nil "PROPERTY_NAME" nil)
```

### Set property
```elisp
(org-entry-put nil "PROPERTY_NAME" "value")
```

### Safe property access (for header-line, mode-line contexts)
```elisp
;; Wrap in ignore-errors when called from non-org-mode contexts
(ignore-errors
  (org-entry-get nil "PROPERTY_NAME" t))
```

## Headings Navigation

### Go to heading
```elisp
(org-back-to-heading t)  ; t means error if not at heading
```

### Walk up headings
```elisp
(while (org-up-heading-safe)
  ;; process each parent heading
  )
```

### Check if at heading
```elisp
(org-at-heading-p)
```

### Get current level
```elisp
(org-current-level)  ; returns integer
```

## Tags

### Get tags for current heading
```elisp
(org-get-tags nil t)  ; returns list of strings
```

### Check for specific tag
```elisp
(member "my_tag" (org-get-tags nil t))
```

## Subtree Operations

### Get subtree end
```elisp
(save-excursion
  (org-end-of-subtree t t)
  (point))
```

### Map over entries with tag
```elisp
(org-map-entries
 (lambda ()
   ;; body executed at each matching heading
   (org-entry-get nil "PROPERTY"))
 "+my_tag")
```

## File-Level Properties

### Get file keyword (#+PROPERTY: NAME value)
```elisp
(save-excursion
  (goto-char (point-min))
  (when (re-search-forward "^#\\+PROPERTY:\\s-+NAME\\s-+\\(.+\\)$" nil t)
    (match-string 1)))
```

## Tables

### Move in table
```elisp
(org-table-goto-column 2)  ; go to column 2
(org-table-next-row)       ; go to next row
```

### Get cell value
```elisp
(org-table-get-field)  ; current cell
(org-table-get-field 3)  ; column 3 of current row
```

## Links

### Parse link at point
```elisp
(org-element-context)  ; returns element with :path, :type properties
```

### Create link
```elisp
(org-link-make-string "https://example.com" "description")
```

## Common Patterns

### Safely get session info for mode-line
```elisp
(defun my-get-session-id ()
  "Get session ID safely from any context."
  (ignore-errors
    (save-excursion
      (org-entry-get nil "SESSION_ID" t))))
```

### Find heading with property value
```elisp
(save-excursion
  (goto-char (point-min))
  (catch 'found
    (while (re-search-forward "^\\*+ " nil t)
      (when (equal "target" (org-entry-get nil "MY_PROP"))
        (throw 'found (point))))
    nil))
```

### Insert property drawer
```elisp
(org-back-to-heading t)
(forward-line 1)
(insert ":PROPERTIES:\n")
(insert ":MY_PROP: value\n")
(insert ":END:\n")
```

## Error Prevention

Functions called from header-line or mode-line should wrap org-* calls:

```elisp
;; BAD - will error in non-org buffers
(defun my-header-line ()
  (org-entry-get nil "PROP" t))

;; GOOD - safe in any buffer
(defun my-header-line ()
  (ignore-errors
    (org-entry-get nil "PROP" t)))
```

## CRITICAL: Async/Callback Context Warning

**`org-entry-get nil` uses CURRENT cursor position!**

In async callbacks (`:on-complete`, `run-at-time`, process filters), the cursor
may have moved. See `/emacs-async` skill for full patterns.

### Quick Fix Pattern for Async

```elisp
;; When called from async context with a marker:
(defun handle-async-result (session-key result)
  (let ((marker (get-session-marker session-key)))
    (when (marker-buffer marker)
      (with-current-buffer (marker-buffer marker)
        (save-excursion
          (goto-char marker)  ; Position cursor FIRST!
          ;; NOW org-entry-get works correctly
          (org-entry-get nil "PROPERTY" t))))))
```

### Common Bug Pattern

```elisp
;; BUG: Called from async callback, cursor may be anywhere!
(defun bad-error-handler (error)
  (let ((session-key (my-get-session-from-cursor)))  ; WRONG!
    (recover-session session-key)))

;; FIX: Pass session-key explicitly from the original call
(defun good-error-handler (session-key error)
  (recover-session session-key))
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.