Subject: Re: bug#43688: Proposal to add dictionary lookups

From: Robert Weiner <[email-masked]>
Date: Wed, 30 Sep 2020 00:01:55 -0400

As you noted, Hyperbole has the web-based Dictionary option on this menu
but it sounds like you want a more flexible dictionary lookup solution.
It would be good if it defaulted to the word at point as well, so we'll
consider that and look at your setup.  -- Bob

On Tue, Sep 29, 2020 at 1:26 AM Jean Louis <[email-masked]> wrote:

> I know there is {C-c /} in Hyperbole to search online Internet and
> also dictionaries.
>
> Now imagine, I am reading the epub file within Emacs, and it is shown
> in Emacs buffers, or I am reading .txt file like Tom Sawyer book, or
> reading email, and there is some word like "conflate", I would like to
> quickly look up the word in dictionaries. It would be good that
> Hyperbole contains some kind of {C-h h DICTIONARY-KEY-HERE} so that
> current word may be looked up straight in dictionary servers.
>
> My quick way of looking up words is to use either offline or online
> dictionary servers.
>
> The wordnut package on Elpa is using Wordnet and when definition opens
> in new buffer, I can again click Enter on any other word, and get
> definition for those other words, I can come back with "l" to previous
> definitions or quit the dictionary buffer with "q". Then I made my own
> "dict" client client, that I can "s-d" on any word, and I will be
> faced with dictionary list and can fetch the definition, if my local
> dict server is available, I can fetch it from local, otherwise from
> online dictionary server.
>
> dict is usually automatically searching first local servers available,
> then remote server as configured.
>
> I am using myself this below to quickly look up words in dictionaries
> and also wordnut-search function, it looks up the word under cursor
> normally.
>
> If Hyperbole has similar feature built-in, I would not need to install
> this type of function on new computers and servers I am accessing and
> where I am using Emacs.
>
> (setq dict/buffer "*Dict*")
>
> (defun tmpbuf (buf)
>   (switch-to-buffer
>    (get-buffer-create (concat "*" buf "*"))))
>
> (defun dict/kill-dict ()
>   (interactive)
>   (kill-buffer dict/buffer))
>
> (defun dictd-dictionaries (&optional host)
>   "Returns the list of dictionaries and their names"
>   (let* ((command (if host (format "dict -D -h %s" host) "dict -D"))
>          (dictionaries (shell-command-to-string command))
>          (dictionaries (split-string dictionaries "\n")))
>     (pop dictionaries)
>     (mapcar 'string-trim dictionaries)))
>
> (defun dict/query ()
>   (interactive)
>   (let* ((word (current-word 1))
>          (dictionary (completing-read  "Dictionary: "
> (dictd-dictionaries)))
>          (dictionary (first (split-string dictionary)))
>          (dict (format "dict -d %s \"%s\"" dictionary word))
>          (statement (shell-command-to-string dict)))
>     (get-buffer-create dict/buffer)
>     (switch-to-buffer dict/buffer)
>     (erase-buffer)
>     (local-set-key (kbd "q") 'dict/kill-dict)
>     (local-set-key (kbd "<return>") 'dict/query)
>     (insert statement)
>     (goto-char 1)))
>
> (global-set-key (kbd "s-d") 'dict/query)
>
>
>
>
>
> I use:  Editor:      GNU Emacs 28.0.50 (build 15, x86_64-pc-linux-gnu, X
> toolkit, cairo version 1.14.8, Xaw3d scroll bars)
>
>         Hyperbole:   7.1.2
>         Sys Type:    x86_64-pc-linux-gnu
>         OS Type:     gnu/linux
>         Window Sys:  x
>         News Reader: Gnus v5.13
>
>
>
> _______________________________________________
> Bug-hyperbole mailing list
> [email-masked]
> https://lists.gnu.org/mailman/listinfo/bug-hyperbole
>