I made a patch with which skeletons of code can be inserted.
This is first try, hence there are only '\header'- and '\notes'-tags.
I made this, because if one have not used the programs for some time
it is easy to forget the syntax. The idea use either the keyboard
shortcuts or menu commands.

If this is something that you liked, I could make it more
comprehensive.

--------------------------
--- VERSION~    Wed Oct 10 01:33:39 2001
+++ VERSION     Thu Oct 11 03:36:06 2001
@@ -2,7 +2,7 @@
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=16
-MY_PATCH_LEVEL=hjj1
+MY_PATCH_LEVEL=hjj2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
--- CHANGES~    Wed Oct 10 01:33:39 2001
+++ CHANGES     Thu Oct 11 03:44:01 2001
@@ -1,5 +1,7 @@
-1.5.16.hjj1
+1.5.16.hjj2
 ===========
+
+* Emacs-mode: Inserting tags
 
 * Enable python2.1/Python.h
 
--- lilypond-mode.el.orig       Thu Oct 11 03:31:14 2001
+++ lilypond-mode.el    Thu Oct 11 03:42:15 2001
@@ -5,10 +5,10 @@
 ;;; 
 ;;; (c) 1999--2001 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
 ;;; 
-;;; Changed 29th Aug 2001 Heikki Junes <[EMAIL PROTECTED]>
-;;;    * Add PS-compilation, PS-viewing and MIDI-play
-;;; Changed 12th Sep 2001 Heikki Junes
-;;;    * Keyboard shortcuts
+;;; Changed 2001 Heikki Junes <[EMAIL PROTECTED]>
+;;;    * 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)
 
 ;;; Inspired on auctex
 
@@ -426,10 +426,40 @@
   (define-key LilyPond-mode-map "\C-c\C-v" 'LilyPond-command-view)
   (define-key LilyPond-mode-map "\C-c\C-p" 'LilyPond-command-viewps)
   (define-key LilyPond-mode-map "\C-c\C-m" 'LilyPond-command-midi)
+  (define-key LilyPond-mode-map "\C-cn" 'lilypond-notes)
+  (define-key LilyPond-mode-map "\C-cs" 'lilypond-score)
   )
 
 ;;; Menu Support
 
+(define-skeleton lilypond-notes
+  "Lilypond notes tag."
+  nil
+;  (if (bolp) nil ?\n)
+  "\\notes"
+  (if (y-or-n-p "Set \"\\relative\" attribute? ")
+      (concat " \\relative " (skeleton-read "Relative: " "" str)))
+  " { " _ " }")
+
+(define-skeleton lilypond-score
+  "Lilypond score tag."
+  nil
+  (if (bolp) nil ?\n)
+  "\\score {\n"
+  "   " _ "\n"
+  "   \\paper {  }\n"
+  (if (y-or-n-p "Insert \"\\header\" field? ")
+      (concat "   \\header {\n      " 
+             (skeleton-read "Piece: " "piece = " str) "\n"
+             (if (y-or-n-p "Insert \"opus\" field? ")
+                 (concat "      " (skeleton-read "Opus: " "opus = " str) "\n"))
+             "   }\n"))
+  (if (y-or-n-p "Insert \"\\midi\" field? ")
+      (concat "   \\midi { " 
+             (skeleton-read "Midi: " "\\tempo 4 = " str)  
+             " }\n"))
+  "}\n")
+
 (defun LilyPond-command-menu-entry (entry)
   ;; Return LilyPond-command-alist ENTRY as a menu item.
   (let ((name (car entry)))
@@ -458,6 +488,12 @@
             [ "Region" LilyPond-command-select-region
               :keys "C-c C-r" :style radio
               :selected (eq LilyPond-command-current 'LilyPond-command-region) ]))
+         '(("Insert"
+            [ "\\notes..."  lilypond-notes
+              :keys "C-c n" ]
+            [ "\\score..."  lilypond-score
+              :keys "C-c s" ]
+            ))
 ;        (let ((file 'LilyPond-command-on-current))
 ;          (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))
 ;;; Some kind of mapping which includes :keys might be more elegant
@@ -471,8 +507,7 @@
          '([ "View" (LilyPond-command (LilyPond-command-menu "View") 
'LilyPond-master-file) :keys "C-c C-v"])
          '([ "ViewPS" (LilyPond-command (LilyPond-command-menu "ViewPS") 
'LilyPond-master-file) :keys "C-c C-p"])
          '([ "Midi" (LilyPond-command (LilyPond-command-menu "Midi") 
'LilyPond-master-file) :keys "C-c C-m"])
-  ))
-
+         ))
 
 (defconst LilyPond-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
   "Regexp matching Identifier definitions.")
--------------------------

      Heikki


_______________________________________________
Lilypond-devel mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to