unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Juri Linkov <juri@linkov.net>
Cc: 50552@debbugs.gnu.org
Subject: bug#50552: 28.0.50; Add context-menu-occur
Date: Fri, 01 Oct 2021 16:28:02 +0000	[thread overview]
Message-ID: <87wnmwk8vh.fsf@posteo.net> (raw)
In-Reply-To: <874ka4v5ae.fsf@posteo.net> (Philip Kaludercic's message of "Tue,  28 Sep 2021 22:00:57 +0200")

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

Philip Kaludercic <philipk@posteo.net> writes:

> Juri Linkov <juri@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Insert-dictionary-context-menu-at-right-position.patch --]
[-- Type: text/x-diff, Size: 1147 bytes --]

From 375390ff1e8e6fff4a9675f7430721025b31cffe Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@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


[-- Attachment #3: Type: text/plain, Size: 24 bytes --]


-- 
	Philip Kaludercic

  parent reply	other threads:[~2021-10-01 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12 16:54 bug#50552: 28.0.50; Add context-menu-occur Philip Kaludercic
2021-09-12 17:59 ` Juri Linkov
2021-09-12 19:09   ` Philip Kaludercic
2021-09-13  8:28     ` Juri Linkov
2021-09-14 20:45       ` Philip Kaludercic
2021-09-15  7:14         ` Juri Linkov
2021-09-28 20:00       ` Philip Kaludercic
2021-09-29  7:19         ` Juri Linkov
2021-09-29 10:00           ` Philip Kaludercic
2021-09-29 17:31             ` Juri Linkov
2021-10-02 19:29               ` Juri Linkov
2021-10-01 16:28         ` Philip Kaludercic [this message]
2021-10-02 19:25           ` Juri Linkov

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=87wnmwk8vh.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=50552@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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).