i have various dictionaries specified in helm-dictionary-database and i'm interested in being able to choose which one of them to use when i run helm-dictionary. i'm mainly interested in this to speed it up. i have dicts for different languages but usually only want to search for a term in one of them at a time.
i'd also like to feed it a default input string, so i can call it from a function and provide the search term.
i came up with this:
(defun helm-dictionary (&optional dictionary query)
(interactive)
(let ((helm-source-dictionary
(if dictionary
(helm-dictionary-build (car dictionary) (cdr dictionary))
(mapcar
(lambda (x) (helm-dictionary-build (car x) (cdr x)))
(if (stringp helm-dictionary-database)
(list (cons "Search dictionary" helm-dictionary-database))
helm-dictionary-database))))
(input (or query (thing-at-point 'word))))
(helm :sources (append helm-source-dictionary (list helm-source-dictionary-online))
:full-frame t
:default input
:candidate-number-limit 500
:buffer "*helm dictionary*")))
then i call it like so:
(let ((query (fetch-query-string-from-somewhere)))
(helm-dictionary (assoc "de-en" helm-dictionary-database) query)))
the dictionary arg seems to work right, though i'm not sure if thats the best way to do it?
and for now the query argument isn't respected by helm's :default. i then tried again without my new arg, and, at least for me, it also doesn't seem to use (thing-at-point 'word) either. helm-dictionary opens with no default input. am i missing something there?
i have various dictionaries specified in
helm-dictionary-databaseand i'm interested in being able to choose which one of them to use when i run helm-dictionary. i'm mainly interested in this to speed it up. i have dicts for different languages but usually only want to search for a term in one of them at a time.i'd also like to feed it a default input string, so i can call it from a function and provide the search term.
i came up with this:
then i call it like so:
the dictionary arg seems to work right, though i'm not sure if thats the best way to do it?
and for now the query argument isn't respected by helm's
:default. i then tried again without my new arg, and, at least for me, it also doesn't seem to use(thing-at-point 'word)either. helm-dictionary opens with no default input. am i missing something there?