GNU bug report logs -
#50067
Context menus
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sun, 15 Aug 2021 08:52:01 UTC
Severity: normal
Tags: fixed
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #225 received at 50067 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Hi. I'm one of the users of Emacs-jp. Tak introduced us to this
> thread and it got me interested, I'm sending this Email. This
> mail thread is huge and I haven't read all of it, so I'm sorry if
> I misread the context.
>
> I've created a context menu for ispell (referencing `context-menu-ffap`).
> You may find some inspiration from this.
>
> (defun context-menu-ispell (menu)
> "Ispell at point menu."
> (when t ;; (ffap-guess-file-name-at-point)
> (define-key menu [ispell-separator] menu-bar-separator)
> (define-key menu [ispell-at-mouse]
> '(menu-item "Check spelling of word" ispell-word
> :help "Check spelling of word under or before the cursor.")))
> menu)
Thanks for the suggestion. I think such menus should be added to their
respective packages. context-menu-ispell could be added to ispell.el
(when flyspell is unavailable).
Then dictionary.el could provide own context menu too:
[context-menu-dictionary.patch (text/x-diff, inline)]
diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index f33cbaf112..7a84f9978f 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1368,5 +1368,27 @@ global-dictionary-tooltip-mode
(if on #'dictionary-tooltip-track-mouse #'ignore))
on))
+(defun dictionary-search-word-at-mouse (event)
+ (interactive "e")
+ (let ((word (save-window-excursion
+ (save-excursion
+ (mouse-set-point event)
+ (current-word)))))
+ (selected-window)
+ (dictionary-search word)))
+
+(defun context-menu-dictionary (menu)
+ "Dictionary word at point menu."
+ (save-excursion
+ (mouse-set-point last-input-event)
+ (when (thing-at-point 'word)
+ (define-key menu [dictionary-separator] menu-bar-separator)
+ (define-key menu [dictionary-search-word-at-mouse]
+ '(menu-item "Dictionary Search" dictionary-search-word-at-mouse
+ :help "Search the word at mouse click in dictionary"))))
+ menu)
+
+(add-hook 'context-menu-functions 'context-menu-dictionary 15)
+
(provide 'dictionary)
;;; dictionary.el ends here
This bug report was last modified 3 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.