;; are handled by the syntax table
(defconst LilyPond-parens-regexp-alist
- `( ( ?> . ("[^\\]<" . "[^ \\n\\t_^-]\\s-*>\\|[_^-]\\s-*[-^]\\s-*>"))
+ `( ( ?> . ("\\([^\\]\\|^\\)<" . "[^ \\n\\t_^-]\\s-*>\\|[_^-]\\s-*[-^]\\s-*>"))
;; a b c->, a b c^> and a b c_> are not close-angle-brackets, they're accents
;; but a b c^-> and a b c^^> are close brackets with tenuto/marcato before them
;; also \> and \< are hairpins
(let ( (test-point (point))
(level 0) )
(save-excursion
- (if (or (and (= (char-after (point)) ?\()
+ (if (or (and (/= (point) (point-max))
+ (= (char-after (point)) ?\()
(or (= (char-after (- (point) 1)) ?#)
(and (= (char-after (- (point) 2)) ?#)
(= (char-after (- (point) 1)) ?`))))