]> git.donarmstrong.com Git - lilypond.git/commitdiff
new function: LilyPond-add-imenu-menu
authorhjunes <hjunes>
Tue, 17 Jun 2003 18:10:38 +0000 (18:10 +0000)
committerhjunes <hjunes>
Tue, 17 Jun 2003 18:10:38 +0000 (18:10 +0000)
ChangeLog
lilypond-mode.el

index 10bacef6686eb6a174d90073c9834948c1f6afa3..26702345581fd180988c2e3ad7590b3e503ade16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * lilypond-mode.el, lilypond-indent.el: fix XEmacs paren-match.
        
+       * lilypond-mode.el (LilyPond-add-imenu-menu): new function,
+       imenu is not added by default; adapted from f90.el,
+       makes Help-menu, which does not fit, visible in XEmacs.
+       
 2003-06-16  Heikki Junes  <hjunes@cc.hut.fi>
 
        * lilypond-mode.el: Set show-paren-mode local; minor-mode
index c4aa15a9dc1859559634ae0f6c353f348f4f373a..44d7e79499f10a7486f170a2ba7e210821419e20 100644 (file)
   '(("\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2))
   "Regexp used to match LilyPond errors.  See `compilation-error-regexp-alist'.")
 
+(defvar LilyPond-imenu nil
+  "A flag to tell whether LilyPond-imenu is turned on.")
+(make-variable-buffer-local 'LilyPond-imenu)
+
 (defcustom LilyPond-include-path ".:/tmp"
   "* LilyPond include path."
   :type 'string
@@ -994,6 +998,7 @@ command."
          '(("Miscellaneous"
             ["(Un)comment Region" LilyPond-comment-region t]
             ["Refontify buffer" font-lock-fontify-buffer t]
+            ["Add index menu" LilyPond-add-imenu-menu]
             ))
          '(("Info"
             ["LilyPond" LilyPond-info t]
@@ -1036,6 +1041,17 @@ command."
                 (LilyPond-command-region (mark t) (point))))
       (funcall LilyPond-command-current))))
 
+(defun LilyPond-add-imenu-menu ()
+  (interactive)
+  "Add an imenu menu to the menubar."
+  (if (not LilyPond-imenu)
+      (progn
+       (imenu-add-to-menubar "Index")
+       (redraw-frame (selected-frame))
+       (setq LilyPond-imenu t))
+    (message "%s" "LilyPond-imenu already exists.")))
+(put 'LilyPond-add-imenu-menu 'menu-enable '(not LilyPond-imenu))
+
 (defun LilyPond-mode ()
   "Major mode for editing LilyPond music files.
 
@@ -1114,7 +1130,7 @@ LilyPond-xdvi-command\t\tcommand to display dvi files -- bit superfluous"
   ;; In XEmacs imenu was synched up with: FSF 20.4
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression LilyPond-imenu-generic-expression)
-  (imenu-add-to-menubar "Index")
+  ;; (imenu-add-to-menubar "Index") ; see LilyPond-add-imenu-menu
 
   ;; In XEmacs one needs to use 'easy-menu-add'.
   (if (string-match "XEmacs\\|Lucid" emacs-version)