+2003-06-17 Heikki Junes <hjunes@cc.hut.fi>
+
+ * lilypond-mode.el (LilyPond-un-comment-region): removed.
+ Use one command for both commenting and uncommenting.
+
+ * lilypond-indent.el (LilyPond-comment-region): new function,
+ (un)comments each line separately.
+
2003-06-16 Heikki Junes <hjunes@cc.hut.fi>
* lilypond-mode.el: Set show-paren-mode local; minor-mode
XEmacs' paren-highlight and make minimal changes;
add comments about locality.
Fix matching first open-paren-char in '<< .. >>'.
-
+
2003-06-16 Graham Percival <gperlist@shaw.ca>
* input/test/g*: added texidoc index.
;;; Heikki Junes <hjunes@cc.hut.fi>
;;; * redefine Emacs' show-paren-function and XEmacs' paren-highlight
;;; * match two-char slurs '\( ... \)' and '\[ ... \]' separately.
+;;; * adopt Emacs' f90-comment-region
;;; Chris Jackson <chris@fluffhouse.org.uk>
;;; some code is taken from ESS (Emacs Speaks Statistics) S-mode by A.J.Rossini <rossini@biostat.washington.edu>
(defcustom LilyPond-fancy-comments t
"*Non-nil means distiguish between %, %%, and %%% for indentation.")
+(defcustom LilyPond-comment-region "%%$"
+ "*String inserted by \\[LilyPond-comment-region]\
+ at start of each line in region.")
+
+(defun LilyPond-comment-region (beg-region end-region)
+ "Comment/uncomment every line in the region.
+Insert LilyPond-comment-region at the beginning of every line in the region
+or, if already present, remove it."
+ (interactive "*r")
+ (let ((end (make-marker)))
+ (set-marker end end-region)
+ (goto-char beg-region)
+ (beginning-of-line)
+ (if (looking-at (regexp-quote LilyPond-comment-region))
+ (delete-region (point) (match-end 0))
+ (insert LilyPond-comment-region))
+ (while (and (zerop (forward-line 1))
+ (< (point) (marker-position end)))
+ (if (looking-at (regexp-quote LilyPond-comment-region))
+ (delete-region (point) (match-end 0))
+ (insert LilyPond-comment-region)))
+ (set-marker end nil)))
(defun LilyPond-calculate-indent ()
"Return appropriate indentation for current line as lilypond code.
(current-indentation)))))))))
-
(defun LilyPond-indent-line ()
"Indent current line as lilypond code.
Return the amount the indentation changed by."
(LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-master-file)
)
-;;; Refer to syntax-table (in lilypond-font-lock.el) for comment characters.
-(defun LilyPond-un-comment-region (start end level)
- "Remove up to LEVEL comment characters from each line in the region."
- (interactive "*r\np")
- (comment-region start end (- level)))
-
;; FIXME, this is broken
(defun LilyPond-region-file (begin end)
(let (
(define-key LilyPond-mode-map "\C-ci" 'LilyPond-quick-note-insert)
(define-key LilyPond-mode-map "\C-cn" 'LilyPond-insert-tag-notes)
(define-key LilyPond-mode-map "\C-cs" 'LilyPond-insert-tag-score)
- (define-key LilyPond-mode-map "\C-c:" 'LilyPond-un-comment-region)
- (define-key LilyPond-mode-map "\C-c;" 'comment-region)
+ (define-key LilyPond-mode-map "\C-c;" 'LilyPond-comment-region)
(define-key LilyPond-mode-map ")" 'LilyPond-electric-close-paren)
(define-key LilyPond-mode-map ">" 'LilyPond-electric-close-paren)
(define-key LilyPond-mode-map "}" 'LilyPond-electric-close-paren)
["Autocompletion" LilyPond-autocompletion t]
))
'(("Miscellaneous"
- ["Uncomment Region" LilyPond-un-comment-region t]
- ["Comment Region" comment-region t]
+ ["(Un)comment Region" LilyPond-comment-region t]
["Refontify buffer" font-lock-fontify-buffer t]
))
'(("Info"