Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

pair-hl.el — Highlight enclosing and adjacent pairs for Emacs

pair-hl.el is a minor mode that dynamically highlights the enclosing and adjacent delimiter pairs as you move point. When a pair is off-screen, it can display the relevant lines in the echo area. Works for parentheses, brackets, braces and string quotes.

Installation

(add-to-list 'load-path "/path/to/pair-hl.el")
(require 'pair-hl)

Usage

To toggle the mode in the current buffer: M-x pair-hl-mode

To start the mode automatically in most programming modes:

(add-hook 'prog-mode-hook #'pair-hl-mode)

Faces

FaceDefaultMeaning
pair-hl-enclosing-faceunderlineInner enclosing pair
pair-hl-adjacent-before-facewheat backgroundPair directly before pt
pair-hl-adjacent-after-faceturquoise bgPair directly after pt
pair-hl-mismatch-facesalmon backgroundUnmatched/mismatched

Customization

OptionDefaultDescription
pair-hl-debounce-delay0.2Idle seconds before recalc (0 = immediate)
pair-hl-highlight-enclosingtHighlight innermost enclosing pair
pair-hl-highlight-adjacent-beforetHighlight pair directly before point
pair-hl-highlight-adjacent-aftertHighlight pair directly after point
pair-hl-adjacent-max-distance1Max chars to scan around point for adjacent pairs
pair-hl-highlight-string-quotestHighlight string-quote delimiters (class 7)
pair-hl-show-pair-context-when-offscreenadjacentShow pair line in echo area when off-screen (nil, adjacent, or t)

Off-screen context

When pair-hl-show-pair-context-when-offscreen is non-nil, the mode shows the line(s) containing off-screen highlighted pairs in the echo area:

  • nil (Off): Never show off-screen context.
  • adjacent (Adjacent pairs only): Show only adjacent pairs, excluding the enclosing pair.
  • t (All highlighted pairs): Show both enclosing and adjacent pairs.

Limitations

  • Relies on the buffer’s syntax table; delimiter detection depends on the major mode providing correct syntax classes.
  • Does not scan inside strings or comments for literal delimiters.

License

GPL-3.0-or-later

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages