comparison lisp/simple.el @ 85322:806c6643aac5

Re-fill copyright header. (blink-matching-open): Don't report false errors with the `$' syntax class.
author Glenn Morris <rgm@gnu.org>
date Tue, 16 Oct 2007 02:40:28 +0000
parents 40ad182734aa
children 84eaa97c1d65
comparison
equal deleted inserted replaced
85321:6ad0dfc94fff 85322:806c6643aac5
1 ;;; simple.el --- basic editing commands for Emacs 1 ;;; simple.el --- basic editing commands for Emacs
2 2
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
5 ;; Free Software Foundation, Inc.
5 6
6 ;; Maintainer: FSF 7 ;; Maintainer: FSF
7 ;; Keywords: internal 8 ;; Keywords: internal
8 9
9 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
4655 (forward-char -1) 4656 (forward-char -1)
4656 (skip-syntax-backward "/\\") 4657 (skip-syntax-backward "/\\")
4657 (point)))))) 4658 (point))))))
4658 (let* ((oldpos (point)) 4659 (let* ((oldpos (point))
4659 (message-log-max nil) ; Don't log messages about paren matching. 4660 (message-log-max nil) ; Don't log messages about paren matching.
4661 (atdollar (eq (syntax-class (syntax-after (1- oldpos))) 8))
4662 (isdollar)
4660 (blinkpos 4663 (blinkpos
4661 (save-excursion 4664 (save-excursion
4662 (save-restriction 4665 (save-restriction
4663 (if blink-matching-paren-distance 4666 (if blink-matching-paren-distance
4664 (narrow-to-region 4667 (narrow-to-region
4672 (scan-sexps oldpos -1) 4675 (scan-sexps oldpos -1)
4673 (error nil)))))) 4676 (error nil))))))
4674 (matching-paren 4677 (matching-paren
4675 (and blinkpos 4678 (and blinkpos
4676 ;; Not syntax '$'. 4679 ;; Not syntax '$'.
4677 (not (eq (syntax-class (syntax-after blinkpos)) 8)) 4680 (not (setq isdollar
4681 (eq (syntax-class (syntax-after blinkpos)) 8)))
4678 (let ((syntax (syntax-after blinkpos))) 4682 (let ((syntax (syntax-after blinkpos)))
4679 (and (consp syntax) 4683 (and (consp syntax)
4680 (eq (syntax-class syntax) 4) 4684 (eq (syntax-class syntax) 4)
4681 (cdr syntax)))))) 4685 (cdr syntax))))))
4682 (cond 4686 (cond
4683 ((not (or (eq matching-paren (char-before oldpos)) 4687 ;; isdollar is for:
4688 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00871.html
4689 ((not (or (and isdollar blinkpos)
4690 (and atdollar (not blinkpos)) ; see below
4691 (eq matching-paren (char-before oldpos))
4684 ;; The cdr might hold a new paren-class info rather than 4692 ;; The cdr might hold a new paren-class info rather than
4685 ;; a matching-char info, in which case the two CDRs 4693 ;; a matching-char info, in which case the two CDRs
4686 ;; should match. 4694 ;; should match.
4687 (eq matching-paren (cdr (syntax-after (1- oldpos)))))) 4695 (eq matching-paren (cdr (syntax-after (1- oldpos))))))
4688 (message "Mismatched parentheses")) 4696 (message "Mismatched parentheses"))
4689 ((not blinkpos) 4697 ((not blinkpos)
4690 (if (not blink-matching-paren-distance) 4698 (or blink-matching-paren-distance
4699 ;; Don't complain when `$' with no blinkpos, because it
4700 ;; could just be the first one typed in the buffer.
4701 atdollar
4691 (message "Unmatched parenthesis"))) 4702 (message "Unmatched parenthesis")))
4692 ((pos-visible-in-window-p blinkpos) 4703 ((pos-visible-in-window-p blinkpos)
4693 ;; Matching open within window, temporarily move to blinkpos but only 4704 ;; Matching open within window, temporarily move to blinkpos but only
4694 ;; if `blink-matching-paren-on-screen' is non-nil. 4705 ;; if `blink-matching-paren-on-screen' is non-nil.
4695 (and blink-matching-paren-on-screen 4706 (and blink-matching-paren-on-screen