equal
deleted
inserted
replaced
252 (defvar-local gadict-tr nil |
252 (defvar-local gadict-tr nil |
253 "Translation markers as string separated by comma. Define own |
253 "Translation markers as string separated by comma. Define own |
254 values in .dir-local.el or as -*- gadict-tr: \"...\" -*- file prelude") |
254 values in .dir-local.el or as -*- gadict-tr: \"...\" -*- file prelude") |
255 (put 'gadict-tr 'safe-local-variable 'string-or-null-p) |
255 (put 'gadict-tr 'safe-local-variable 'string-or-null-p) |
256 |
256 |
257 (defun gadict-insert-template (&optional headword) |
257 (defun gadict-insert-article (&optional headword) |
258 "Insert new article template after the current place. |
258 "Insert new article after the current place. |
259 |
259 |
260 If `gadict-espeak-enabled' is `t' pronunciation will be filled |
260 If `gadict-espeak-enabled' is `t' pronunciation will be filled |
261 with espeak `gadict-espeak-default-voice'." |
261 with espeak `gadict-espeak-default-voice'." |
262 (interactive) |
262 (interactive) |
263 (if (re-search-forward "^__" nil t) |
263 (if (re-search-forward "^__" nil t) |
328 definition. Check for headwords ordering during search." |
328 definition. Check for headwords ordering during search." |
329 (interactive (list (read-string "Headword: "))) |
329 (interactive (list (read-string "Headword: "))) |
330 (gadict-search-floor headword) |
330 (gadict-search-floor headword) |
331 (recenter)) |
331 (recenter)) |
332 |
332 |
333 (defun gadict-insert-template-in-order (headword) |
333 (defun gadict-insert-article-in-order (headword) |
334 "Insert new article template with respect of headword order." |
334 "Insert new article template with respect of headword order." |
335 (interactive (list (read-string "Headword: "))) |
335 (interactive (list (read-string "Headword: "))) |
336 (unless (gadict-search-floor headword) |
336 (unless (gadict-search-floor headword) |
337 (gadict-insert-template headword)) |
337 (gadict-insert-article headword)) |
338 (activate-input-method nil) |
338 (activate-input-method nil) |
339 (recenter)) |
339 (recenter)) |
340 |
340 |
341 (defun gadict--find-headword-end () |
341 (defun gadict--find-headword-end () |
342 (save-excursion |
342 (save-excursion |
346 (forward-char) |
346 (forward-char) |
347 (re-search-forward "^$") |
347 (re-search-forward "^$") |
348 (point))) |
348 (point))) |
349 |
349 |
350 (defun gadict-insert-translation (pos) |
350 (defun gadict-insert-translation (pos) |
351 "Insert translation template with using value of `gadict-tr'." |
351 "Insert translation template using value of `gadict-tr'." |
352 (interactive (list (completing-read "POS: " gadict--pos nil t))) |
352 (interactive (list (completing-read "POS: " gadict--pos nil t))) |
353 (let ( (headword-end (gadict--find-headword-end)) ) |
353 (let ( (headword-end (gadict--find-headword-end)) ) |
354 (if (< (point) headword-end) |
354 (if (< (point) headword-end) |
355 (goto-char headword-end) |
355 (goto-char headword-end) |
356 (re-search-forward "^\\(?:\\|__\\)$") |
356 (re-search-forward "^\\(?:\\|__\\)$") |
409 (kill-new (gadict-espeak-headline-line headword))) |
409 (kill-new (gadict-espeak-headline-line headword))) |
410 |
410 |
411 (defun gadict-setup-keymap () |
411 (defun gadict-setup-keymap () |
412 "Setup gadict keymap." |
412 "Setup gadict keymap." |
413 (define-key (current-local-map) [S-return] 'gadict-insert-translation) |
413 (define-key (current-local-map) [S-return] 'gadict-insert-translation) |
414 (define-key (current-local-map) [C-return] 'gadict-insert-template-in-order) |
414 (define-key (current-local-map) [C-return] 'gadict-insert-article-in-order) |
415 (define-key (current-local-map) [C-S-return] 'gadict-search) |
415 (define-key (current-local-map) [C-S-return] 'gadict-search) |
416 (define-key (current-local-map) [M-return] 'gadict-copy-pronunciation) |
416 (define-key (current-local-map) [M-return] 'gadict-copy-pronunciation) |
417 (define-key (current-local-map) [M-S-return] 'gadict-copy-espeak-pronunciation)) |
417 (define-key (current-local-map) [M-S-return] 'gadict-copy-espeak-pronunciation)) |
418 |
418 |
419 ;;;###autoload |
419 ;;;###autoload |