GNU bug report logs -
#45262
Dictionary improvements
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 15 Dec 2020 20:24:03 UTC
Severity: minor
Tags: fixed, patch
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45262 in the body.
You can then email your comments to 45262 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
torsten.hilbrich <at> gmx.net, bug-gnu-emacs <at> gnu.org
:
bug#45262
; Package
emacs
.
(Tue, 15 Dec 2020 20:24:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
torsten.hilbrich <at> gmx.net, bug-gnu-emacs <at> gnu.org
.
(Tue, 15 Dec 2020 20:24:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
X-Debbugs-CC: Torsten Hilbrich <torsten.hilbrich <at> gmx.net>
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 "\"")))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45262
; Package
emacs
.
(Tue, 09 Feb 2021 18:32:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 45262 <at> debbugs.gnu.org (full text, mbox):
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'.
Added tag(s) fixed.
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Tue, 09 Feb 2021 18:32:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.0.50, send any further explanations to
45262 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Tue, 09 Feb 2021 18:32:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 10 Mar 2021 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 45 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.