Mercurial > emacs
changeset 59037:d572ad446699
(calcAlg-blank-matching-open): Temporarily adjust the syntax of both
delimiters of half-open intervals.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Sun, 19 Dec 2004 06:59:33 +0000 |
parents | f1a383c1b9cd |
children | f24e718fcc7e |
files | lisp/calc/calc-aent.el |
diffstat | 1 files changed, 30 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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)