# HG changeset patch # User Jay Belanger # Date 1103439573 0 # Node ID d572ad446699472dd0a560565241b05aa98b7284 # Parent f1a383c1b9cdeaeccaf813211b751559cdb5cb5a (calcAlg-blank-matching-open): Temporarily adjust the syntax of both delimiters of half-open intervals. diff -r f1a383c1b9cd -r d572ad446699 lisp/calc/calc-aent.el --- a/lisp/calc/calc-aent.el Sun Dec 19 00:50:51 2004 +0000 +++ b/lisp/calc/calc-aent.el Sun Dec 19 06:59:33 2004 +0000 @@ -410,32 +410,40 @@ (exit-minibuffer)))) (defun calcAlg-blink-matching-open () - (let ((oldpos (point)) - (blinkpos nil)) + (let ((rightpt (point)) + (leftpt nil) + (rightchar (preceding-char)) + leftchar + rightsyntax + leftsyntax) (save-excursion (condition-case () - (setq blinkpos (scan-sexps oldpos -1)) - (error nil))) - (if (and blinkpos - (> oldpos (1+ (point-min))) - (or (and (= (char-after (1- oldpos)) ?\)) - (= (char-after blinkpos) ?\[)) - (and (= (char-after (1- oldpos)) ?\]) - (= (char-after blinkpos) ?\())) - (save-excursion - (goto-char blinkpos) - (looking-at ".+\\(\\.\\.\\|\\\\dots\\|\\\\ldots\\)"))) - (let ((saved (aref (syntax-table) (char-after blinkpos)))) - (unwind-protect - (progn - (aset (syntax-table) (char-after blinkpos) - (+ (logand saved 255) - (lsh (char-after (1- oldpos)) 8))) - (blink-matching-open)) - (aset (syntax-table) (char-after blinkpos) saved))) + (setq leftpt (scan-sexps rightpt -1) + leftchar (char-after leftpt)) + (error nil))) + (if (and leftpt + (or (and (= rightchar ?\)) + (= leftchar ?\[)) + (and (= rightchar ?\]) + (= leftchar ?\())) + (save-excursion + (goto-char leftpt) + (looking-at ".+\\(\\.\\.\\|\\\\dots\\|\\\\ldots\\)"))) + (let ((leftsaved (aref (syntax-table) leftchar)) + (rightsaved (aref (syntax-table) rightchar))) + (unwind-protect + (progn + (cond ((= leftchar ?\[) + (aset (syntax-table) leftchar (cons 4 ?\))) + (aset (syntax-table) rightchar (cons 5 ?\[))) + (t + (aset (syntax-table) leftchar (cons 4 ?\])) + (aset (syntax-table) rightchar (cons 5 ?\()))) + (blink-matching-open)) + (aset (syntax-table) leftchar leftsaved) + (aset (syntax-table) rightchar rightsaved))) (blink-matching-open)))) - (defun calc-alg-digit-entry () (calc-alg-entry (cond ((eq last-command-char ?e)