From: hjunes Date: Tue, 17 Jun 2003 18:10:38 +0000 (+0000) Subject: new function: LilyPond-add-imenu-menu X-Git-Tag: release/1.7.25~117 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=af90e33cb25353fd844097caa9185507089fa1a4;p=lilypond.git new function: LilyPond-add-imenu-menu --- diff --git a/ChangeLog b/ChangeLog index 10bacef668..2670234558 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,10 @@ * 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 * lilypond-mode.el: Set show-paren-mode local; minor-mode diff --git a/lilypond-mode.el b/lilypond-mode.el index c4aa15a9dc..44d7e79499 100644 --- a/lilypond-mode.el +++ b/lilypond-mode.el @@ -49,6 +49,10 @@ '(("\\([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)