|
|
|
@ -1,6 +1,7 @@ |
|
|
|
;;; highlight-parentheses.el --- highlight surrounding parentheses |
|
|
|
;;; highlight-parentheses.el --- highlight surrounding parentheses |
|
|
|
;; |
|
|
|
;; |
|
|
|
;; Copyright (C) 2007, 2009, 2013 Nikolaj Schumacher |
|
|
|
;; Copyright (C) 2007, 2009, 2013 Nikolaj Schumacher |
|
|
|
|
|
|
|
;; Copyright (C) 2018 Tim Perkins |
|
|
|
;; |
|
|
|
;; |
|
|
|
;; Author: Nikolaj Schumacher <bugs * nschum de> |
|
|
|
;; Author: Nikolaj Schumacher <bugs * nschum de> |
|
|
|
;; Maintainer: Tassilo Horn <tsdh@gnu.org> |
|
|
|
;; Maintainer: Tassilo Horn <tsdh@gnu.org> |
|
|
|
@ -69,6 +70,12 @@ The list starts with the inside parentheses and moves outwards." |
|
|
|
:set 'hl-paren-set |
|
|
|
:set 'hl-paren-set |
|
|
|
:group 'highlight-parentheses) |
|
|
|
:group 'highlight-parentheses) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom hl-paren-highlight-adjacent nil |
|
|
|
|
|
|
|
"Highlight adjacent parentheses, just like show-paren-mode." |
|
|
|
|
|
|
|
:type '(boolean) |
|
|
|
|
|
|
|
:set 'hl-paren-set |
|
|
|
|
|
|
|
:group 'highlight-parentheses) |
|
|
|
|
|
|
|
|
|
|
|
(defface hl-paren-face nil |
|
|
|
(defface hl-paren-face nil |
|
|
|
"Face used for highlighting parentheses. |
|
|
|
"Face used for highlighting parentheses. |
|
|
|
Color attributes might be overriden by `hl-paren-colors' and |
|
|
|
Color attributes might be overriden by `hl-paren-colors' and |
|
|
|
@ -98,17 +105,19 @@ This is used to prevent analyzing the same context over and over.") |
|
|
|
(unless (= (point) hl-paren-last-point) |
|
|
|
(unless (= (point) hl-paren-last-point) |
|
|
|
(setq hl-paren-last-point (point)) |
|
|
|
(setq hl-paren-last-point (point)) |
|
|
|
(let ((overlays hl-paren-overlays) |
|
|
|
(let ((overlays hl-paren-overlays) |
|
|
|
pos1 pos2 |
|
|
|
pos1 pos2) |
|
|
|
(pos (point))) |
|
|
|
|
|
|
|
(save-excursion |
|
|
|
(save-excursion |
|
|
|
(condition-case err |
|
|
|
(ignore-errors |
|
|
|
|
|
|
|
(when hl-paren-highlight-adjacent |
|
|
|
|
|
|
|
(cond ((memq (preceding-char) '(?\) ?\} ?\] ?\>)) |
|
|
|
|
|
|
|
(backward-char 1)) |
|
|
|
|
|
|
|
((memq (following-char) '(?\( ?\{ ?\[ ?\<)) |
|
|
|
|
|
|
|
(forward-char 1)))) |
|
|
|
(while (and (setq pos1 (cadr (syntax-ppss pos1))) |
|
|
|
(while (and (setq pos1 (cadr (syntax-ppss pos1))) |
|
|
|
(cdr overlays)) |
|
|
|
(cdr overlays)) |
|
|
|
(move-overlay (pop overlays) pos1 (1+ pos1)) |
|
|
|
(move-overlay (pop overlays) pos1 (1+ pos1)) |
|
|
|
(when (setq pos2 (scan-sexps pos1 1)) |
|
|
|
(when (setq pos2 (scan-sexps pos1 1)) |
|
|
|
(move-overlay (pop overlays) (1- pos2) pos2))) |
|
|
|
(move-overlay (pop overlays) (1- pos2) pos2))))) |
|
|
|
(error nil)) |
|
|
|
|
|
|
|
(goto-char pos)) |
|
|
|
|
|
|
|
(hl-paren-delete-overlays overlays)))) |
|
|
|
(hl-paren-delete-overlays overlays)))) |
|
|
|
|
|
|
|
|
|
|
|
(defcustom hl-paren-delay 0.137 |
|
|
|
(defcustom hl-paren-delay 0.137 |
|
|
|
|