+2003-07-10 Heikki Junes <hjunes@cc.hut.fi>
+
+ * lilypond-indent.el (LilyPond-show-paren-mode): From Emacs' paren.el:
+ Disable buffer-locally default paren idle timer and make a new one.
+
+ * lilypond-mode.el: Turn off locally show-paren-mode, but turn on
+ locally LilyPond-show-paren-mode. Add to menu a toggle for
+ LilyPond-show-paren-function.
+
2003-07-08 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* input/template/jazz-combo.ly (drumNotes): 1.7 fixes
;;; * in syntax-highlighting slurs are not always highlighted the right way
;;; e.g. opening slurs are found found better in "#( ( ) ( ) )" than
;;; opening slurs
-;;; * should make Lilypond-show-paren-mode instead of using show-paren-mode
+;;; * XEmacs: should make Lilypond-paren-mode instead of using paren-mode
(defcustom LilyPond-indent-level 4
"*Indentation of lilypond statements with respect to containing block.")
;; Find the place to show, if there is one,
;; and show it until input arrives.
(defun LilyPond-show-paren-function ()
- (if show-paren-mode
+ (if LilyPond-show-paren-mode
(let (pos dir mismatch face (oldpos (point)))
(cond ((eq (char-syntax (preceding-char)) ?\))
(setq dir -1))
nil
paren-blink-interval))))))
))))
+
+(if (not (string-match "XEmacs\\|Lucid" emacs-version))
+;;; EMACS' Lilypond-show-paren-mode definition
+(define-minor-mode LilyPond-show-paren-mode
+ "Toggle Show Paren mode.
+With prefix ARG, turn Show Paren mode on if and only if ARG is positive.
+Returns the new status of Show Paren mode (non-nil means on).
+
+When Show Paren mode is enabled, any matching parenthesis is highlighted
+in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
+ :global t :group 'LilyPond-paren-showing
+ ;; Turn off the usual paren-matching method
+ ;; when this one is turned on.
+ (if (local-variable-p 'LilyPond-show-paren-mode)
+ (make-local-variable 'blink-matching-paren-on-screen)
+ (kill-local-variable 'blink-matching-paren-on-screen))
+ (setq blink-matching-paren-on-screen (not LilyPond-show-paren-mode))
+ ;; Now enable or disable the mechanism.
+ ;; First get rid of the old idle timer.
+ (if show-paren-idle-timer
+ (cancel-timer show-paren-idle-timer))
+ (if (boundp 'LilyPond-show-paren-idle-timer)
+ (cancel-timer LilyPond-show-paren-idle-timer))
+ (setq LilyPond-show-paren-idle-timer nil)
+ ;; If show-paren-mode is enabled in some buffer now,
+ ;; set up a new timer.
+ (when (memq t (mapcar (lambda (buffer)
+ (or (with-current-buffer buffer
+ show-paren-mode)
+ (with-current-buffer buffer
+ LilyPond-show-paren-mode)))
+ (buffer-list)))
+ (setq LilyPond-show-paren-idle-timer (run-with-idle-timer
+ show-paren-delay t
+ 'LilyPond-show-paren-function)))
+ (unless show-paren-mode
+ (and show-paren-overlay
+ (eq (overlay-buffer show-paren-overlay) (current-buffer))
+ (delete-overlay show-paren-overlay))
+ (and show-paren-overlay-1
+ (eq (overlay-buffer show-paren-overlay-1) (current-buffer))
+ (delete-overlay show-paren-overlay-1))))
+;;; XEMACS' Lilypond-paren-mode definition
+(progn ; TODO
+))
(require 'easymenu)
(require 'compile)
-(defconst LilyPond-version "1.7.21"
+(defconst LilyPond-version "1.7.24"
"`LilyPond-mode' version number.")
(defconst LilyPond-help-address "bug-lilypond@gnu.org"
["(Un)comment Region" LilyPond-comment-region t]
["Refontify buffer" font-lock-fontify-buffer t]
["Add index menu" LilyPond-add-imenu-menu]
+ ["LilyPond Paren Mode"
+ (if (not (string-match "XEmacs\\|Lucid" emacs-version))
+ (LilyPond-show-paren-mode (not LilyPond-show-paren-mode))
+ (paren-set-mode (and (not paren-mode) 'paren)))
+ :style toggle :selected
+ (if (not (string-match "XEmacs\\|Lucid" emacs-version))
+ LilyPond-show-paren-mode paren-mode)]
))
'(("Info"
["LilyPond" LilyPond-info t]
(setq local-abbrev-table LilyPond-mode-abbrev-table)
(use-local-map LilyPond-mode-map)
- ;; In Emacs blink-...-on-screen needs to be declared.
- (if (not (string-match "XEmacs\\|Lucid" emacs-version))
- (progn
- (make-local-variable 'show-paren-mode)
- (setq show-paren-mode t))
- (paren-set-mode 'paren))
-
- (if (not (string-match "XEmacs\\|Lucid" emacs-version))
- (progn
- ;; (make-local-variable 'show-paren-function) ; possible?
- ;; (setq show-paren-function 'LilyPond-show-paren-function) ; possible?
- ;; don't redefine emacs functions. It breaks other modes.
- ;; should have an own idle-timer instead
- ;; (defun show-paren-function () (LilyPond-show-paren-function)) ; for testing
- )
- (progn
- ;; (make-local-variable 'paren-highlight) ; possible?
- ;; (setq paren-highlight 'LilyPond-paren-highlight) ; possible?
- ;; don't redefine Xemacs functions. It breaks other modes.
- ;; should have an own idle-timer instead
- ;; (defun paren-highlight () (LilyPond-paren-highlight)) ; for testing
- ))
-
;; In XEmacs imenu was synched up with: FSF 20.4
(make-local-variable 'imenu-generic-expression)
(setq imenu-generic-expression LilyPond-imenu-generic-expression)
(setq zmacs-regions nil)
(setq mark-even-if-inactive t))
+ ;; In Emacs blink-...-on-screen needs to be declared.
+ (if (not (string-match "XEmacs\\|Lucid" emacs-version))
+ (progn
+ (make-local-variable 'show-paren-mode)
+ (show-paren-mode nil)
+ (make-local-variable 'LilyPond-show-paren-mode)
+ (LilyPond-show-paren-mode t))
+ (progn
+ (make-local-variable 'show-paren-mode)
+ (paren-set-mode 'paren)
+ ;; don't redefine Xemacs functions. It breaks other modes.
+ ;; should have an own idle-timer instead
+ ;; (defun paren-highlight () (LilyPond-paren-highlight)) ; for testing
+ ))
+
;; run the mode hook. LilyPond-mode-hook use is deprecated
(run-hooks 'LilyPond-mode-hook))