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, 09 Feb 2021 20:31:11 +0200 Organization: LINKOV.NET Message-ID: <87im712ivk.fsf@mail.linkov.net> References: <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="23041"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) To: 45262@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 09 19:39:17 2021 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 1l9Xuv-0005uL-3u for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 19:39:17 +0100 Original-Received: from localhost ([::1]:58802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9Xus-0007N0-Cr for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 13:39:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9Xnx-0007qX-5z for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 13:32:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43028) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9Xnu-0000a5-7E for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 13:32:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9Xnu-0007yo-3c for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 13:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Feb 2021 18:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45262 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45262-submit@debbugs.gnu.org id=B45262.161289550830648 (code B ref 45262); Tue, 09 Feb 2021 18:32:02 +0000 Original-Received: (at 45262) by debbugs.gnu.org; 9 Feb 2021 18:31:48 +0000 Original-Received: from localhost ([127.0.0.1]:54572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9Xnf-0007yD-K0 for submit@debbugs.gnu.org; Tue, 09 Feb 2021 13:31:47 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:56851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9Xnd-0007xw-Vf; Tue, 09 Feb 2021 13:31:46 -0500 X-Originating-IP: 91.129.108.204 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 7419E60003; Tue, 9 Feb 2021 18:31:37 +0000 (UTC) In-Reply-To: <87y2hyygf5.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 15 Dec 2020 22:05:27 +0200") 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:199711 Archived-At: tags 45262 fixed close 45262 28.0.50 quit > Thanks for merging dictionary to master! I tried to use it, > and encountered several minor issues that I propose to improve: I guess it's time now to close this request. > 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.") Now pushed to master in 552d2b9083. > 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)))) Pushed to master in the same commit. > 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. Added a new hook 'dictionary-post-buffer-hook'. > 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)'. Not changed since there are many commands that use switch-to-buffer-other-window, so it looks like a legitimate use. > 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? Added a new customizable option 'dictionary-link-dictionary'.