GNU bug report logs - #43688
Proposal to add dictionary lookups

Previous Next

Package: hyperbole;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Tue, 29 Sep 2020 05:26:01 UTC

Severity: normal

To reply to this bug, email your comments to 43688 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-hyperbole <at> gnu.org:
bug#43688; Package hyperbole. (Tue, 29 Sep 2020 05:26:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Louis <bugs <at> gnu.support>:
New bug report received and forwarded. Copy sent to bug-hyperbole <at> gnu.org. (Tue, 29 Sep 2020 05:26:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: bug-hyperbole <at> gnu.org
Subject: Proposal to add dictionary lookups
Date: Tue, 29 Sep 2020 07:25:06 +0200
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




Information forwarded to bug-hyperbole <at> gnu.org:
bug#43688; Package hyperbole. (Wed, 30 Sep 2020 04:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 43688 <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 43688 <at> debbugs.gnu.org
Subject: Re: bug#43688: Proposal to add dictionary lookups
Date: Wed, 30 Sep 2020 00:01:55 -0400
[Message part 1 (text/plain, inline)]
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 <bugs <at> gnu.support> 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
> Bug-hyperbole <at> gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-hyperbole
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-hyperbole <at> gnu.org:
bug#43688; Package hyperbole. (Wed, 30 Sep 2020 08:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 43688 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: rswgnu <at> gmail.com
Cc: 43688 <at> debbugs.gnu.org
Subject: Re: bug#43688: Proposal to add dictionary lookups
Date: Wed, 30 Sep 2020 11:37:54 +0300
* Robert Weiner <rsw <at> gnu.org> [2020-09-30 07:02]:
> 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

The "look up" function should in my opinion work as follows:

- not only word at point, but if there is region, it should look for
  region, because there is difference between definition of the word
  "going" and the term "going under" and "going ashore" and "going to
  jerusalem". I hope you get the point.

- it should search for local command dico as it is part of GNU system

- if dico does not exist, it should look for dict, local system
  command

- in any case the local command should be customizable as well

- dico and dict, can be then configured which dictionaries to use, by
  default, it should look into local dictionary, then for online
  dictionary, yet that would be outside of Hyperbole

- now when buffer opens with the definition, any word in that buffer
  should be followed with RET for example, while action key should be
  doing what it is doing. RETURN/ENTER would then invoke definition
  for the word at point or region at point. L would come back
  similarly as in Info. Q would quit. I suggest that you see how
  wordnut package works, it uses Wordnet and it works exactly as
  explained. But dico/dict commands can include Wordnet as well, so
  that is only example.

- now if local command does not exist, neither dico, as first being
  from GNU, neither dict, then Hyperbole shall open "!definition WORD"
  in browser on Duckduckcom.go and not just one dictionary. See
  example:
  https://duckduckgo.com/?q=!definition+hyperbole&atb=v154-3am&ia=definition
  as that looks better search for the word then if we use only:
  "!define hyperbole" in this link:
  https://duckduckgo.com/?q=!define+hyperbole&atb=v154-3am

- the buffer with definitions shall include Hyperbole button on the
  bottom, to look up definitions on Internet as well.

Please include the "Clear Word" function or similar in Hyperbole that
will empower users.




This bug report was last modified 4 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.