emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Begging for show-paren change???


From: RGB
Subject: Begging for show-paren change???
Date: Sun, 13 Nov 2005 12:31:09 -0600

Will any amount of begging get me this show-paren change?

I've now got 4 major modes (tal, tacl, ddl, cobol) supporting language
constructs that can't be described by the limited paren matching ability of
show-paren-function in paren.el.

Currently any given character can only match one specific other character.  So
in a simple example, the B of BEGIN can only match the d of End and can't also
match D if END spelled with an upper case D. In tal-mode B & b need to match one of D, d, ;, K, k depending on circumstance while D and d need to match one
of B, b or ;.

Adding the 3 lines below would yield the needed flexibility in a
straightforward way. It allows matching on the value of the syntax cdr itself.
If you think about it, this is probably how it should have worked from the 
start.

The example uses negative numbers to prevent impact to existing code.  Some
positive number range will work, as will (symbolp (cdr (syntax-after beg))).
I've tried all these ways with success.  Anything is fine for me.  I'd like
to be able to finally release these modes in working condition with 22.1.

Example snip from font-lock-syntactic-keywords:

("\\(?:^\\|\\s-\\)\\(d\\)efine\\(?:\\s-\\|$\\)"    (1 (4 . -101)))
("\\(?:^\\|\\s-\\)\\(b\\)egin\\(?:\\s-\\|:\\|$\\)" (1 (4 . -102)))

("#\\(;\\)"                                        (1 (5 . -101)))
("\\(?:\\s-\\|^\\)en\\(d\\)\\b"                    (1 (5 . -102)))


(defun show-paren-function ()
...
                   (setq mismatch
                         (not (or (eq (char-before end)
                                      ;; This can give nil.
                                      (cdr (syntax-after beg)))
                                  (eq (char-after beg)
                                      ;; This can give nil.
                                      (cdr (syntax-after (1- end))))
+>                                 (and (> 0 (+ 0 (cdr (syntax-after beg))))
+>                                      (eq (cdr (syntax-after (1- end)))
+>                                          (cdr (syntax-after beg)))))))))))))

Richard Bielawski






reply via email to

[Prev in Thread] Current Thread [Next in Thread]