[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH]More Emacs inputs
From: |
Heikki Johannes Junes |
Subject: |
[PATCH]More Emacs inputs |
Date: |
Mon, 15 Oct 2001 04:19:30 +0300 (EET DST) |
For me it is hard to remember all the syntax while editing with emacs.
That is why I made an interface which helps to remember the syntax.
For example, some regularly used articulations like "\tenuto" and
"\staccato" can be inserted by typing just "C-c -" or "C-c .",
respectively. The item "Main Fields" contains many features which are
easy to forget. Here's the patch, it is rather long (10 kb) with one new
file "lilypond-input.el".
-----------------
--- VERSION~ Sun Oct 14 17:07:56 2001
+++ VERSION Mon Oct 15 04:00:31 2001
@@ -2,7 +2,7 @@
MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=17
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hjj1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- CHANGES~ Mon Oct 15 04:01:59 2001
+++ CHANGES Mon Oct 15 04:02:05 2001
@@ -1,3 +1,8 @@
+1.5.17.hjj1
+===========
+
+* Emacs-mode: Grouped inserting tags
+
1.5.16.hjj2
===========
--- lilypond-mode.el.orig Thu Oct 11 18:28:29 2001
+++ lilypond-mode.el Mon Oct 15 04:05:25 2001
@@ -20,6 +20,7 @@
;;;
(load-library "lilypond-font-lock")
+(load-library "lilypond-input")
(require 'easymenu)
(require 'compile)
@@ -426,40 +427,27 @@
(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-cI" 'lilypond-Include) ; main field
+ (define-key LilyPond-mode-map "\C-cH" 'lilypond-Header)
+ (define-key LilyPond-mode-map "\C-cG" 'lilypond-Global)
+ (define-key LilyPond-mode-map "\C-cN" 'lilypond-Notes)
+ (define-key LilyPond-mode-map "\C-cS" 'lilypond-Score)
+ (define-key LilyPond-mode-map "\C-cc" 'lilypond-clef) ; staff field
+ (define-key LilyPond-mode-map "\C-ck" 'lilypond-key)
+ (define-key LilyPond-mode-map "\C-ct" 'lilypond-time)
+ (define-key LilyPond-mode-map "\C-c-" 'lilypond-tenuto) ; articulation
+ (define-key LilyPond-mode-map "\C-c." 'lilypond-staccato)
+ (define-key LilyPond-mode-map "\C-c\C-a<" 'lilypond-crescendo)
+ (define-key LilyPond-mode-map "\C-c\C-a>" 'lilypond-diminuendo)
+ (define-key LilyPond-mode-map "\C-c(" 'lilypond-slur) ; note group
+ (define-key LilyPond-mode-map "\C-c[" 'lilypond-bar)
+ (define-key LilyPond-mode-map "\C-c<" 'lilypond-chord)
+ (define-key LilyPond-mode-map "\C-cx" 'lilypond-context)
(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)))
@@ -489,10 +477,27 @@
: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" ]
+ ("Main Fields"
+ [ "\\include" lilypond-Include :keys "C-c I" ]
+ [ "\\header" lilypond-Header :keys "C-c H" ]
+ [ "global =" lilypond-Global :keys "C-c G" ]
+ [ "xx = \\notes" lilypond-Notes :keys "C-c N" ]
+ [ "\\score" lilypond-Score :keys "C-c S" ])
+ ("Staff Field"
+ [ "\\clef" lilypond-clef :keys "C-c c" ]
+ [ "\\key" lilypond-key :keys "C-c k" ]
+ [ "\\time" lilypond-time :keys "C-c t" ])
+ ("Articulation"
+ [ "\\tenuto" lilypond-tenuto :keys "C-c -" ]
+ [ "\\staccato" lilypond-staccato :keys "C-c ." ]
+ [ "crescendo \"b \\< _ \\! e\"" lilypond-crescendo :keys "C-c
C-a <" ]
+ [ "diminuendo \"b \\! _ \\> e\"" lilypond-diminuendo :keys "C-c
C-a >" ])
+ ("Note Group"
+ [ "slur \"b( _ )e\"" lilypond-slur :keys "C-c (" ]
+ [ "bar \"[b _ e]\"" lilypond-bar :keys "C-c [" ]
+ [ "chord \"<b _ e>\"" lilypond-chord :keys "C-c <" ]
+ [ "\\context xx { _ }" lilypond-context :keys "C-c x" ]
+ [ "\\notes { _ }" lilypond-notes :keys "C-c n" ])
))
; (let ((file 'LilyPond-command-on-current))
; (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))
@@ -580,7 +585,9 @@
(make-local-variable 'indent-line-function)
(setq indent-line-function 'indent-relative-maybe)
- (set-syntax-table LilyPond-mode-syntax-table)
+ (setq skeleton-end-hook nil)
+
+ (set-syntax-table LilyPond-mode-syntax-table)
(setq major-mode 'LilyPond-mode)
(setq mode-name "LilyPond")
(setq local-abbrev-table LilyPond-mode-abbrev-table)
--- lilypond-input.el~ Mon Oct 15 04:06:43 2001
+++ lilypond-input.el Mon Oct 15 03:53:32 2001
@@ -0,0 +1,195 @@
+;; lilypond-input.el --- fast typesetting for LilyPond mode
+
+;; Copyright (C) 2001 Heikki Junes
+
+;; Author: 2001: Heikki Junes
+;; Created: Oct 1992
+;; Version: 0.0
+;; Last Modified: 15OCT2001
+;; Keywords: lilypond languages music notation
+
+;; This software is provided as-is, without express or implied
+;; warranty. Permission to use, copy, modify, distribute or sell this
+;; software, without fee, for any purpose and by any individual or
+;; organization, is hereby granted, provided that the above copyright
+;; notice and this paragraph appear in all copies.
+
+;; This started out as a cannabalised version of sgml-mode.el, by hjj.
+;; For changes see the LilyPond ChangeLog
+;;
+
+;; TODO:
+;; - indentation
+;; - more fields
+
+;; MAIN FIELDS
+
+(define-skeleton lilypond-Include
+ "Lilypond include field."
+ "Filename to include (e.g. suomi.ly): "
+ "\\include \"" str "\"\n\n")
+
+(define-skeleton lilypond-Header
+ "Lilypond header fields."
+ nil
+ "\\header {\n"
+ (if (y-or-n-p "Set \"filename\" attribute? ")
+ (concat " filename = \""
+ (skeleton-read "Filename of this file: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"title\" attribute? ")
+ (concat " title = \""
+ (skeleton-read "Title: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"subtitle\" attribute? ")
+ (concat " subtitle = \""
+ (skeleton-read "Subtitle: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"source\" attribute? ")
+ (concat " source = \""
+ (skeleton-read "Source: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"composer\" attribute? ")
+ (concat " composer = \""
+ (skeleton-read "Composer: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"enteredby\" attribute? ")
+ (concat " enteredby = \""
+ (skeleton-read "Enteredby: " "" str) "\"\n"))
+ (if (y-or-n-p "Set \"copyright\" attribute? ")
+ (concat " copyright = \""
+ (skeleton-read "Copyright (e.g. Public Domain): "
+ "Public Domain" str) "\"\n"))
+ "}\n\n")
+
+
+(define-skeleton lilypond-Global
+ "Lilypond notes tag."
+ nil
+; (if (bolp) nil ?\n)
+ "global = \\notes {"
+ (if (y-or-n-p "Set \"\\key\" attribute? ")
+ (concat "\n \\key " (skeleton-read "Note: " "" str)
+ (if (y-or-n-p "(y) major, (n) minor ? ") " \\major" " \\minor")))
+ (if (y-or-n-p "Set \"\\time\" attribute? ")
+ (concat "\n \\time " (skeleton-read "Numerator: " "" str) "/"
+ (skeleton-read "Denomirator: " "" str)))
+ "\n}\n\n")
+
+(define-skeleton lilypond-Notes
+ "Lilypond notes fields."
+ nil
+ (let ((notesfields nil))
+ (if (y-or-n-p "Set \"\\relative\" attributes to all fields? ")
+ (while (y-or-n-p "Insert a new \"\\notes\" field? ")
+ (setq notesfields
+ (concat notesfields
+ (skeleton-read "Name: " "" str)
+ " = \\notes \\relative "
+ (skeleton-read "Relative: " "" str)
+ " {\n \n}\n\n")))
+ (while (y-or-n-p "Insert a new \"\\notes\" field? ")
+ (setq notesfields
+ (concat notesfields
+ (skeleton-read "Name: " "" str)
+ " = \\notes {\n \n}\n\n"))))
+ notesfields))
+
+(define-skeleton lilypond-Score
+ "Lilypond score tag."
+ nil
+ (if (bolp) nil ?\n)
+ "\\score {\n"
+ (if (y-or-n-p "Insert \"\\context\" field? ")
+ (concat " \\context "
+ (skeleton-read "Context (e.g. GrandStaff): " "" str)
+ " <\n"
+ (let ((subconteces nil))
+ (while (y-or-n-p "Insert a sub-\"\\context\" field(s)? ")
+ (setq subconteces
+ (concat subconteces " \\context Staff = "
+ (skeleton-read "Staff = (e.g. upper/lower): "
"" str)
+ " <\n \n >\n")))
+ subconteces)
+ " >\n"))
+ " \\paper {}\n"
+ (if (y-or-n-p "Insert \"\\header\" field? ")
+ (concat " \\header {\n"
+ (if (y-or-n-p "Insert \"piece\" field? ")
+ (concat " piece = \""
+ (skeleton-read "Piece: " "" str) "\"\n"))
+ (if (y-or-n-p "Insert \"opus\" field? ")
+ (concat " opus = \""
+ (skeleton-read "Opus: " "" str) "\"\n"))
+ " }\n"))
+ (if (y-or-n-p "Insert \"\\midi\" field? ")
+ (concat " \\midi { "
+ (skeleton-read "Midi: " "\\tempo 4 = " str)
+ " }\n"))
+ "}\n")
+
+;; STAFF FIELDS
+
+(define-skeleton lilypond-clef
+ "Lilypond clef tag."
+ "Clef (e.g. treble/violin/tenor/bass): "
+ "\\clef " str " ")
+
+(define-skeleton lilypond-key
+ "Lilypond key tag."
+ "Note: "
+ "\\key " str
+ (if (y-or-n-p "(y) major, (n) minor ? ") "\\major " "\\minor "))
+
+(define-skeleton lilypond-time
+ "Lilypond time tag."
+ nil
+ (concat "\\time " (skeleton-read "Numerator: " "" str) "/"
+ (skeleton-read "Denomirator: " "" str) " "))
+
+;; ARTICULATIONS
+
+(define-skeleton lilypond-tenuto
+ "Lilypond tenuto tag."
+ nil
+ "\\tenuto")
+
+(define-skeleton lilypond-staccato
+ "Lilypond staccato tag."
+ nil
+ "\\staccato")
+
+(define-skeleton lilypond-crescendo
+ "Lilypond crescendo tag."
+ nil
+ " \\<" _ "\\! ")
+
+(define-skeleton lilypond-diminuendo
+ "Lilypond diminuendo tag."
+ nil
+ " \\!" _ "\\> ")
+
+;; NOTE GROUPS
+
+(define-skeleton lilypond-slur
+ "Lilypond slur tag."
+ nil
+ "(" _ ")")
+
+(define-skeleton lilypond-bar
+ "Lilypond bar tag."
+ nil
+ "[" _ "]")
+
+(define-skeleton lilypond-chord
+ "Lilypond slur tag."
+ nil
+ "<" _ ">")
+
+(define-skeleton lilypond-context
+ "Lilypond context tag."
+ "Context (e.g. Staff = treble or Voice = i): "
+ "\\context " str " { " _ " }")
+
+(define-skeleton lilypond-notes
+ "Lilypond notes tag."
+ nil
+ "\\notes"
+ (if (y-or-n-p "Set \"\\relative\" attribute? ")
+ (concat " \\relative " (skeleton-read "Relative: " "" str)))
+ " { " _ " }")
-----------------
Heikki
--
Heikki Junes
Addr. Jääkärinkatu 6A a10, FIN-00150 Helsinki
Mob. +358 50 549 7873
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH]More Emacs inputs,
Heikki Johannes Junes <=