From c672ff3b3f03c01a94c7fd0b2575e222ebff79d9 Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 18 Apr 2002 12:28:22 +0000 Subject: [PATCH] heiki pats --- ChangeLog | 7 ++++ Documentation/topdocs/FAQ.texi | 5 ++- VERSION | 2 +- lily/ligature-bracket.cc | 2 +- lilypond-font-lock.el | 70 ++++++++++++++++++++++------------ lilypond-mode.el | 7 +++- 6 files changed, 63 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c3b969439..9c05fe3d54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-04-18 Heikki Junes + + * lilypond-mode.el: Toggles font-lock-multiline (Emacs 21.1 or newer). + + * lilypond-font-lock.el: Handles multiline-strings. Fontifies notes + more strictly. Use more clever regular expressions. Commented regexps. + 2002-04-16 Heikki Junes * lilypond-mode.el: "C-c f" does font-lock-fontify-buffer. diff --git a/Documentation/topdocs/FAQ.texi b/Documentation/topdocs/FAQ.texi index 28d15edd69..8c7586f6e1 100644 --- a/Documentation/topdocs/FAQ.texi +++ b/Documentation/topdocs/FAQ.texi @@ -27,11 +27,12 @@ FAQs}. Also, please look in the searchable mailinglist archives: @itemize @bullet @item -@uref{http://www.mail-archive.com/help-gnu-music@@gnu.org,help-gnu-music} +@uref{http://www.mail-archive.com/lilypond-user@@gnu.org,lilypond-user} @item -@uref{http://www.mail-archive.com/bug-gnu-music@@gnu.org,bug-gnu-music} +@uref{http://www.mail-archive.com/bug-lilypond@@gnu.org,bug-lilypond} @item @uref{http://www.mail-archive.com/gnu-music-discuss@@gnu.org,gnu-music-discuss} +(this is the archive of the `old' mailing list.) @end itemize If you are still at loss, send your questions to the @strong{mailing diff --git a/VERSION b/VERSION index c6813374c0..d7c8256c9c 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=5 PATCH_LEVEL=52 -MY_PATCH_LEVEL=hjj4 +MY_PATCH_LEVEL=hjj5 # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/lily/ligature-bracket.cc b/lily/ligature-bracket.cc index ec1e20c3bd..03138e7538 100644 --- a/lily/ligature-bracket.cc +++ b/lily/ligature-bracket.cc @@ -146,4 +146,4 @@ Ligature_bracket::brew_molecule (SCM smob) ADD_INTERFACE(Ligature_bracket, "ligature-bracket-interface", "", - "width height"); + "width thickness height"); diff --git a/lilypond-font-lock.el b/lilypond-font-lock.el index 77a508975f..fc66140a61 100644 --- a/lilypond-font-lock.el +++ b/lilypond-font-lock.el @@ -35,7 +35,7 @@ "alias" "\\(altern\\|rel\\)ative" "apply" "arpeggio" "autochange" "bar" "break" "breathe" "breve" "beamintervals" "broken" "blend" "\\(bc\\|end\\)incipit" "ch\\(ar\\)?" "cg" "chord\\(s\\|stest\\|\\(chord\\)?modifiers\\)?" -"clef[ \t]*\\(F\\|G\\|alto\\|baritone\\|bass\\|\\(mezzo\\)?soprano\\|treble\\|violin\\|tenor\\)?" +"clef[ \t]*\"?\\(F\\|G\\|alto\\|baritone\\|bass\\|\\(mezzo\\)?soprano\\|treble\\|violin\\|tenor\\)?\"?" "clipping" "[cm]m" "coda" "complex" "\\(command\\)?spanrequest" "consists\\(end\\)?" "context" "contrabasso" "\\(de\\)?cr" "default" "denies" "different" "dirs" @@ -117,48 +117,68 @@ ;; font-lock- comment / string / keyword / builtin / function-name / ;; variable-name / type / constant / warning -face +;; The order below is designed so that proofreading would be possible. + +;; Fontify... +;; ... first identifiers and keywords. +;; ... then other expressions having '\'-mark in the beginning. +;; ... the right and the left side of '='-marks. +;; ... reserved words, e.g., FiguredBass. +;; ... notes and rests +;; "on top", 6) ... '<{[]}>'-brackets +;; "on top", 7) ... ties, slurs and hairpins +;; "on top", 8) ... (multiline-)scheme; urgh. one should count the slurs +;; "on top", 9) ... strings +;; "on top", 10) ... (multiline-)comments + +;; One should note 'font-lock-multiline' has been possible since Emacs 21.1. +;; See, e.g., text in "http://emacs.kldp.org/emacs-21.1/etc/NEWS". + +;; ... identifiers (defined above, see iregex) + (cons (concat "\\(\\([_^-]?\\(" iregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-function-name-face)) + +;; ... keywords (defined above, see kwregex) + (cons (concat "\\(\\([_^-]?\\(" kwregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-keyword-face)) + +;; ... keyword-type constructs, e.g., ^\abracadabra '("\\([_^-]?\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-constant-face) + +;; ... the left sid e of '=' -mark '("\\([_a-zA-Z.0-9-]+\\)[ \t]*=[ \t]*" 1 font-lock-variable-name-face) - '("[ \t]*=[ \t]*\\([_a-zA-Z.0-9-]+\\)" 1 font-lock-variable-name-face) +;; ... the right side of '=' -mark + '("[ \t]*=[ \t]*\\([_a-zA-Z.0-9-]+\\)" 1 font-lock-variable-name-face) -;; other reserved words +;; ... reserved words (defined above, see rwregex) (cons (concat "\\(" rwregex "\\)") 'font-lock-variable-name-face) -;; highlight note names; separate notes from (other than ')'-type) brackets - '("\\([sR]\\(128\\|64\\|32\\|16\\|8\\|4\\|2\\|1\\)?[.]*[ \t]*[*][ \t]*[0-9]+\\)"1 font-lock-type-face) - '("[ <\{[~(!)\t\\\|]\\(\\(\\(\\(do\\|re\\|mi\\|fa\\|sol\\|la\\|si\\)\\(bb?\\|dd?\\|ss?\\)?\\)\\|\\([a-hsrR]\\(flat\\(flat\\)?\\|sharp\\(sharp\\)?\\|ff?\\|ss?\\|is\\(siss\\|s\\|is\\)?\\|es\\(sess\\|s\\|es\\)?\\)?\\)\\|\\(as\\(as\\|es\\)?\\)\\|\\(es\\(es\\)?\\)\\|\\(bb\\)\\)[,']*[?!]?\\(128\\|64\\|32\\|16\\|8\\|4\\|2\\|1\\)?[.]*\\)" 1 font-lock-type-face) - -;; highlight identifiers - (cons (concat "\\([_^-]?\\(" iregex "\\)\\)+\\($\\|[] \t(~{}>\\\\_-()^]\\)") '(0 font-lock-function-name-face t)) +;; ... multiplied rests, e.g., R1 *8 + '("\\([sR]\\(128\\|6?4\\|3?2\\|16?\\|8\\)?[.]*[ \t]*[*][ \t]*[0-9]+\\)"1 font-lock-type-face) -;; highlight keywords - (cons (concat "\\([_^-]?\\(" kwregex "\\)\\)+\\($\\|[] \t(~{}>\\\\_-()^]\\)") '(0 font-lock-keyword-face t)) +;; ... notes and rests, accidentals and duration, e.g., a,?16.. + '("\\(^\\|[ <\{[~(!)\t\\\|]\\)\\(\\(\\(\\(\\(do\\|re\\|[ms]i\\|[fl]a\\|sol\\)\\(bb?\\|dd?\\|ss?\\)?\\)\\|\\([a-h]\\(flat\\(flat\\)?\\|sharp\\(sharp\\)?\\|ff?\\|ss?\\|is\\(siss\\|s\\|is\\)?\\|es\\(sess\\|s\\|es\\)?\\)?\\)\\|\\(as\\(as\\|es\\)?\\)\\|\\(es\\(es\\)?\\)\\|\\(bb\\)\\)[,']*[?!]?\\|[srR]\\)\\(128\\|6?4\\|3?2\\|16?\\|8\\)?[.]*\\)" 2 font-lock-type-face) -;; highlight bracketing constructs +;; "on top", ... '{[]}'-brackets '("\\([][}{]\\)" 0 font-lock-warning-face t) - ;; these regexps allow angle-brackets to be highlighted when and only when they delimit simultaneous music - ;; fontify open < but leave crescendos \< alone - '("\\([^\\]\\|^\\)\\(<\\)" 2 font-lock-warning-face t) - ;; fontify the close-brackets in (tenuto) and (marcato) - '("[_^-]\\s-*[-^]\\s-*\\(>\\)" 1 font-lock-warning-face t) - ;; but leave a b c-> (accent) alone, accounting for whitespace - '("\\([^\\t\\n _^-]\\|^\\)\\s-*\\(>\\)" 2 font-lock-warning-face t) - ;; ties ~, slurs \( () \), hairpins \<, \>, end-of-hairpin \!, + +;; "on top", ... '<>'-brackets, not marcato '->' + '("\\(\\(-.\\)+\\|[^-^_]\\)\\([[<>]+\\)" 3 font-lock-warning-face t) + +;; "on top", ... ties ~, slurs \( () \), hairpins \<, \>, \! '("\\(\\\\[()]\\|[(~)]\\)" 0 font-lock-builtin-face t) -;; highlight scheme: handle slurs up to seventh level +;; "on top", ... (multiline-)scheme: try find slurs up to 7th '("[_^-]?#\\(#[ft]\\|-?[0-9.]+\\|\"[^\"]*\"\\|['`]?[a-zA-Z-:]+\\|['`]?([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^)]*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*[^)]*)\\)" 0 font-lock-string-face t) -;; highlight strings: urgh. should hangle strings in strings, i.e., \\\" - '("\\([_^-]?\"[^\"]*\"\\)" 0 font-lock-string-face t) +;; "on top", ... strings + '("\\([_^-]?\"\\([^\"\\\\]\\|\\\\.\\|\\\\\n\\)*\"\\)" 0 font-lock-string-face t) -;; highlight (block) comments; urgh. block comments should be updatable +;; "on top", ... (multiline-)comments '("\\(%\\({[^%]*%\\(}\\|\\([^}][^%]*%\\)+}\\)\\|.*\\)\\)" 0 font-lock-comment-face t) ) ) - "Additional expressions to highlight in LilyPond mode.") + "Additional expressions to fontify in LilyPond mode.") ;; define a mode-specific abbrev table for those who use such things (defvar LilyPond-mode-abbrev-table nil diff --git a/lilypond-mode.el b/lilypond-mode.el index 54efc565dc..5422ed7b35 100644 --- a/lilypond-mode.el +++ b/lilypond-mode.el @@ -656,10 +656,15 @@ LilyPond-xdvi-command\t\tcommand to display dvi files -- bit superfluous" (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(LilyPond-font-lock-keywords)) - ; string and comments are fontified explicitly + ;; string and comments are fontified explicitly (make-local-variable 'font-lock-keywords-only) (setq font-lock-keywords-only t) + ;; Multi-line font-locking needs Emacs 21.1 or newer. + ;; For older versions there is hotkey "C-c f". + (make-local-variable 'font-lock-multiline) + (setq font-lock-multiline t) + (make-local-variable 'paragraph-separate) (setq paragraph-separate "^[ \t]*$") -- 2.39.2