bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45262: Dictionary improvements


From: Juri Linkov
Subject: bug#45262: Dictionary improvements
Date: Tue, 09 Feb 2021 20:31:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]