abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.29k stars 338 forks source link

Dictionary lookups? #1696

Open bbuccianti opened 6 years ago

bbuccianti commented 6 years ago

I'm currently switching to a terminal console to input "dict someword" to simply and fast get the meaning of someword.

Is posible to implement this with counsel? Something like counsel-dict?

Thank you

basil-conto commented 6 years ago

Have you tried out @abo-abo's package define-word?

I also did some preliminary online searching, as I've always wanted to look into dictionary client/servers for GNU/Linux and Emacs. Here are some things I found, which might be worth looking into before diving blindly into something like counsel-dict:

External software

Emacs packages

basil-conto commented 6 years ago

Is posible to implement this with counsel?

What UI/behaviour do you have in mind?

bbuccianti commented 6 years ago

I want to just see a word press a key combination and be prompted for a word then retrieve the "dict someword" result in the minibuffer or in an special buffer. I can't find a simple package that do this

Edit: i'm currently using the M-& bind to async-shell-command and run the "dict someword". This works but seems too simple :D

Also i'm thinking on something like try local dict search first, if no results founded search online

basil-conto commented 6 years ago

I want to just see a word press a key combination and be prompted for a word then retrieve the "dict someword" result in the minibuffer or in an special buffer. I can't find a simple package that do this

OK, but how does this relate to ivy, whose role is to interactively filter a collection of potential candidates? Where do you expect to get such a list of strings from?

Edit: i'm currently using the M-& bind to async-shell-command and run the "dict someword". This works but seems too simple :D

That's what it's there for. :)

Also i'm thinking on something like try local dict search first, if no results founded search online

Have you tried or do you intend to try out any of the aforementioned Emacs packages?

bbuccianti commented 6 years ago

OK,** but how does this relate to ivy, whose role is to interactively filter a collection of potential candidates? Where do you expect to get such a list of strings from?

Maybe you can complete the word that you want to lookup. Some times looking for "settings" don't get anything but "setting" get results

I created a function minutes before to prompt me for a word and call dict command with that word

(defun bb/dict-lookup () (interactive) (let ((word (read-from-minibuffer "Word? "))) (async-shell-command (concat "dict " word))))

Sorry for the wrong indentation i can't fix it for now

Have you tried or do you intend to try out any of the aforementioned Emacs packages?

I skimmed for all packages but anyone seem like providing completion when looking for a word. Maybe i look poorly, i'm going to keep looking

basil-conto commented 6 years ago

Maybe you can complete the word that you want to lookup. Some times looking for "settings" don't get anything but "setting" get results

You mean completing all possible words in a particular language, such as in the following example? https://emacs.stackexchange.com/a/37446/15748

I created a function minutes before to prompt me for a word and call dict command with that word

You can use read-shell-command instead of read-from-minibuffer, if you prefer:

(defun bb/dict-lookup ()
  "Read a word and pass it to dict(1)."
  (interactive)
  (async-shell-command (read-shell-command "Define word: " "dict ")
                       "*dict*"))

This allows editing the dict program with completion, though that may be undesirable for its arguments.

Note, however, that reading arbitrary text from the minibuffer isn't completion, which requires a set of strings to pick from and is what Ivy helps with.