comparison lisp/simple.el @ 12893:3ae9326907aa

(blink-matching-paren-dont-ignore-comments): New var. (blink-matching-open): Use it. Also, if the matching char hasn't paren syntax, call that mismatch.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Aug 1995 16:59:43 +0000
parents 7e28ff12e682
children 1fc5a2981547
comparison
equal deleted inserted replaced
12892:8b902b24d749 12893:3ae9326907aa
2609 "*If non-nil, is maximum distance to search for matching open-paren.") 2609 "*If non-nil, is maximum distance to search for matching open-paren.")
2610 2610
2611 (defconst blink-matching-delay 1 2611 (defconst blink-matching-delay 1
2612 "*The number of seconds that `blink-matching-open' will delay at a match.") 2612 "*The number of seconds that `blink-matching-open' will delay at a match.")
2613 2613
2614 (defconst blink-matching-paren-dont-ignore-comments nil
2615 "*Non-nil means `blink-matching-paren' should not ignore comments.")
2616
2614 (defun blink-matching-open () 2617 (defun blink-matching-open ()
2615 "Move cursor momentarily to the beginning of the sexp before point." 2618 "Move cursor momentarily to the beginning of the sexp before point."
2616 (interactive) 2619 (interactive)
2617 (and (> (point) (1+ (point-min))) 2620 (and (> (point) (1+ (point-min)))
2618 blink-matching-paren 2621 blink-matching-paren
2630 (if blink-matching-paren-distance 2633 (if blink-matching-paren-distance
2631 (narrow-to-region (max (point-min) 2634 (narrow-to-region (max (point-min)
2632 (- (point) blink-matching-paren-distance)) 2635 (- (point) blink-matching-paren-distance))
2633 oldpos)) 2636 oldpos))
2634 (condition-case () 2637 (condition-case ()
2635 (setq blinkpos (scan-sexps oldpos -1)) 2638 (let ((parse-sexp-ignore-comments
2639 (and parse-sexp-ignore-comments
2640 (not blink-matching-paren-dont-ignore-comments))))
2641 (setq blinkpos (scan-sexps oldpos -1)))
2636 (error nil))) 2642 (error nil)))
2637 (and blinkpos (/= (char-syntax (char-after blinkpos)) 2643 (and blinkpos
2638 ?\$) 2644 (/= (char-syntax (char-after blinkpos))
2645 ?\$)
2639 (setq mismatch 2646 (setq mismatch
2640 (/= (char-after (1- oldpos)) 2647 (or (null (matching-paren (char-after blinkpos)))
2641 (matching-paren (char-after blinkpos))))) 2648 (/= (char-after (1- oldpos))
2649 (matching-paren (char-after blinkpos))))))
2642 (if mismatch (setq blinkpos nil)) 2650 (if mismatch (setq blinkpos nil))
2643 (if blinkpos 2651 (if blinkpos
2644 (progn 2652 (progn
2645 (goto-char blinkpos) 2653 (goto-char blinkpos)
2646 (if (pos-visible-in-window-p) 2654 (if (pos-visible-in-window-p)