equal
deleted
inserted
replaced
155 "Translation markers as string separated by comma. Define own |
155 "Translation markers as string separated by comma. Define own |
156 values in .dir-local.el or as -*- gadict-tr: \"...\" -*- file prelude") |
156 values in .dir-local.el or as -*- gadict-tr: \"...\" -*- file prelude") |
157 (put 'gadict-tr 'safe-local-variable 'string-or-null-p) |
157 (put 'gadict-tr 'safe-local-variable 'string-or-null-p) |
158 |
158 |
159 (defun gadict-insert-template (&optional headword) |
159 (defun gadict-insert-template (&optional headword) |
160 "Insert new article template after the current place." |
160 "Insert new article template after the current place. |
|
161 |
|
162 If `gadict-espeak-enabled' is `t' pronunciation will be filled |
|
163 with espeak `gadict-espeak-default-voice'." |
161 (interactive) |
164 (interactive) |
162 (if (re-search-forward "^__" nil t) |
165 (if (re-search-forward "^__" nil t) |
163 (beginning-of-line) |
166 (beginning-of-line) |
164 (goto-char (point-max))) |
167 (goto-char (point-max))) |
165 (while (eq (char-before) ?\n) |
168 (while (eq (char-before) ?\n) |
177 (backward-char) |
180 (backward-char) |
178 (re-search-backward "^$")) |
181 (re-search-backward "^$")) |
179 (backward-char) |
182 (backward-char) |
180 (when headword |
183 (when headword |
181 (insert headword) |
184 (insert headword) |
182 (insert "\n []") |
185 (insert "\n [") |
183 (backward-char))) |
186 (if gadict-espeak-enabled |
|
187 (progn |
|
188 (insert (gadict-espeak-ipa headword gadict-espeak-default-voice)) |
|
189 (insert "]") |
|
190 (when gadict-tr |
|
191 (search-forward ": "))) |
|
192 (insert "]") |
|
193 (backward-char)))) |
184 |
194 |
185 (defun gadict-search-floor (headword) |
195 (defun gadict-search-floor (headword) |
186 "Move to HEADWORD definition or place on posiiton for new corresponding |
196 "Move to HEADWORD definition or place on posiiton for new corresponding |
187 definition. Check for headwords ordering during search. |
197 definition. Check for headwords ordering during search. |
188 |
198 |
278 (end-of-line)) |
288 (end-of-line)) |
279 (re-search-backward "^\\([^ ].*\\)$" limit) |
289 (re-search-backward "^\\([^ ].*\\)$" limit) |
280 (match-string 1) |
290 (match-string 1) |
281 ))) |
291 ))) |
282 |
292 |
|
293 (defvar gadict-espeak-enabled nil |
|
294 "Is espeak used.") |
|
295 |
283 (defvar gadict-espeak-program "espeak") |
296 (defvar gadict-espeak-program "espeak") |
284 (defvar gadict-espeak-program-ipa-args "-q --ipa=2") |
297 (defvar gadict-espeak-program-ipa-args "-q --ipa=2") |
285 ;; "en" "en-gb" "en-us" "en-sc" |
298 ;; "en" "en-gb" "en-us" "en-sc" |
286 (defvar gadict-espeak-voices-list '("en-gb" "en-us") |
299 (defvar gadict-espeak-voices-list '("en-gb" "en-us") |
287 "What voices to show. Look to 'espeak --voices' for full list.") |
300 "What voices to show. Look to 'espeak --voices' for full list.") |
|
301 (defvar gadict-espeak-default-voice "en-us" |
|
302 "Default voice for espeak. Used in article template.") |
288 |
303 |
289 (defun gadict-espeak-ipa (str &optional voice) |
304 (defun gadict-espeak-ipa (str &optional voice) |
290 (gadict--trim |
305 (gadict--trim |
291 (shell-command-to-string |
306 (shell-command-to-string |
292 (format "%s %s %s %s" |
307 (format "%s %s %s %s" |
341 (gadict-setup-page) |
356 (gadict-setup-page) |
342 (gadict-setup-comment) |
357 (gadict-setup-comment) |
343 (gadict-setup-indent) |
358 (gadict-setup-indent) |
344 (gadict-setup-expansions) |
359 (gadict-setup-expansions) |
345 (when (executable-find gadict-espeak-program) |
360 (when (executable-find gadict-espeak-program) |
|
361 (setq gadict-espeak-enabled t) |
346 (gadict-espeak-ipa-enable))) |
362 (gadict-espeak-ipa-enable))) |
347 |
363 |
348 (provide 'gadict) |
364 (provide 'gadict) |
349 |
365 |
350 ;;; dict-mode.el ends here |
366 ;;; dict-mode.el ends here |