]> git.donarmstrong.com Git - lilypond.git/commitdiff
* buildscripts/lilypond.words.py: remove.
authorHeikki Junes <heikki.junes@hut.fi>
Mon, 22 Mar 2004 22:21:55 +0000 (22:21 +0000)
committerHeikki Junes <heikki.junes@hut.fi>
Mon, 22 Mar 2004 22:21:55 +0000 (22:21 +0000)
        * buildscripts/lilypond-words.py: add new, renamed file.
        Give generated targets and dirs explicitly in arguments.

        * GNUmakefile.in, elisp/GNUmakefile, elisp/lilypond-init.el,
        elisp/lilypond-mode.el, vim/lilypond-ftplugin.vim,
        vim/lilypond-syntax.vim: update to use new lilypond-words.py.

        * config.make.in: give '/usr/share/vim' explicitly as $(vimdir).

        * vim/GNUmake use --words and --vim targets in lilypond-words.py

ChangeLog
GNUmakefile.in
buildscripts/lilypond-words.py [new file with mode: 0755]
buildscripts/lilypond.words.py [deleted file]
config.make.in
elisp/GNUmakefile
elisp/lilypond-init.el
elisp/lilypond-mode.el
vim/GNUmakefile
vim/lilypond-ftplugin.vim
vim/lilypond-syntax.vim

index 467c785ceeb44c4c134d9a1435c1fffea4d7fd3f..d1cc15defb07a02191cf839cfe0b545b51ced032 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2004-03-23  Heikki Junes  <hjunes@cc.hut.fi>
+
+       * buildscripts/lilypond.words.py: remove.
+       * buildscripts/lilypond-words.py: add new, renamed file. 
+       Give generated targets and dirs explicitly in arguments.
+
+       * GNUmakefile.in, elisp/GNUmakefile, elisp/lilypond-init.el,
+       elisp/lilypond-mode.el, vim/lilypond-ftplugin.vim,
+       vim/lilypond-syntax.vim: update to use new lilypond-words.py.
+       
+       * config.make.in: give '/usr/share/vim' explicitly as $(vimdir).
+
+       * vim/GNUmakefile: use --words and --vim targets in lilypond-words.py
+
 2004-03-22  Heikki Junes  <hjunes@cc.hut.fi>
 
         * config.make.in: add vimdir.
index e2b3bcc097cdad1178b11ed8179fdb86dbc5718c..7160e393a660bd0340954f536ae3488aee36501a 100644 (file)
@@ -121,7 +121,7 @@ $(builddir)/share/lilypond-force:
                ln -s ../../../mf/$(outconfbase) tfm && \
                ln -s ../../../mf/$(outconfbase) type1
        cd $(builddir)/share/lilypond/elisp && \
-               ln -sf ../../../elisp/$(outconfbase)/lilypond.words.el . && \
+               ln -sf ../../../elisp/$(outconfbase)/lilypond-words.el . && \
                ln -s $(abs-srcdir)/elisp/*.el .
        $(foreach i,$(CATALOGS), \
                mkdir -p $(builddir)/share/locale/$i/LC_MESSAGES && \
diff --git a/buildscripts/lilypond-words.py b/buildscripts/lilypond-words.py
new file mode 100755 (executable)
index 0000000..6c3e429
--- /dev/null
@@ -0,0 +1,212 @@
+#!@PYTHON@
+
+# Created 01 September 2003 by Heikki Junes.
+# Generates lilypond-words.el for (X)Emacs and lilypond-words[.vim] for Vim.
+
+import string
+import re
+import sys
+
+kw = []
+rw = []
+notes = []
+
+# keywords not otherwise found
+for line in ['include','maininput','version']:
+    kw = kw + [line]
+
+# the main keywords
+F = open('lily/my-lily-lexer.cc', 'r')
+for line in F.readlines():
+    m = re.search(r"(\s*{\")(.*)(\",\s*.*},\s*\n)",line)
+    if m:
+       kw = kw + [m.group(2)]
+F.close()
+
+# keywords in markup
+F = open('scm/new-markup.scm', 'r')
+for line in F.readlines():
+    m = re.search(r"^(\s*\(cons\s*)([a-z-]*)(-markup)",line)
+    if m:
+       kw = kw + [m.group(2)]
+F.close()
+
+# identifiers and keywords
+for name in [
+'ly/a4-init.ly',
+'ly/chord-modifiers-init.ly',
+'ly/dynamic-scripts-init.ly',
+'ly/engraver-init.ly',
+'ly/grace-init.ly',
+'ly/gregorian-init.ly',
+'ly/performer-init.ly',
+'ly/property-init.ly',
+'ly/scale-definitions-init.ly',
+'ly/script-init.ly',
+'ly/spanners-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+        m = re.search(r"^([a-zA-Z]+)(\s*=)",line)
+        if m:
+           kw = kw + [m.group(1)]
+    F.close()
+
+# more identifiers
+for name in [
+'ly/declarations-init.ly',
+'ly/params-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+        m = re.search(r"^(\s*)([a-zA-Z]+)(\s*=)",line)
+        if m:
+           kw = kw + [m.group(2)]
+    F.close()
+
+# note names
+for name in [
+'ly/catalan.ly',
+'ly/deutsch.ly',
+'ly/drumpitch-init.ly',
+'ly/english.ly',
+'ly/espanol.ly',
+'ly/italiano.ly',
+'ly/nederlands.ly',
+'ly/norsk.ly',
+'ly/suomi.ly',
+'ly/svenska.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+       m = re.search(r"^(\s*\()([a-z]+)([^l]+ly:make-pitch)",line)
+       if m:
+           notes = notes + ['' + m.group(2)]
+    F.close()
+
+
+    
+# reserved words
+for name in [
+'ly/engraver-init.ly',
+'ly/performer-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+       for pattern in [
+       r"^(\s*.consists\s+\")([a-zA-Z_]+)(\")",
+       r"([\\]name\s+[\"]?)([a-zA-Z_]+)([\"]?)",
+       r"(\s+)([a-zA-Z_]+)(\s*[\\]((set)|(override)))",
+       ]:
+           m = re.search(pattern,line)
+           if m:
+               rw = rw + ['' + m.group(2)]
+    F.close()
+
+# the output file
+outdir = '.';
+suffix = ['skip','skip','skip'];
+outs  = ['','',''];
+for s in sys.argv[1:]:
+    if s == '--words':
+        suffix[0] = '';
+    if s == '--el':
+        suffix[1] = '.el';
+    if s == '--vim':
+        suffix[2] = '.vim';
+    m = re.search(r"(--dir=)(\S*)",s)
+    if m:
+        outdir = m.group(2)
+
+if '' in suffix:
+    outs[0] = open(outdir+'/lilypond-words'+suffix[0], 'w')
+if '.el' in suffix:
+    outs[1] = open(outdir+'/lilypond-words'+suffix[1], 'w')
+if '.vim' in suffix:
+    outs[2] = open(outdir+'/lilypond-words'+suffix[2], 'w')
+
+# alphabetically ordered words
+kw.sort()
+kw.reverse()
+prevline = ''
+if '.vim' in suffix:
+  outs[2].write('syn match lilyKeyword \"[-_^]\\?\\\\\\(');
+for line in kw:
+    if line != prevline:
+       if '' in suffix:
+           outs[0].write('\\\\' + line + '\n')
+        if '.el' in suffix:
+           outs[1].write('\\\\' + line + '\n')
+        if '.vim' in suffix:
+           outs[2].write(line + '\\|')
+    prevline = line
+if '.vim' in suffix:
+    outs[2].write('n\\)\\(\\A\\|\\n\\)\"me=e-1\n')
+
+rw.sort()
+rw.reverse()
+prevline = ''
+if '.vim' in suffix:
+    outs[2].write('syn match lilyReservedWord \"\\(\\A\\|\\n\\)\\(')
+for line in rw:
+    if line != prevline:
+        if '' in suffix:
+            outs[0].write(line + '\n')
+        if '.el' in suffix:
+            outs[1].write(line + '\n')
+        if '.vim' in suffix:
+           outs[2].write(line + '\\|')
+    prevline = line
+if '.vim' in suffix:
+    outs[2].write('Score\\)\\(\\A\\|\\n\\)\"ms=s+1,me=e-1\n')
+
+notes.sort()
+notes.reverse()
+prevline = ''
+if '.vim' in suffix:
+    outs[2].write('syn match lilyNote \"\\<\\(\\(\\(');
+for line in notes:
+    if line != prevline:
+        if '' in suffix:
+            outs[0].write(line + '\n')
+        if '.el' in suffix:
+            outs[1].write(line + '\n')
+        if '.vim' in suffix:
+           outs[2].write(line + '\\|')
+    prevline = line
+if '.vim' in suffix:
+    outs[2].write('a\\)\\([,\']\\)\\{,4}\\([?!]\\)\\?\\)\\|s\\|r\\)\\(\\(128\\|64\\|32\\|16\\|8\\|4\\|2\\|1\\|\\\\breve\\|\\\\longa\\|\\\\maxima\\)[.]\\{,8}\\)\\?\\(\\A\\|\\n\\)\"me=e-1\n')
+
+# the menu in lilypond-mode.el
+for line in [
+'/( - _ /) -',
+'/[ - _ /] -',
+'< - _ > -',
+'<< - _ >> -',
+'///( - _ ///) -',
+'///[ - _ ///] -',
+'///< - _ ///! -',
+'///> - _ ///! -',
+'//center - / << _ >> -',
+'//column - / << _ >> -',
+'//context/ Staff/ = - % { _ } -',
+'//context/ Voice/ = - % { _ } -',
+'//markup - { _ } -',
+'//notes - { _ } -',
+'//relative - % { _ } -',
+'//score - { //n /? //simultaneous { //n _ //n } /! //n //paper {  } //n /? //midi {  } //n /! } //n -',
+'//simultaneous - { _ } -',
+'//sustainDown - _ //sustainUp -',
+'//times - % { _ } -',
+'//transpose - % { _ } -',
+]:
+    # urg. escape char '/' is replaced with '\\' which python writes as a '\'.
+    if '.el' in suffix:
+        outs[1].write(string.join(string.split(line,'/'),'\\') + '\n')
+if '' in suffix:
+    outs[0].close()
+if '.el' in suffix:
+    outs[1].close()
+if '.vim' in suffix:
+    outs[2].close()
diff --git a/buildscripts/lilypond.words.py b/buildscripts/lilypond.words.py
deleted file mode 100755 (executable)
index 0de3329..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-#!@PYTHON@
-
-# Created 01 September 2003 by Heikki Junes.
-# Generates lilypond.words.el for (X)Emacs and lilypond.words.vim for Vim.
-
-import string
-import re
-import sys
-
-kw = []
-rw = []
-notes = []
-
-# keywords not otherwise found
-for line in ['include','maininput','version']:
-    kw = kw + [line]
-
-# the main keywords
-F = open('lily/my-lily-lexer.cc', 'r')
-for line in F.readlines():
-    m = re.search(r"(\s*{\")(.*)(\",\s*.*},\s*\n)",line)
-    if m:
-       kw = kw + [m.group(2)]
-F.close()
-
-# keywords in markup
-F = open('scm/new-markup.scm', 'r')
-for line in F.readlines():
-    m = re.search(r"^(\s*\(cons\s*)([a-z-]*)(-markup)",line)
-    if m:
-       kw = kw + [m.group(2)]
-F.close()
-
-# identifiers and keywords
-for name in [
-'ly/a4-init.ly',
-'ly/chord-modifiers-init.ly',
-'ly/dynamic-scripts-init.ly',
-'ly/engraver-init.ly',
-'ly/grace-init.ly',
-'ly/gregorian-init.ly',
-'ly/performer-init.ly',
-'ly/property-init.ly',
-'ly/scale-definitions-init.ly',
-'ly/script-init.ly',
-'ly/spanners-init.ly',
-]:
-    F = open(name, 'r')
-    for line in F.readlines():
-        m = re.search(r"^([a-zA-Z]+)(\s*=)",line)
-        if m:
-           kw = kw + [m.group(1)]
-    F.close()
-
-# more identifiers
-for name in [
-'ly/declarations-init.ly',
-'ly/params-init.ly',
-]:
-    F = open(name, 'r')
-    for line in F.readlines():
-        m = re.search(r"^(\s*)([a-zA-Z]+)(\s*=)",line)
-        if m:
-           kw = kw + [m.group(2)]
-    F.close()
-
-# note names
-for name in [
-'ly/catalan.ly',
-'ly/deutsch.ly',
-'ly/drumpitch-init.ly',
-'ly/english.ly',
-'ly/espanol.ly',
-'ly/italiano.ly',
-'ly/nederlands.ly',
-'ly/norsk.ly',
-'ly/suomi.ly',
-'ly/svenska.ly',
-]:
-    F = open(name, 'r')
-    for line in F.readlines():
-       m = re.search(r"^(\s*\()([a-z]+)([^l]+ly:make-pitch)",line)
-       if m:
-           notes = notes + ['' + m.group(2)]
-    F.close()
-
-
-    
-# reserved words
-for name in [
-'ly/engraver-init.ly',
-'ly/performer-init.ly',
-]:
-    F = open(name, 'r')
-    for line in F.readlines():
-       for pattern in [
-       r"^(\s*.consists\s+\")([a-zA-Z_]+)(\")",
-       r"([\\]name\s+[\"]?)([a-zA-Z_]+)([\"]?)",
-       r"(\s+)([a-zA-Z_]+)(\s*[\\]((set)|(override)))",
-       ]:
-           m = re.search(pattern,line)
-           if m:
-               rw = rw + ['' + m.group(2)]
-    F.close()
-
-# the output file
-if sys.argv[1:] == []:
-  out_el = open('lilypond.words.el', 'w')
-  out_vim = open('lilypond.words.vim', 'w')
-else:
-  out_el = open(sys.argv[1]+'/lilypond.words.el', 'w')
-  out_vim = open(sys.argv[1]+'/lilypond.words.vim', 'w')
-   
-# alphabetically ordered words
-kw.sort()
-kw.reverse()
-prevline = ''
-out_vim.write('syn match lilyKeyword \"[-_^]\\?\\\\\\(');
-for line in kw:
-    if line != prevline:
-        out_el.write('\\\\' + line + '\n')
-       out_vim.write(line + '\\|')
-    prevline = line
-out_vim.write('n\\)\\(\\A\\|\\n\\)\"me=e-1\n')
-
-rw.sort()
-rw.reverse()
-prevline = ''
-out_vim.write('syn match lilyReservedWord \"\\(\\A\\|\\n\\)\\(');
-for line in rw:
-    if line != prevline:
-        out_el.write(line + '\n')
-       out_vim.write(line + '\\|')
-    prevline = line
-out_vim.write('Score\\)\\(\\A\\|\\n\\)\"ms=s+1,me=e-1\n')
-
-notes.sort()
-notes.reverse()
-prevline = ''
-out_vim.write('syn match lilyNote \"\\<\\(\\(\\(');
-for line in notes:
-    if line != prevline:
-        out_el.write(line + '\n')
-       out_vim.write(line + '\\|')
-    prevline = line
-out_vim.write('a\\)\\([,\']\\)\\{,4}\\([?!]\\)\\?\\)\\|s\\|r\\)\\(\\(128\\|64\\|32\\|16\\|8\\|4\\|2\\|1\\|\\\\breve\\|\\\\longa\\|\\\\maxima\\)[.]\\{,8}\\)\\?\\(\\A\\|\\n\\)\"me=e-1\n')
-
-# the menu in lilypond-mode.el
-for line in [
-'/( - _ /) -',
-'/[ - _ /] -',
-'< - _ > -',
-'<< - _ >> -',
-'///( - _ ///) -',
-'///[ - _ ///] -',
-'///< - _ ///! -',
-'///> - _ ///! -',
-'//center - / << _ >> -',
-'//column - / << _ >> -',
-'//context/ Staff/ = - % { _ } -',
-'//context/ Voice/ = - % { _ } -',
-'//markup - { _ } -',
-'//notes - { _ } -',
-'//relative - % { _ } -',
-'//score - { //n /? //simultaneous { //n _ //n } /! //n //paper {  } //n /? //midi {  } //n /! } //n -',
-'//simultaneous - { _ } -',
-'//sustainDown - _ //sustainUp -',
-'//times - % { _ } -',
-'//transpose - % { _ } -',
-]:
-    # urg. escape char '/' is replaced with '\\' which python writes as a '\'.
-    out_el.write(string.join(string.split(line,'/'),'\\') + '\n')
-out_el.close()
-out_vim.close()
index a48fac837bea08ed34b917e254f1eacd3d0f9466..6e86d2e9fbff517a9ee2fd0128e34553ad7da278 100644 (file)
@@ -37,7 +37,8 @@ stepmake = @stepmake@
 docdir = $(datadir)/doc/
 omfdir = $(datadir)/omf/
 elispdir = $(datadir)/emacs/site-lisp
-vimdir = $(datadir)/vim
+vimdir = /usr/share/vim
+# forced instead of $(datadir)/vim
 
 # move out of config.make.in?
 package_datadir = $(datadir)/$(package)
index 09e23a203ddb228e85f8a6ff206071b2defc36e4..b68847804c1862dadba09f33d42b10137b3db896 100644 (file)
@@ -6,20 +6,20 @@ INSTALLATION_DIR=$(elispdir)
 INSTALLATION_FILES=$(EL_FILES)
 
 INSTALLATION_OUT_DIR=$(elispdir)
-INSTALLATION_OUT_FILES=$(outdir)/lilypond.words.el
+INSTALLATION_OUT_FILES=$(outdir)/lilypond-words.el
 
 STEPMAKE_TEMPLATES=elisp install install-out
 
 include $(depth)/make/stepmake.make 
 
-LILYPOND_WORDS = $(outdir)/lilypond.words.el $(outdir)/lilypond.words.vim
+LILYPOND_WORDS = $(outdir)/lilypond-words.el
 LILYPOND_WORDS_DEPENDS =\
   $(topdir)/lily/my-lily-lexer.cc \
-  $(buildscript-dir)/lilypond.words.py \
+  $(buildscript-dir)/lilypond-words.py \
   $(topdir)/scm/new-markup.scm \
   $(topdir)/ly/engraver-init.ly
 
 $(LILYPOND_WORDS): 
-       cd $(topdir) && $(PYTHON) buildscripts/lilypond.words.py $(builddir)/elisp/$(outconfbase)
+       cd $(topdir) && $(PYTHON) buildscripts/lilypond-words.py --el --dir=$(builddir)/elisp/$(outconfbase)
 
 all: $(LILYPOND_WORDS)
index 960c886aa5a0cfdb7cc3893aff13bc7fca145796..be841c2654cdad0a0da2167265fa573bd92d3b34 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Emacs mode for entering music and running LilyPond is contained in
 ;; the source archive as `lilypond-mode.el', `lilypond-indent.el',
-;; `lilypond-font-lock.el' and `lilypond.words.el'. You should install 
+;; `lilypond-font-lock.el' and `lilypond-words.el'. You should install 
 ;; these files to a directory included in your `load-path'. 
 ;; File `lilypond-init.el' should be placed to `load-path/site-start.d/' 
 ;; or appended to your `~/.emacs' or `~/.emacs.el'. 
index fb53bb0358298394b5203c3232b9d004c3ff44ae..0087f59636f883bf7cafa3b4c929dade41c683de 100644 (file)
 Finds file lilypond-words.el from load-path."
   (let ((fn nil)
        (lp load-path)
-       (words-file "lilypond.words.el"))
+       (words-file "lilypond-words.el"))
     (while (and (> (length lp) 0) (not fn))
       (setq fn (concat (car lp) "/" words-file))
       (if (not (file-readable-p fn)) 
          (progn (setq fn nil) (setq lp (cdr lp)))))
     (if (not fn)
-       (progn (message "Warning: `lilypond.words.el' not found in `load-path'. See `lilypond-init.el'.")
+       (progn (message "Warning: `lilypond-words.el' not found in `load-path'. See `lilypond-init.el'.")
               (sit-for 5 0)))
     fn))
 
index b645e678c3800f11e9b6237485c6e9a3a6c600bd..189d61e4b4a5baaf5f85d7d72b52b3d8596b2bbd 100644 (file)
@@ -1,5 +1,11 @@
 depth = ..
 
+INSTALLATION_OUT_DIR=$(vimdir)/syntax
+INSTALLATION_OUT_FILES=$(LILYPOND_WORDS)
+# $(outdir)/lilypond-words $(outdir)/lilypond-words.el
+
+STEPMAKE_TEMPLATES=install-out
+
 # vimdir defined in config.make
 include $(depth)/make/stepmake.make 
 
@@ -20,3 +26,16 @@ local-install:
        $(INSTALL) lilypond-syntax.vim $(vimdir)/syntax/lilypond.vim
 
 EXTRA_DIST_FILES=filetype.vim
+
+LILYPOND_WORDS = $(outdir)/lilypond-words $(outdir)/lilypond-words.vim
+LILYPOND_WORDS_DEPENDS =\
+  $(topdir)/lily/my-lily-lexer.cc \
+  $(buildscript-dir)/lilypond-words.py \
+  $(topdir)/scm/new-markup.scm \
+  $(topdir)/ly/engraver-init.ly
+
+$(LILYPOND_WORDS): 
+       cd $(topdir) && $(PYTHON) buildscripts/lilypond-words.py --words --vim --dir=$(builddir)/vim/$(outconfbase)
+
+all: $(LILYPOND_WORDS)
+
index fa69f49ebda260693c307be185774feedb989761..2a2a580159f21304a55d0b6bf50210630994aa8b 100644 (file)
@@ -4,7 +4,7 @@
 " Last Change:  2004 March 1
 "
 " Installed As:        vim/ftplugin/lilypond.vim
-" Uses Generated File: vim/syntax/lilypond.words.el
+" Uses Generated File: vim/syntax/lilypond-words.el
 "
 " Only do this when not done yet for this buffer
 if exists("b:did_ftplugin")
@@ -54,7 +54,7 @@ map <buffer> <F12> :g!/%.*/normal 0i%<Return>
 map <buffer> <S-F12> :g/%.*/normal 0x<Return>
 "
 " Completions in Insert/Replace-mode with <Ctrl-N>
-setlocal dictionary-=~/.vim/syntax/lilypond.words.el dictionary+=~/.vim/syntax/lilypond.words.el
+setlocal dictionary-=$VIM/syntax/lilypond-words dictionary+=$VIM/syntax/lilypond-words
 setlocal complete-=k complete+=k
 "
 setlocal showmatch
index 7874f6eeb2c75d7f55fbfddf2091b0d188555771..9808176736db77217b746b1741c7fd397208a5cc 100644 (file)
@@ -6,7 +6,7 @@
 " Version:     6.1-1
 "
 " Installed As:        vim/syntax/lilypond.vim
-" Uses Generated File: vim/syntax/lilypond.words.vim
+" Uses Generated File: vim/syntax/lilypond-words.vim
 "
 " For version 5.x: Clear all syntax items
 " For version 6.x: Quit when a syntax file was already loaded
@@ -19,9 +19,9 @@ endif
 " Read the LilyPond syntax match groups: 
 "   lilyKeyword, lilyReservedWord, lilyNote
 if version < 600
-  so <sfile>:p:h/lilypond.words.vim
+  so <sfile>:p:h/lilypond-words.vim
 else
-  runtime! syntax/lilypond.words.vim
+  runtime! syntax/lilypond-words.vim
   if exists("b:current_syntax")
     unlet b:current_syntax
   endif