From c1afec124c13653f8814abadadfdd8a5356e1653 Mon Sep 17 00:00:00 2001 From: Heikki Junes Date: Thu, 22 May 2003 22:30:48 +0000 Subject: [PATCH] add a warning about matching \] or \) --- ChangeLog | 4 ++++ lilypond-indent.el | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5bec0876f..9e16cb8853 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-05-22 Heikki Junes + + * lilypond-indent.el: Add a message about trying to match \] or \). + 2003-05-22 Juergen Reuter * input/test/gregorian-scripts.ly, input/test/vaticana.ly: removed obsolete "arithmetic_*" diff --git a/lilypond-indent.el b/lilypond-indent.el index 21cd641244..bfa2941844 100644 --- a/lilypond-indent.el +++ b/lilypond-indent.el @@ -378,16 +378,20 @@ slur-paren-p defaults to nil. ;;; Largely taken from the 'blink-matching-open' in lisp/simple.el in ;;; the Emacs distribution. -(defun LilyPond-blink-matching-open (bracket-type) +(defun LilyPond-blink-matching-open (bracket-type char-before-bracket-type) "Move cursor momentarily to the beginning of the sexp before -point. In lilypond files this is used for closing ), } and >, whereas the -builtin 'blink-matching-open' is used for closing ], which is in -the syntax table" +point. In lilypond files this is used for closing ), ], } and >, whereas the +builtin 'blink-matching-open' is not used. In syntax table, see +`lilypond-font-lock.el', all brackets are punctuation characters." ;;; An user does not call this function directly, or by a key sequence. ;; (interactive) (let ( (oldpos (point)) (level 0) (mismatch) ) + (if (eq char-before-bracket-type ?\\) + (if (eq bracket-type ?]) + (message "trying to match ligatures \\[ ... \\]") + (message "trying to match slurs \\( ... \\)"))) (save-restriction (if blink-matching-paren-distance (narrow-to-region (max (point-min) @@ -455,17 +459,17 @@ the syntax table" ;; the result is now in backslashed-close-char, BUT ;; the result should also be used -- match also \] or \) ! ;; Thus, update: LilyPond-parens-regexp-alist, LilyPond-blink-matching-open - (setq backslashed-close-char nil) + (setq char-before-close-char nil) (if (memq close-char '(?] ?\))) (progn (setq np 0) (while (eq (char-before (- (point) (setq np (+ np 1)))) ?\\) - (setq backslashed-close-char (not backslashed-close-char))))) + (setq char-before-close-char (if char-before-close-char nil ?\\))))) (if (and blink-matching-paren (not (LilyPond-inside-string-or-comment-p)) (save-excursion (re-search-backward (concat (mapconcat 'cdr (mapcar 'cdr LilyPond-parens-regexp-alist) "\\|") "\\|)") nil t) (eq oldpos (1- (match-end 0))))) (progn (backward-char 1) - (LilyPond-blink-matching-open close-char) + (LilyPond-blink-matching-open close-char char-before-close-char) (forward-char 1))))) -- 2.39.5