# HG changeset patch # User Oleksandr Gavenko # Date 1485463572 -7200 # Node ID 03065194ef591f630cc3827e96c55d95c565c3e6 # Parent 5a5be84a113d1ccf851b689cee91a1f2f9109ff7 Rename gadict-espeak-ipa => gadict-espeak-headline. diff -r 5a5be84a113d -r 03065194ef59 contrib/gadict.el --- a/contrib/gadict.el Thu Jan 26 22:40:25 2017 +0200 +++ b/contrib/gadict.el Thu Jan 26 22:46:12 2017 +0200 @@ -310,35 +310,35 @@ (if (stringp voice) (concat "-v" (shell-quote-argument voice)) "") (shell-quote-argument str))))) -(defun gadict-espeak-ipa-line (headword) +(defun gadict-espeak-headline-line (headword) (mapconcat (lambda (voice) (format "%s: %s" (propertize voice 'face '(:foreground "red")) (gadict-espeak-ipa headword voice))) (if (listp gadict-espeak-voices-list) gadict-espeak-voices-list '(nil)) " | ")) -;; (defun gadict-espeak-ipa-display () +;; (defun gadict-espeak-headline-display () ;; (interactive) -;; (message (gadict-espeak-ipa-line))) +;; (message (gadict-espeak-headline-line))) -(defvar gadict-espeak-ipa-headword nil) +(defvar gadict-espeak-headline-headword nil) -(defun gadict-espeak-ipa-display () +(defun gadict-espeak-headline-display () (when (eq major-mode 'gadict-mode) (let ( (headword (condition-case nil (gadict-nearest-headword) (error nil))) ) - (unless (eq headword gadict-espeak-ipa-headword) - (setq gadict-espeak-ipa-headword headword) - (setq header-line-format (if headword (gadict-espeak-ipa-line headword) nil)) + (unless (eq headword gadict-espeak-headline-headword) + (setq gadict-espeak-headline-headword headword) + (setq header-line-format (if headword (gadict-espeak-headline-line headword) nil)) (force-mode-line-update))))) -(defvar gadict-espeak-ipa-timer nil) -(defun gadict-espeak-ipa-enable () - (unless gadict-espeak-ipa-timer - (setq gadict-espeak-ipa-timer (run-with-idle-timer 1 t #'gadict-espeak-ipa-display)))) -(defun gadict-espeak-ipa-disable () - (when gadict-espeak-ipa-timer - (cancel-timer gadict-espeak-ipa-timer)) - (setq gadict-espeak-ipa-timer nil)) +(defvar gadict-espeak-headline-timer nil) +(defun gadict-espeak-headline-enable () + (unless gadict-espeak-headline-timer + (setq gadict-espeak-headline-timer (run-with-idle-timer 1 t #'gadict-espeak-headline-display)))) +(defun gadict-espeak-headline-disable () + (when gadict-espeak-headline-timer + (cancel-timer gadict-espeak-headline-timer)) + (setq gadict-espeak-headline-timer nil)) (defun gadict-setup-keymap () "Setup gadict keymap." @@ -359,7 +359,7 @@ (gadict-setup-expansions) (when (executable-find gadict-espeak-program) (setq gadict-espeak-enabled t) - (gadict-espeak-ipa-enable))) + (gadict-espeak-headline-enable))) (provide 'gadict)