362 (save-excursion |
362 (save-excursion |
363 (gadict-search-floor headword) |
363 (gadict-search-floor headword) |
364 (when (search-forward-regexp "\\[\\([^]]+\\)]") |
364 (when (search-forward-regexp "\\[\\([^]]+\\)]") |
365 (kill-new (match-string 1))))) |
365 (kill-new (match-string 1))))) |
366 |
366 |
|
367 (defun gadict-copy-espeak-pronunciation (&optional headword) |
|
368 "Copy espeak pronunciation of selected region or current word to `kill-ring'." |
|
369 (interactive |
|
370 (list (if (use-region-p) |
|
371 (buffer-substring (region-beginning) (region-end)) |
|
372 (thing-at-point 'word)))) |
|
373 (kill-new (gadict-espeak-headline-line headword))) |
|
374 |
367 (defun gadict-setup-keymap () |
375 (defun gadict-setup-keymap () |
368 "Setup gadict keymap." |
376 "Setup gadict keymap." |
369 (define-key (current-local-map) [S-return] 'gadict-insert-translation) |
377 (define-key (current-local-map) [S-return] 'gadict-insert-translation) |
370 (define-key (current-local-map) [C-return] 'gadict-insert-template-in-order) |
378 (define-key (current-local-map) [C-return] 'gadict-insert-template-in-order) |
371 (define-key (current-local-map) [C-S-return] 'gadict-search) |
379 (define-key (current-local-map) [C-S-return] 'gadict-search) |
372 (define-key (current-local-map) [M-return] 'gadict-copy-pronunciation)) |
380 (define-key (current-local-map) [M-return] 'gadict-copy-pronunciation) |
|
381 (define-key (current-local-map) [M-S-return] 'gadict-copy-espeak-pronunciation)) |
373 |
382 |
374 ;;;###autoload |
383 ;;;###autoload |
375 (define-derived-mode gadict-mode fundamental-mode "gadict" |
384 (define-derived-mode gadict-mode fundamental-mode "gadict" |
376 "Derived mode for editing gadict dictionary source files." |
385 "Derived mode for editing gadict dictionary source files." |
377 (gadict-setup-fontlock) |
386 (gadict-setup-fontlock) |