]> git.donarmstrong.com Git - lilypond.git/commitdiff
tune regexp for show-paren-function
authorHeikki Junes <heikki.junes@hut.fi>
Sat, 7 Jun 2003 21:11:01 +0000 (21:11 +0000)
committerHeikki Junes <heikki.junes@hut.fi>
Sat, 7 Jun 2003 21:11:01 +0000 (21:11 +0000)
ChangeLog
lilypond-indent.el

index 390ece3e20abf4936782b5e29601aab45e74bf83..5b9ed9ec4c3e9efafd43f940c86425ad1ffc99e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-08  Heikki Junes  <hjunes@cc.hut.fi>
+
+       * lilypond-indent.el: tune regexp for show-paren-function.
+
 2003-06-07  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scripts/ly2dvi.py (run_latex, run_dvips, 'main'): Make preview
index f98a8d9480cb784d6633211f244844860ab68786..897ea915ce67a8cdfed966d7a86b7b0c3d77242b 100644 (file)
@@ -9,11 +9,7 @@
 ;;; Variables for customising indentation style
 
 ;;; TODO:
-;;;    * emulate show-paren-mode, i.e., highlight the matching bracket if
-;;;      - the cursor is on the matching opening bracket
-;;;      - the cursor is after the matching closing bracket
-;;;    * separate '('- and ')'-slurs from '\('- and '\)'-slurs.
-;;;    * separate '['- and ']'-slurs from '\['- and '\]'-slurs.
+;;;    * fontify emulate show-paren-mode also in XEmacs
 ;;;    * currently, brackets may need a non-bracket char between ( ( ) )
 
 (defcustom LilyPond-indent-level 4
@@ -278,10 +274,11 @@ Argument LIM limit."
 ;; () are treated specially (need to indent in Scheme but not in music)
 
 (defconst LilyPond-parens-regexp-alist
-  `( ( ?>  .  ("\\([^\\]\\|^\\)<" . "[^ \\n\\t_^-]\\s-*>\\|[_^-]\\s-*[-^]\\s-*>"))
+  `( ( ?>  .  ("\\([^\\]\\|^\\)<" . "\\([^ \\n\\t_^-]\\|[_^-][-^]\\|\\s-\\)\\s-*>"))
      ;; a b c->, a b c^> and a b c_> are not close-angle-brackets, they're accents
      ;; but a b c^-> and a b c^^> are close brackets with tenuto/marcato before them
      ;; also \> and \< are hairpins
+     ;; duh .. a single '>', as in chords '<< ... >>', was not matched here
      ( ?}  .  ("{" . "}"))
      ;; ligatures  '\[ ... \]' are skipped in the following expression
      ( ?]  .  ("\\([^\\]\\([\\][\\]\\)*\\|^\\)[[]" . "\\([^\\]\\([\\][\\]\\)*\\|^\\)[]]"))
@@ -352,6 +349,12 @@ slur-paren-p defaults to nil.
                               (LilyPond-inside-string-or-comment-p)))
          (if (memq match '(?} ?> ?] ?\)))
              (progn (setq level (1+ level))
+                    ;; single '<' was not matched .. need to correct
+                    (if (and (eq dir 1) (eq (char-after (match-end 0)) ?>))
+                        (if (/= level 0)
+                            (progn
+                              (setq level (1+ level))
+                              (forward-char 1))))
 ;;;                 (message "%d %c" level match) (sit-for 0 300)
                     (if (and (= match ?>) 
                              (looking-at ".\\s-+>\\|\\({\\|}\\|<\\|>\\|(\\|)\\|[][]\\)>"))
@@ -531,10 +534,6 @@ builtin 'blink-matching-open' is not used. In syntax table, see
                 (min (point-max) (+ (point) blink-matching-paren-distance))))
              ;; Scan across one sexp within that range.
              ;; Errors or nil mean there is a mismatch.
-             ;;; NOTE: HERE IT IS VERY MUCH WRONG
-             ;;; ONE CANNOT USE scan-sexps BECAUSE
-             ;;; BRACKETS ARE NOT IN THE SYNTAX TABLE.
-              ;;; HENCE BY REPLACING THE FOLLOWING IT WILL WORK.
              (condition-case ()
                  (setq pos (LilyPond-blink-matching-paren dir))
                (error (setq pos t mismatch t)))
@@ -619,4 +618,6 @@ builtin 'blink-matching-open' is not used. In syntax table, see
 
 ;; Comment the following line to disable show-paren-function
 ;; Currently, works only in Emacs, should tune for XEmacs
-(defun show-paren-function () (LilyPond-show-paren-function))
+(if (not (string-match "XEmacs\\|Lucid" emacs-version))
+    (defun show-paren-function () (LilyPond-show-paren-function))
+  )