]> git.donarmstrong.com Git - lilypond.git/commitdiff
Allow Command on inactive Region.
authorHeikki Junes <heikki.junes@hut.fi>
Thu, 15 May 2003 21:00:17 +0000 (21:00 +0000)
committerHeikki Junes <heikki.junes@hut.fi>
Thu, 15 May 2003 21:00:17 +0000 (21:00 +0000)
ChangeLog
lilypond-mode.el

index 4b80ec943085762dd65886dbc8d9eb0992e823a7..156831be2e9f4c9099e551813d4ed5d3a1b96b30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,8 @@
 
        * lilypond-mode.el: Allow Midi on buffer.
        Use only '.ly'-extension, remove '.sly' and '.fly'.
+       Allow use of inactive regions. Invoke next Command on Master file, 
+       Buffer or Region, if C-cc, C-cb, or C-cr, accordingly, was pressed.
 
 2003-05-14  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
index 3a6b6555f5a3790e06cff88a8956a17bf7417868..badfcbbea5f9b5193ae67d96aa3c2bd52f2294c7 100644 (file)
@@ -463,6 +463,7 @@ Must be the car of an entry in `LilyPond-command-alist'."
 (defun LilyPond-command-master ()
   "Run command on the current document."
   (interactive)
+  (LilyPond-command-select-master)
   (LilyPond-command (LilyPond-command-query (LilyPond-master-file))
                    'LilyPond-master-file))
 
@@ -528,16 +529,20 @@ Must be the car of an entry in `LilyPond-command-alist'."
 (defun LilyPond-command-region (begin end)
   "Run LilyPond on the current region."
   (interactive "r")
+  (if (or (> begin (point-min)) (< end (point-max)))
+      (LilyPond-command-select-region))
   (write-region begin end (LilyPond-region-file begin end) nil 'nomsg)
   (LilyPond-command (LilyPond-command-query
                     (LilyPond-region-file begin end))
                    '(lambda () (LilyPond-region-file begin end)))
   ;; Region may deactivate even if buffer was intact, reactivate?
+  ;; Currently, also deactived regions are used.
   )
 
 (defun LilyPond-command-buffer ()
   "Run LilyPond on buffer."
   (interactive)
+  (LilyPond-command-select-buffer)
   (LilyPond-command-region (point-min) (point-max)))
 
 (defun LilyPond-command-expand (string file)
@@ -1023,7 +1028,13 @@ command."
 (defun LilyPond-command-menu (name)
   ;; Execute LilyPond-command-alist NAME from a menu.
   (let ((LilyPond-command-force name))
-    (funcall LilyPond-command-current)))
+    (if (eq LilyPond-command-current 'LilyPond-command-region)
+       (if (eq (mark t) nil)
+           (progn (message "The mark is not set now") (sit-for 0 500))
+         (progn (if (not (not (and transient-mark-mode mark-active)))
+                    (progn (message "Region is not active, using region between inactive mark and current point.") (sit-for 0 500)))
+                (LilyPond-command-region (mark t) (point))))
+      (funcall LilyPond-command-current))))
 
 (defun LilyPond-mode ()
   "Major mode for editing LilyPond music files.
@@ -1096,6 +1107,9 @@ LilyPond-xdvi-command\t\tcommand to display dvi files -- bit superfluous"
   (easy-menu-add LilyPond-mode-menu)
   (easy-menu-add LilyPond-command-menu)
 
+  ;; Use Command on Region even for deactivated regions.
+  (setq mark-even-if-inactive t)
+
   ;; run the mode hook. LilyPond-mode-hook use is deprecated
   (run-hooks 'LilyPond-mode-hook))