From 5b0d66139a740ebe42e45eadc908daed3e2f7736 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Thu, 24 May 2012 09:59:56 +0900 Subject: Support both XEmacs and Emacs to highlight playing lyrics. * lisp/emms-compat.el: support highlighting for both XEmacs (highlight) and Emacs (hl-line). * lisp/emms-lyrics.el: use compatibility functions defined in emms-compat.el. --- lisp/emms-compat.el | 20 ++++++++++++++++++++ lisp/emms-lyrics.el | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lisp/emms-compat.el b/lisp/emms-compat.el index f5ede0b..ba233ea 100644 --- a/lisp/emms-compat.el +++ b/lisp/emms-compat.el @@ -66,6 +66,26 @@ EMMS release version number." (and (= (car t1) (car t2)) (< (nth 1 t1) (nth 1 t2))))) + +;;; Highline + +(defun emms-activate-highlighting-mode () + "Activate highline mode." + (if (featurep 'xemacs) + (progn + (require 'highline) + (highline-local-mode 1)) + (progn + (require 'hl-line) + (hl-line-mode 1)))) + +(defun emms-line-highlight () + "Highlight the current line. You must call +emms-activate-highlighting-mode beforehand." + (if (featurep 'xemacs) + (highline-highlight-current-line) + (hl-line-highlight))) + ;;; Movement and position diff --git a/lisp/emms-lyrics.el b/lisp/emms-lyrics.el index d798bd1..6b28b22 100644 --- a/lisp/emms-lyrics.el +++ b/lisp/emms-lyrics.el @@ -42,12 +42,12 @@ ;;; Code: -(require 'hl-line) (require 'emms) (require 'emms-player-simple) (require 'emms-source-file) (require 'time-date) (require 'emms-url) +(require 'emms-compat) ;;; User Customization @@ -314,7 +314,7 @@ FILE should be under the same directory as the music file, or under (mapc (lambda (time-lyric) (insert (cdr time-lyric) "\n")) emms-lyrics-alist) (goto-char (point-min)) - (hl-line-mode 1) + (emms-activate-highlighting-mode) (setq buffer-read-only t)) (defun emms-lyrics-start () @@ -470,7 +470,7 @@ display." (when line (goto-char (point-min)) (forward-line (1- line)) - (hl-line-highlight)))))) + (emms-line-highlight)))))) (defun emms-lyrics-find-lyric (file) "Return full path of found lrc FILE, or nil if not found. -- cgit v1.2.3