lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Emacs-mode: Keyboard shortcuts


From: Heikki Johannes Junes
Subject: [PATCH] Emacs-mode: Keyboard shortcuts
Date: Wed, 12 Sep 2001 02:34:10 +0300 (EET DST)

I made keyboard shortcuts for Emacs-mode. The keyboard bindings are shown
shown in the "Command"-menu. This was inspired by long-time experience of
LaTeXing with Emacs. Here is the patch...

--- lilypond-1.5.9/CHANGES      Sat Sep  8 21:11:09 2001
+++ lilypond-1.5.9.NEW/CHANGES  Wed Sep 12 02:16:07 2001
@@ -1,3 +1,8 @@
+1.5.9.hjj1
+==========
+
+* Emacs-mode: Keyboard shortcuts
+
 1.5.8.uu1
 =========
 
--- lilypond-1.5.9/lilypond-mode.el     Thu Aug 30 17:26:28 2001
+++ lilypond-1.5.9.NEW/lilypond-mode.el Wed Sep 12 02:15:45 2001
@@ -7,6 +7,8 @@
 ;;; 
 ;;; Changed 29th Aug 2001 Heikki Junes <address@hidden>
 ;;;    * Add PS-compilation, PS-viewing and MIDI-play
+;;; Changed 12th Sep 2001 Heikki Junes
+;;;    * Keyboard shortcuts
 
 ;;; Inspired on auctex
 
@@ -273,6 +275,42 @@
   (LilyPond-command (LilyPond-command-query (LilyPond-master-file))
                    'LilyPond-master-file))
 
+(defun LilyPond-command-formatdvi ()
+  "Format the dvi output of the current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "2Dvi") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-formatps ()
+  "Format the ps output of the current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "2PS") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-smartview ()
+  "View the dvi output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "SmartView") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-view ()
+  "View the dvi output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "View") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-viewps ()
+  "View the ps output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-midi ()
+  "View the ps output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "Midi") 'LilyPond-master-file)
+)
+
 ;; FIXME, this is broken
 (defun LilyPond-region-file (begin end)
   (let (
@@ -382,6 +420,12 @@
   (define-key LilyPond-mode-map "\C-c\C-b" 'LilyPond-command-buffer)
   (define-key LilyPond-mode-map "\C-c\C-k" 'LilyPond-kill-job)
   (define-key LilyPond-mode-map "\C-c\C-c" 'LilyPond-command-master)
+  (define-key LilyPond-mode-map "\C-c\C-d" 'LilyPond-command-formatdvi)
+  (define-key LilyPond-mode-map "\C-c\C-f" 'LilyPond-command-formatps)
+  (define-key LilyPond-mode-map "\C-c\C-v" 'LilyPond-command-smartview)
+  (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)
   )
 
 ;;; Menu Support
@@ -414,8 +458,20 @@
             [ "Region" LilyPond-command-select-region
               :keys "C-c C-r" :style radio
               :selected (eq LilyPond-command-current 'LilyPond-command-region) 
]))
-         (let ((file 'LilyPond-command-on-current))
-           (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))))
+;        (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
+         '([ "LilyPond" (LilyPond-command (LilyPond-command-menu "ViewPS") 
'LilyPond-master-file) ])
+         '([ "TeX" (LilyPond-command (LilyPond-command-menu "TeX") 
'LilyPond-master-file) ])
+         '([ "2Dvi" (LilyPond-command (LilyPond-command-menu "2Dvi") 
'LilyPond-master-file) :keys "C-c C-d"])
+         '([ "2PS" (LilyPond-command (LilyPond-command-menu "2PS") 
'LilyPond-master-file) :keys "C-c C-f"])
+         '([ "Book" (LilyPond-command (LilyPond-command-menu "Book") 
'LilyPond-master-file) ])
+         '([ "LaTeX" (LilyPond-command (LilyPond-command-menu "LaTeX") 
'LilyPond-master-file) ])
+         '([ "SmartView" (LilyPond-command (LilyPond-command-menu "SmartView") 
'LilyPond-master-file) :keys "C-c C-s"])
+         '([ "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_]*\\) *="
@@ -438,7 +494,7 @@
 (defun LilyPond-command-select-region ()
   (interactive)
   (message "Next command will be on the region")
-  (setq LilyPond-command-current 'LilPond-command-region))
+  (setq LilyPond-command-current 'LilyPond-command-region))
 
 (defun LilyPond-command-menu (name)
   ;; Execute LilyPond-command-alist NAME from a menu.

--
      Heikki Junes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]