unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 45262@debbugs.gnu.org
Subject: bug#45262: Dictionary improvements
Date: Tue, 09 Feb 2021 20:31:11 +0200	[thread overview]
Message-ID: <87im712ivk.fsf@mail.linkov.net> (raw)
In-Reply-To: <87y2hyygf5.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  15 Dec 2020 22:05:27 +0200")

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'.





      reply	other threads:[~2021-02-09 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 20:05 bug#45262: Dictionary improvements Juri Linkov
2021-02-09 18:31 ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im712ivk.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=45262@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).