From 4fe9f0bbc2542865bc60246cff6b7712fa4ba7bc Mon Sep 17 00:00:00 2001 From: Heikki Junes Date: Tue, 12 Aug 2003 16:56:05 +0000 Subject: [PATCH] split Insert Tag -menu if it is long enough. --- ChangeLog | 6 ++++++ lilypond-mode.el | 34 ++++++++++++++++++++++++++++------ lilypond.words | 6 ++++-- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc343b7642..40a333f88e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-08-12 Heikki Junes + + * lilypond-mode.el: split `Insert Tag' if it is long enough. + + * lilypond.words: add new features: markup, column, center, \[ \]. + 2003-08-10 Heikki Junes * Documentation/topdocs/NEWS.texi, DEDICATION, diff --git a/lilypond-mode.el b/lilypond-mode.el index bfdf571b45..ee49d39886 100644 --- a/lilypond-mode.el +++ b/lilypond-mode.el @@ -19,7 +19,7 @@ (require 'easymenu) (require 'compile) -(defconst LilyPond-version "1.7.30" +(defconst LilyPond-version "1.8.0" "`LilyPond-mode' version number.") (defconst LilyPond-help-address "bug-lilypond@gnu.org" @@ -103,7 +103,7 @@ Finds file lilypond-words from load-path." (add-to-list 'wordlist currword) (while (and (> (length co) 0) (not (string-equal "-" (car (setq co (cdr co)))))))))) - wordlist)) + (reverse wordlist))) "Keywords inserted from LilyPond-Insert-menu.") (defconst LilyPond-keywords @@ -926,10 +926,33 @@ command." '([ "Midi all" LilyPond-command-all-midi t]) )) -(defun LilyPond-menu-keywords (arg) - "Make vector for LilyPond-mode-menu." +(defun LilyPond-menu-keywords-item (arg) + "Make vector for LilyPond-mode-keywords." (vector arg (list 'LilyPond-insert-tag-current arg) :style 'radio :selected (list 'eq 'LilyPond-insert-tag-current arg))) +(defun LilyPond-menu-keywords () + "Make Insert Tags menu. + +The Insert Tags -menu is splitte into pieces if it is long enough." + + (let ((li (mapcar 'LilyPond-menu-keywords-item LilyPond-menu-keywords)) + (w (round (sqrt (length LilyPond-menu-keywords)))) + (splitted '()) + (imin 0) imax lw rw) + (while (< imin (length LilyPond-menu-keywords)) + (setq imax (- (min (+ imin w) (length LilyPond-menu-keywords)) 1)) + (setq lw (nth imin LilyPond-menu-keywords)) + (setq rw (nth imax LilyPond-menu-keywords)) + (add-to-list 'splitted + (let ((l (list (concat (substring lw 0 (min 7 (length lw))) + " ... " + (substring rw 0 (min 7 (length rw))))))) + (while (<= imin imax) + (add-to-list 'l (nth imin li)) + (setq imin (1+ imin))) + (reverse l)))) + (if (> (length LilyPond-menu-keywords) 12) (reverse splitted) li))) + ;;; LilyPond-mode-menu should not be interactive, via "M-x LilyPond-" (easy-menu-define LilyPond-mode-menu LilyPond-mode-map @@ -939,8 +962,7 @@ command." (list (cons "Insert tag" (cons ["Previously selected" LilyPond-insert-tag-current t] (cons "-----" - (mapcar 'LilyPond-menu-keywords - (reverse LilyPond-menu-keywords)))))) + (LilyPond-menu-keywords))))) '(("Miscellaneous" ["Autocompletion" LilyPond-autocompletion t] ["(Un)comment Region" LilyPond-comment-region t] diff --git a/lilypond.words b/lilypond.words index 76b2474903..595eeec779 100644 --- a/lilypond.words +++ b/lilypond.words @@ -1,6 +1,7 @@ -\( - _ -\) - -\[ - _ -\] - -\\\( - _ -\\\) - +\\\[ - _ \\\] - \\accent \\accentus \\accepts @@ -41,7 +42,7 @@ Beam \\broken \\cadenzaOff \\cadenzaOn -\\center +\\center - \ << _ >> - \\cg \\ch \\char @@ -62,7 +63,7 @@ ChordNames Cluster \\cm \\coda -\\column +\\column - \ << _ >> - \\combine \\commandspanrequest \\complex @@ -202,6 +203,7 @@ LyricsVoice \\marcato \\mark \\markup +-\\markup - { _ } - \\maxima \\melisma \\melisma -- 2.39.5