Skip to content

llcc/org-table-highlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MELPA

Highlight Org-mode table columns and rows using colored overlays. Designed for enhanced readability and interactive table highlighting.

“Tables should be seen, not just edited.”

Features

  • Highlight the current column or row in an Org-mode table
  • Highlight column only when a condition is met using a predicate function
  • Highlights persist across sessions using table name or structural editing
  • Minor mode to toggle highlight behavior per buffer
  • Cycle through a pastel color palette or custom color with C-u prefix
  • Highlights are automatically restored:
    • When visiting buffers
    • After org-table-align or table navigation
  • Persist highlights while table constructual editings
  • All highlights are done using non-intrusive overlays
  • Clear row/column highlights individually or entirely

assets/demo.jpg

Installation

org-table-highlight is on melpa now, install it via use-package:

(use-package org-table-highlight
  :hook (org-mode . org-table-highlight-mode)
  :config
  (add-hook 'after-init-hook #'org-table-highlight--load-metadata))

Or manually:

  1. Copy org-table-highlight.el to a directory in your load-path
  2. Add the following to your init file:
    (require 'org-table-highlight)
        

Usage

Open an Org table and run the interactive commands:

CommandDescription
org-table-highlight-columnHighlight the current column
org-table-highlight-rowHighlight the current row
org-table-highlight-clear-column-highlightsClear current/all column highlights
org-table-highlight-clear-row-highlightsClear current/all row highlights
org-table-highlight-clear-table-highlightsClear all highlights in the current table
org-table-highlight-list-highlightsList all highlighted table info in a buffer

The org-table-highlight-column command supports prefix arguments to modify its behavior:

  • None prefix: highlight the current column using a pre-defined default color.
  • C-u: Prompt for a custom color, then apply it to the current column.
  • C-u C-u: Prompt for a predicate string, then only highlight fields that match the condition. Predicate string accept numeric comparisons such as >10, <10, =10, and !=10, and can be combined using logical operators and and or for more complex conditions.
  • C-u C-u C-u: In addition to the above, extend the highlight across the entire row where the condition matches.

For example, in the image below, only the rows where the years exceed 10 are highlighted.

assets/conditional-highlight.png

Customization

Customize the color palette by modifying this variable:

(setq org-table-highlight-color-palette
      '("#FFFACD" "#E0FFFF" "#FFCCCC" "#E6E6FA"))

If a table doesn’t have a `#+NAME:`, highlights will still be restored using surrounding context (`before-string` and `after-string`). You can improve reliability by optionally adding `#+NAME:` to important tables. To control how much context is saved around unnamed tables:

(setq org-table-highlight-table-context-length 20)

The highlights are stored in org-table-highlight-metadata-file which defaults to ~/.emacs.d/org-table-highlight-metadata.el. Feel free to change the path.

License

GPL-3.0

Feel free to use, share, and improve!

About

Highlight Org-mode table columns and rows using colored overlays

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published