matlab.el:

(matlab-show-paren-or-block):
Use `syntax-class' instead of `car' for output of `syntax-after' to get the class.
This strips out high order bits to return the actual syntax #.
This commit is contained in:
Eric Ludlam 2021-03-09 12:06:03 -05:00
parent 7f9c905238
commit 81f2cc0fd7

View file

@ -3503,7 +3503,7 @@ Returns a list: \(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH)"
;; These checks are much faster than regexp ;; These checks are much faster than regexp
;; Step one - check for parens ;; Step one - check for parens
(cond ((and here-syntax (= (car here-syntax) 4)) ; open paren (cond ((and here-syntax (= (syntax-class here-syntax) 4)) ; open paren
(setq here-beg (point) (setq here-beg (point)
here-end (1+ (point))) here-end (1+ (point)))
(condition-case err (condition-case err
@ -3513,14 +3513,14 @@ Returns a list: \(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH)"
there-end (point) there-end (point)
there-syntax (syntax-after there-beg) there-syntax (syntax-after there-beg)
there-char (char-after there-beg)) there-char (char-after there-beg))
(when (or (/= (car there-syntax) 5) (when (or (/= (syntax-class there-syntax) 5)
(/= (cdr there-syntax) here-char) (/= (cdr there-syntax) here-char)
(/= (cdr here-syntax) there-char)) ; this part seems optional (/= (cdr here-syntax) there-char)) ; this part seems optional
;(message "ts = %S hs=%S tc = %d hc = %d" there-syntax here-syntax there-char here-char) ;(message "ts = %S hs=%S tc = %d hc = %d" there-syntax here-syntax there-char here-char)
(setq mismatch t)) (setq mismatch t))
) )
(error (setq mismatch t)))) (error (setq mismatch t))))
((and here-prev-syntax (= (car here-prev-syntax) 5)) ((and here-prev-syntax (= (syntax-class here-prev-syntax) 5))
(setq here-beg (1- (point)) (setq here-beg (1- (point))
here-end (point)) here-end (point))
(condition-case err (condition-case err
@ -3530,7 +3530,7 @@ Returns a list: \(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH)"
there-beg (point) there-beg (point)
there-syntax (syntax-after there-beg) there-syntax (syntax-after there-beg)
there-char (char-after there-beg)) there-char (char-after there-beg))
(when (or (/= (car there-syntax) 4) (when (or (/= (syntax-class there-syntax) 4)
(/= (cdr there-syntax) here-prev-char) (/= (cdr there-syntax) here-prev-char)
(/= (cdr here-prev-syntax) there-char)) ; this part seems optional (/= (cdr here-prev-syntax) there-char)) ; this part seems optional
(setq mismatch t)) (setq mismatch t))
@ -3543,7 +3543,7 @@ Returns a list: \(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH)"
;; word character move back one symbol. This will let ;; word character move back one symbol. This will let
;; us use the block begin / end matchers to figure ;; us use the block begin / end matchers to figure
;; out where we are. ;; out where we are.
(when (and (not (eobp)) (not (bobp)) (= (car here-prev-syntax) 2)) (when (and (not (eobp)) (not (bobp)) (= (syntax-class here-prev-syntax) 2))
(forward-symbol -1)) (forward-symbol -1))
(matlab-navigation-syntax (matlab-navigation-syntax