From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45262: Dictionary improvements Date: Tue, 15 Dec 2020 22:05:27 +0200 Organization: LINKOV.NET Message-ID: <87y2hyygf5.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="403"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: torsten hilbrich To: 45262@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 15 21:24:23 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpGru-000Aa8-Lg for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Dec 2020 21:24:22 +0100 Original-Received: from localhost ([::1]:45206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpGrt-0004Uz-NL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Dec 2020 15:24:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpGrd-0004Tn-4K for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 15:24:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpGrb-000403-Hb for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 15:24:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kpGrb-0005Xe-8Z; Tue, 15 Dec 2020 15:24:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: torsten.hilbrich@gmx.net, bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Dec 2020 20:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45262 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: torsten hilbrich Original-Received: via spool by submit@debbugs.gnu.org id=B.160806383821272 (code B ref -1); Tue, 15 Dec 2020 20:24:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Dec 2020 20:23:58 +0000 Original-Received: from localhost ([127.0.0.1]:59231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpGrV-0005X2-ML for submit@debbugs.gnu.org; Tue, 15 Dec 2020 15:23:58 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:39334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpGrR-0005Wg-00 for submit@debbugs.gnu.org; Tue, 15 Dec 2020 15:23:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpGrQ-0004Ru-QX for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 15:23:52 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:38075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpGrL-0003wz-UL for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 15:23:52 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 19EAA60006 for ; Tue, 15 Dec 2020 20:23:44 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.195; envelope-from=juri@linkov.net; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196186 Archived-At: X-Debbugs-CC: Torsten Hilbrich Thanks for merging dictionary to master! I tried to use it, and encountered several minor issues that I propose to improve: 1. For scrolling most other modes use scroll-up-command, and also bind S-SPC to scroll-down-command like this: diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 0df9d8b142..24e2b8d2ee 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -323,8 +323,9 @@ dictionary-mode-map (define-key map "l" 'dictionary-previous) (define-key map "n" 'forward-button) (define-key map "p" 'backward-button) - (define-key map " " 'scroll-up) - (define-key map (read-kbd-macro "M-SPC") 'scroll-down) + (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) + (define-key map (read-kbd-macro "M-SPC") 'scroll-down-command) map) "Keymap for the dictionary mode.") 2. When point is on a multi-word link in the *Dictionary* buffer then the command 'M-x dictionary-search' fetches only one word from the buffer. Instead of this, it could fetch the whole link for possible editing in the minibuffer before searching again: diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 0df9d8b142..24e2b8d2ee 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1119,9 +1120,11 @@ dictionary-display-match-lines ;; - if region is active returns its contents ;; - otherwise return the word near the point (defun dictionary-search-default () - (if (use-region-p) - (buffer-substring-no-properties (region-beginning) (region-end)) - (current-word t))) + (cond + ((use-region-p) + (buffer-substring-no-properties (region-beginning) (region-end))) + ((car (get-char-property (point) 'data))) + (t (current-word t)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User callable commands 3. There is the hook dictionary-mode-hook, and I use it to enable outline-minor-mode in the *Dictionary* buffer (using word entry lines are outline-regexp headings). But there is a need to hide subheadings every time when the *Dictionary* buffer is updated, but there is no such hook. Maybe better to add a hook with a name like dictionary-search-post-hook to be called from dictionary-post-buffer. 4. 'dictionary' uses switch-to-buffer-other-window to force the output buffer in another window. Other commands use pop-to-buffer that requires just such customization to display it in the same window: (push '("\\`\\*Dictionary\\*\\(?:<[^>]+>\\)?\\'" display-buffer-same-window) display-buffer-alist) But since switch-to-buffer-other-window calls pop-to-buffer with 't' for its arg 'action', this means that this requires more complex customization: (push '("\\`\\*Dictionary\\*\\(?:<[^>]+>\\)?\\'" display-buffer-same-window (inhibit-same-window . nil)) display-buffer-alist) The difference is in the need to add '(inhibit-same-window . nil)'. 5. When clicking on a word link in the *Dictionary* buffer, it displays the word definition only in the same dictionary, while it would be better to search it in all dictionaries for more coverage. This is not a patch, but demonstrates the problem. Maybe this should be customizable? diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 0df9d8b142..24e2b8d2ee 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -848,7 +849,7 @@ dictionary-mark-reference (unless (equal word displayed-word) (make-button start end :type 'dictionary-link 'callback call - 'data (cons word dictionary) + 'data (cons word "*") 'help-echo (concat "Press Mouse-2 to lookup \"" word "\" in \"" dictionary "\"")))))