]> git.donarmstrong.com Git - lilypond.git/blobdiff - lilypond-mode.el
release commit
[lilypond.git] / lilypond-mode.el
index 468f042bc2ae11b619935f1fe889a50fbcd7c669..a5706faaddc514fad1265b2d2aab29ffe82240e5 100644 (file)
@@ -3,9 +3,9 @@
 ;;;
 ;;; source file of the GNU LilyPond music typesetter
 ;;;  
-;;; (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
+;;; (c)  1999--2003 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; 
-;;; Changed 2001--2002 Heikki Junes <heikki.junes@hut.fi>
+;;; Changed 2001--2003 Heikki Junes <heikki.junes@hut.fi>
 ;;;    * Add PS-compilation, PS-viewing and MIDI-play (29th Aug 2001)
 ;;;    * Keyboard shortcuts (12th Sep 2001)
 ;;;    * Inserting tags, inspired on sgml-mode (11th Oct 2001)
@@ -26,7 +26,7 @@
 (require 'easymenu)
 (require 'compile)
 
-(defconst LilyPond-version "1.7.9"
+(defconst LilyPond-version "1.7.12"
   "`LilyPond-mode' version number.")
 
 (defconst LilyPond-help-address "bug-lilypond@gnu.org"
@@ -65,17 +65,20 @@ Finds file lilypond-words from load-path."
       (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 "Error (shown for 12 seconds; press a key to skip):\n\n File `lilypond.words' containing keywords to be autocompleted and fontified,\n was not found. Place it to your `load-path' (see `lilypond-init.el').\n")
+              (sit-for 12 0 1)))
     fn))
 
 (defun LilyPond-add-dictionary-word (x)
-  "Contains all words: keywords, identifiers, reserved words."
+  "Contains all words: \keywords \Identifiers and ReservedWords."
   (nconc '(("" . 1)) x))
 
 ;; creates dictionary if empty
-(if (eq (length (LilyPond-add-dictionary-word ())) 1)
+(if (and (eq (length (LilyPond-add-dictionary-word ())) 1)
+        (not (eq (LilyPond-words-filename) nil)))
     (progn
-      (setq fn (LilyPond-words-filename))
-      (setq b (find-file-noselect fn t t))
+      (setq b (find-file-noselect (LilyPond-words-filename) t t))
       (setq m (set-marker (make-marker) 1 (get-buffer b)))
       (setq i 1)
       (while (> (buffer-size b) (marker-position m))
@@ -95,6 +98,8 @@ Finds file lilypond-words from load-path."
                     (string-equal (downcase (car co)) (car co)))
                (add-to-list 'wordlist (car co))))
        (setq co (cdr co)))
+      (if (eq (length wordlist) 0)
+         (setq wordlist '("\\score"))) ; add \keywords to lilypond.words
       wordlist))
   "LilyPond \\keywords")
 
@@ -108,6 +113,8 @@ Finds file lilypond-words from load-path."
                     (not (string-equal (downcase (car co)) (car co))))
                (add-to-list 'wordlist (car co))))
        (setq co (cdr co)))
+      (if (eq (length wordlist) 0)
+         (setq wordlist '("\\voiceOne"))) ; add \Identifiers to lilypond.words
       wordlist))
   "LilyPond \\Identifiers")
 
@@ -120,6 +127,8 @@ Finds file lilypond-words from load-path."
            (if (not (string-equal "\\" (substring (car co) 0 1)))
                (add-to-list 'wordlist (car co))))
        (setq co (cdr co)))
+      (if (eq (length wordlist) 0)
+         (setq wordlist '("Staff"))) ; add ReservedWords to lilypond.words
       wordlist))
   "LilyPond ReservedWords")
 
@@ -574,8 +583,9 @@ command."
                                                (apply file nil)))
              (jobs nil)
              (job-string "no jobs"))
-         (if (string-equal name "View")
-             (let ((buffer-xdvi (get-buffer-create "*view*")))
+         (if (member name (list "View" "ViewPS"))
+             ;; is USR1 a right signal for viewps?
+             (let ((buffer-xdvi (get-buffer-create (concat "*" name "*"))))
                (if LilyPond-kick-xdvi
                  (let ((process-xdvi (get-buffer-process buffer-xdvi)))
                    (if process-xdvi