contrib/gadict.el
changeset 803 13f5485d81c6
parent 802 a812ec996022
child 862 8ce278ad45d8
equal deleted inserted replaced
802:a812ec996022 803:13f5485d81c6
   355 
   355 
   356 (defun gadict-copy-pronunciation (&optional headword)
   356 (defun gadict-copy-pronunciation (&optional headword)
   357   "Copy existing pronunciation of selected region or current word to `kill-ring'."
   357   "Copy existing pronunciation of selected region or current word to `kill-ring'."
   358   (interactive
   358   (interactive
   359    (list (if (use-region-p)
   359    (list (if (use-region-p)
   360              (buffer-substring region-beginning region-end)
   360              (buffer-substring (region-beginning) (region-end))
   361            (thing-at-point 'word))))
   361            (thing-at-point 'word))))
   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)))))