GNU bug report logs - #50552
28.0.50; Add context-menu-occur

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Sun, 12 Sep 2021 16:55: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 #39 received at 50552 <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Juri Linkov <juri <at> linkov.net>
Cc: 50552 <at> debbugs.gnu.org
Subject: Re: bug#50552: 28.0.50; Add context-menu-occur
Date: Fri, 01 Oct 2021 16:28:02 +0000
[Message part 1 (text/plain, inline)]
Philip Kaludercic <philipk <at> posteo.net> writes:

> Juri Linkov <juri <at> linkov.net> writes:
>
>>> I see, but I wonder why dictionary.el directly manipulates
>>> context-menu-functions with add-hook.
>>
>> The reasoning was the following: by default, dictionary.el is not loaded,
>> so its context menu item is not used.  But when the user wants to use
>> dictionary.el and explicitly loads it, then automatically provide also
>> its context menu item.
>
> On this topic, I am not sure how good it is to do this
> automatically. One effect seems to be that context-menu-dictionary
> inserts itself at an unintended place in the menu (in my case as the
> first item, even though I'd prefer it to be further down).

It turns out the issue here is that context-menu-dictionary uses
define-key instead of define-key-after. Here is a patch to fix it:

[0001-Insert-dictionary-context-menu-at-right-position.patch (text/x-diff, inline)]
From 375390ff1e8e6fff4a9675f7430721025b31cffe Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk <at> posteo.net>
Date: Fri, 1 Oct 2021 18:27:37 +0200
Subject: [PATCH] Insert dictionary context menu at right position

* dictionary.el (context-menu-dictionary): Use define-key-after
  instead of define-key (bug#50552)
---
 lisp/net/dictionary.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 86447c2c35..258025fc51 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1382,8 +1382,8 @@ context-menu-dictionary
 the context menu will contain an item that searches
 the word at mouse click."
   (when (thing-at-mouse click 'word)
-    (define-key menu [dictionary-separator] menu-bar-separator)
-    (define-key menu [dictionary-search-word-at-mouse]
+    (define-key-after menu [dictionary-separator] menu-bar-separator)
+    (define-key-after 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)
-- 
2.30.2

[Message part 3 (text/plain, inline)]
-- 
	Philip Kaludercic

This bug report was last modified 3 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.