GNU bug report logs - #62250
29.0.60; Allow context menu from text properties to not override everything

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Augusto Stoffel <arstoffel@HIDDEN>; dated Sat, 18 Mar 2023 07:52:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 2 Apr 2023 16:41:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 02 12:41:27 2023
Received: from localhost ([127.0.0.1]:42504 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pj0li-0000vj-UP
	for submit <at> debbugs.gnu.org; Sun, 02 Apr 2023 12:41:27 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:48767)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pj0lg-0000v2-VT
 for 62250 <at> debbugs.gnu.org; Sun, 02 Apr 2023 12:41:25 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id DB75E60004;
 Sun,  2 Apr 2023 16:41:18 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <86fsa0r60v.fsf@HIDDEN> (Juri Linkov's message of "Sun, 
 19 Mar 2023 19:43:28 +0200")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <865yaxq5xh.fsf@HIDDEN>
 <87cz55rjir.fsf@HIDDEN> <86fsa0r60v.fsf@HIDDEN>
Date: Sun, 02 Apr 2023 19:35:15 +0300
Message-ID: <86a5zqcke4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

>> Just for the record, this would be useful to create a
>> context menu for images.
>
> The patch below will allow using the text property like
>
>   'context-menu-functions '(image-context-menu)

Here is a complete patch that uses the new text property
for create a context menu for images:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=context-menu-functions.patch

diff --git a/lisp/iimage.el b/lisp/iimage.el
index b4c175a7b63..8235c4a6fdb 100644
--- a/lisp/iimage.el
+++ b/lisp/iimage.el
@@ -134,6 +134,7 @@ iimage-mode-buffer
                                     :max-width (- (nth 2 edges) (nth 0 edges))
 				    :max-height (- (nth 3 edges) (nth 1 edges)))
                      keymap ,image-map
+                     context-menu-functions (image-context-menu)
                      modification-hooks
                      (iimage-modification-hook)))
                 (remove-list-of-text-properties
diff --git a/lisp/image.el b/lisp/image.el
index 2372fd1ce09..11bf46c80cc 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -188,6 +188,29 @@ image-map
   "C-<wheel-up>"   #'image-mouse-increase-size
   "C-<mouse-4>"    #'image-mouse-increase-size)
 
+(defun image-context-menu (menu click)
+  "Populate MENU with image-related commands at CLICK."
+  (when (mouse-posn-property (event-start click) 'display)
+    (define-key menu [image-separator] menu-bar-separator)
+    (let ((easy-menu (make-sparse-keymap "Image")))
+      (easy-menu-define nil easy-menu nil
+        '("Image"
+          ["Zoom In" image-increase-size
+           :help "Enlarge the image"]
+          ["Zoom Out" image-decrease-size
+           :help "Shrink the image"]
+          ["Rotate Clockwise" image-rotate
+           :help "Rotate the image"]
+          ["Flip horizontally" image-flip-horizontally
+           :help "Flip horizontally"]
+          ["Flip vertically" image-flip-vertically
+           :help "Flip vertically"]))
+      (dolist (item (reverse (lookup-key easy-menu [menu-bar image])))
+        (when (consp item)
+          (define-key menu (vector (car item)) (cdr item))))))
+
+  menu)
+
 (defun image-load-path-for-library (library image &optional path no-error)
   "Return a suitable search path for images used by LIBRARY.
 
@@ -615,6 +638,7 @@ put-image
       (overlay-put overlay 'put-image t)
       (overlay-put overlay 'before-string string)
       (overlay-put overlay 'keymap image-map)
+      (overlay-put overlay 'context-menu-functions '(image-context-menu))
       overlay)))
 
 
@@ -665,7 +689,9 @@ insert-image
 				      image)
                                    rear-nonsticky t
 				   inhibit-isearch ,inhibit-isearch
-                                   keymap ,image-map))))
+                                   keymap ,image-map
+                                   context-menu-functions
+                                   (image-context-menu)))))
 
 
 ;;;###autoload
@@ -702,7 +728,9 @@ insert-sliced-image
 	  (add-text-properties start (point)
 			       `(display ,(list (list 'slice x y dx dy) image)
 					 rear-nonsticky (display)
-                                         keymap ,image-map))
+                                         keymap ,image-map
+                                         context-menu-functions
+                                         (image-context-menu)))
 	  (setq x (+ x dx))))
       (setq x 0.0
 	    y (+ y dy))
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 6b9accd6758..2cd2840bad9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -368,9 +368,10 @@ context-menu-map
 the function `context-menu-filter-function'."
   (let* ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))
          (click (or click last-input-event))
-         (window (posn-window (event-start click)))
-         (fun (mouse-posn-property (event-start click)
-                                   'context-menu-function)))
+         (start (event-start click))
+         (window (posn-window start))
+         (fun (mouse-posn-property start 'context-menu-function))
+         (funs (mouse-posn-property start 'context-menu-functions)))
 
     (unless (eq (selected-window) window)
       (select-window window))
@@ -380,7 +381,9 @@ context-menu-map
       (run-hook-wrapped 'context-menu-functions
                         (lambda (fun)
                           (setq menu (funcall fun menu click))
-                          nil)))
+                          nil))
+      (dolist (fun funs)
+        (setq menu (funcall fun menu click))))
 
     ;; Remove duplicate separators as well as ones at the beginning or
     ;; end of the menu.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 20 Mar 2023 18:36:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 20 14:36:46 2023
Received: from localhost ([127.0.0.1]:56797 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1peKNC-0001rC-G5
	for submit <at> debbugs.gnu.org; Mon, 20 Mar 2023 14:36:46 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:47993)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1peKN7-0001qk-J7
 for 62250 <at> debbugs.gnu.org; Mon, 20 Mar 2023 14:36:41 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id CD351C0002;
 Mon, 20 Mar 2023 18:36:34 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <874jqgzjoe.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 19
 Mar 2023 19:21:21 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <865yaxq5xh.fsf@HIDDEN>
 <87cz55rjir.fsf@HIDDEN> <86fsa0r60v.fsf@HIDDEN>
 <874jqgzjoe.fsf@HIDDEN>
Date: Mon, 20 Mar 2023 20:34:59 +0200
Message-ID: <86bkkns23w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> The patch below will allow using the text property like
>>
>>   'context-menu-functions '(image-context-menu)
>
> I didn't test the patch (I don't understand click events very well), but
> does it find the context-menu-functions property of overlays as well?

It should be able to find the property in overlays as well.

> And would those override the context-menu-functions text property or get
> merged?

This needs confirming, but I guess overlays take priority over text properties.

>>        (run-hook-wrapped 'context-menu-functions
>>                          (lambda (fun)
>>                            (setq menu (funcall fun menu click))
>> -                          nil)))
>> +                          nil))
>> +      (dolist (fun funs)
>> +        (setq menu (funcall fun menu click))))
>>  
>>      ;; Remove duplicate separators as well as ones at the beginning or
>>      ;; end of the menu.
>
> I believe this makes the menu entries coming from a text property appear
> after the regular hook ones, while I would expect the opposite (stuff
> specific to the point is more "urgent").

When text properties are processed later, they have a chance to decide
where they add their menu items: at the top of the context menu, at the
bottom, or anywhere in the middle.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 20 Mar 2023 18:36:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 20 14:36:41 2023
Received: from localhost ([127.0.0.1]:56794 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1peKN7-0001qv-5k
	for submit <at> debbugs.gnu.org; Mon, 20 Mar 2023 14:36:41 -0400
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:51697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1peKN4-0001qg-Ua
 for 62250 <at> debbugs.gnu.org; Mon, 20 Mar 2023 14:36:39 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 6AFED1BF203;
 Mon, 20 Mar 2023 18:36:30 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <878rfszk6l.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 19
 Mar 2023 19:10:26 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <86fsa1or67.fsf@HIDDEN>
 <878rftrjah.fsf@HIDDEN> <86h6ugu2oy.fsf@HIDDEN>
 <878rfszk6l.fsf@HIDDEN>
Date: Mon, 20 Mar 2023 20:29:14 +0200
Message-ID: <86pm93s2dh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: Eli Zaretskii <eliz@HIDDEN>, 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I actually have the same question: why should the singular
> context-menu-function override everything else?  Flyspell could just put
> the suggestion list inside a submenu.  It would be more usable.

The problem is that flyspell requires too much refactoring to
be able to put the suggestion list inside a submenu.  No one
volunteered to undertake such an endeavor.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 19 Mar 2023 18:21:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 19 14:21:31 2023
Received: from localhost ([127.0.0.1]:52717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdxet-0003Mr-Ag
	for submit <at> debbugs.gnu.org; Sun, 19 Mar 2023 14:21:31 -0400
Received: from mail-ed1-f50.google.com ([209.85.208.50]:41916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdxer-0003Mb-RI
 for 62250 <at> debbugs.gnu.org; Sun, 19 Mar 2023 14:21:30 -0400
Received: by mail-ed1-f50.google.com with SMTP id h8so38726948ede.8
 for <62250 <at> debbugs.gnu.org>; Sun, 19 Mar 2023 11:21:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679250083;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=KoVdR5Qmz1uDV9rh82OvunorwLFtGgMxS3LM0F32VS0=;
 b=S0+e77b6ZRjJDyxcuMlQGSWV+Xrw9JSCdoqWZXHSXl43GySyPxQ0npe1zZUseDA6EC
 fbQ+yfiFoOt7WFLRg7W6A06Ab1zUZDuhlbfzQr9OK7lImrIl4ZM7Fp1PWfz/e0c9SDlQ
 gPIkBM7YGe6/j5ASGNg0w5qtmIzIK1U7/JvPmd7UyMxz57dIqxtWfYiPHhVLjZzYnB4d
 QAXpWibSCTGTjSWrxP81XaujoN8ldeIPV296Q2wyquF1hb1xvYy+QDjtywiFIJC06yo8
 Pjpfo4HdGMTpaKYTLw+btLn5QzeEOGDt/VJIItEDc+qGsPfRmVEhbL/nr327tze+PKGt
 S3/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679250083;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=KoVdR5Qmz1uDV9rh82OvunorwLFtGgMxS3LM0F32VS0=;
 b=0YQu6rY+UWmVXUQlswzmTMbGMa8Tftevs0rPQEZda43jW+HQot2FCiy8ltAHmsh1RL
 72OqEi3bS4eYIz2cUbIbWQ3j9wJIh5vglbbdFvZOAXDhSEZrFs13vexlndK3IS2kEZT0
 9URq5E7M9R1VjuaSLs9yMIdhJPTNVfGh9xm7ZKdoAyLBHhxBBaq2OEZVMNmq7MybOGmO
 oVAnvpJCj5PMXqe4kil2vsDpzMgseK2qO/gcXALGRxXL57fFnJety/6E0HZEluBVrnt0
 CKGqes3hXgnT34Yr8K7WEYXGh6yLN2t0p3D8tv1JnQDag+8kKBidqP54Bhush9zk1kqm
 Kiew==
X-Gm-Message-State: AO0yUKXfNt/nFU8HgyRXcq05urGMphhyruEvKpJ8XCaXQc2k0Butq3dS
 Wfn8HTlEBmvGhuyc7wLOIEUUIpDPlBQ=
X-Google-Smtp-Source: AK7set8g+F4aUIValp/wDmtxYdpBq/Vd0kgJF6SoOVGLE2qHWic3DPUiYzzW2roF0fcl+OSpgwOITg==
X-Received: by 2002:a17:907:212b:b0:92f:8353:2aaf with SMTP id
 qo11-20020a170907212b00b0092f83532aafmr6647456ejb.70.1679250083445; 
 Sun, 19 Mar 2023 11:21:23 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 z24-20020a17090674d800b009289de993e2sm3509320ejl.216.2023.03.19.11.21.22
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 19 Mar 2023 11:21:23 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <86fsa0r60v.fsf@HIDDEN> (Juri Linkov's message of "Sun, 
 19 Mar 2023 19:43:28 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <865yaxq5xh.fsf@HIDDEN>
 <87cz55rjir.fsf@HIDDEN> <86fsa0r60v.fsf@HIDDEN>
Date: Sun, 19 Mar 2023 19:21:21 +0100
Message-ID: <874jqgzjoe.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, 19 Mar 2023 at 19:43, Juri Linkov wrote:

> The patch below will allow using the text property like
>
>   'context-menu-functions '(image-context-menu)

I didn't test the patch (I don't understand click events very well), but
does it find the context-menu-functions property of overlays as well?
And would those override the context-menu-functions text property or get
merged?

>        (run-hook-wrapped 'context-menu-functions
>                          (lambda (fun)
>                            (setq menu (funcall fun menu click))
> -                          nil)))
> +                          nil))
> +      (dolist (fun funs)
> +        (setq menu (funcall fun menu click))))
>  
>      ;; Remove duplicate separators as well as ones at the beginning or
>      ;; end of the menu.

I believe this makes the menu entries coming from a text property appear
after the regular hook ones, while I would expect the opposite (stuff
specific to the point is more "urgent").




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 19 Mar 2023 18:10:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 19 14:10:37 2023
Received: from localhost ([127.0.0.1]:52700 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdxUK-00035a-PX
	for submit <at> debbugs.gnu.org; Sun, 19 Mar 2023 14:10:37 -0400
Received: from mail-ed1-f43.google.com ([209.85.208.43]:33576)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdxUI-00035M-NL
 for 62250 <at> debbugs.gnu.org; Sun, 19 Mar 2023 14:10:35 -0400
Received: by mail-ed1-f43.google.com with SMTP id er8so26965347edb.0
 for <62250 <at> debbugs.gnu.org>; Sun, 19 Mar 2023 11:10:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679249428;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=1hf2sGwyXQR2yCAb/Xteuneh4AINGTSfU52Hdcw56/4=;
 b=KZAViGaoijKJEeeolsWnKxLjtWTh8xTGA/gdRWMdI6wFrf/3a1ZnNPlMNHajRaBtq2
 EGA1I/HtJuymiIB4ob4nLvAJc2dgQdIvkeAAPIOeKMjXbT4eah0N06UYlsx5C7nj0rij
 WqhOfpRG0IdKQ4IJGWi1/6uTbPYcoNdyBUjvQOj2Qvr5ED9Q6hAS7DzpwG56C+j349xK
 +YqKDQxdhEif0mkLGTYv7/tpP1DHDzgvGaazTZRMsEQzgudXDbhQWMt6t9Y9p4PpwE7m
 PCzTnUg4dw/6MB+Y+ukHHXDzMNWmhRvOipzonKBS8wN19+4f0GCwSxZ9o8EDmKRFZmnZ
 hUSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679249428;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=1hf2sGwyXQR2yCAb/Xteuneh4AINGTSfU52Hdcw56/4=;
 b=Xxx2s4xGEwTJZ3GLVMpi/FMHVglMw28e36kojtCpRaIm0XpvJN2BBN15cGjMCYX60U
 yXyPanHhxn82QOWstyPw2iiKF0F3rZEX9MzBSfgSSHuGzgL+0IkaZ2ovxJEep9tCjcOw
 mgpr8jwMEkVlc7bWfssnfRgOAmNd+nFK/VcHgL7aFyAajQqGxzeSYU3pPjPRM7e5qUlO
 a96q/noucNtCv4MFctUtE8EAI03QiHY3zPgbRGExkrRpT3JVuQytCLswH0Ou0Frf90d4
 pyuXi/909LdbueLgowUXhIxhAYc/nNgdYZOZoqWxThE7V5ATEmCfz6ueHKNUtQhMtcPb
 7Wlg==
X-Gm-Message-State: AO0yUKVgTAXU15RfbUtLzUGjFDvBVy8PndmjXvuPTZdkISp6QxUgGJng
 IDwmrZEjxPLn7svi3tdyAgAMRUn13Sc=
X-Google-Smtp-Source: AK7set8YJg/TzXDil1FyXCuV6mvW3rg7Q+VbstniulCns1UeGqFcLh2aQDK1+DsCG00upun5frHZkg==
X-Received: by 2002:a17:906:174c:b0:878:5372:a34b with SMTP id
 d12-20020a170906174c00b008785372a34bmr6704182eje.45.1679249428366; 
 Sun, 19 Mar 2023 11:10:28 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 c16-20020a170906925000b009327f9a397csm2779964ejx.145.2023.03.19.11.10.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 19 Mar 2023 11:10:27 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <86h6ugu2oy.fsf@HIDDEN> (Juri Linkov's message of "Sun, 
 19 Mar 2023 19:40:09 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <86fsa1or67.fsf@HIDDEN>
 <878rftrjah.fsf@HIDDEN> <86h6ugu2oy.fsf@HIDDEN>
Date: Sun, 19 Mar 2023 19:10:26 +0100
Message-ID: <878rfszk6l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: Eli Zaretskii <eliz@HIDDEN>, 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, 19 Mar 2023 at 19:40, Juri Linkov wrote:

> What I still don't understand is why a function in the middle of
> context-menu-functions should be able to say "I'm the boss" and
> override everything that comes later.

Right, I actually have the same question: why should the singular
context-menu-function override everything else?  Flyspell could just put
the suggestion list inside a submenu.  It would be more usable.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 19 Mar 2023 17:53:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 19 13:53:14 2023
Received: from localhost ([127.0.0.1]:52691 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdxDW-0002el-0Z
	for submit <at> debbugs.gnu.org; Sun, 19 Mar 2023 13:53:14 -0400
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:43433)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pdxDT-0002e8-M1
 for 62250 <at> debbugs.gnu.org; Sun, 19 Mar 2023 13:53:12 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id B95151BF206;
 Sun, 19 Mar 2023 17:53:04 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <87cz55rjir.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 18
 Mar 2023 19:39:40 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <865yaxq5xh.fsf@HIDDEN>
 <87cz55rjir.fsf@HIDDEN>
Date: Sun, 19 Mar 2023 19:43:28 +0200
Message-ID: <86fsa0r60v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

>> I already envisioned such request
>
> All right.  Just for the record, this would be useful to create a
> context menu for images.

The patch below will allow using the text property like

  'context-menu-functions '(image-context-menu)

> Also, I could take advantage of it to slightly
> simplify the context menu of jit-spell.

Actually, flyspell was the reason why the text property
`context-menu-function' overrides everything:

1. `make-flyspell-overlay' puts an overlay property

   (overlay-put overlay 'context-menu-function 'flyspell-context-menu)

2. `flyspell-context-menu' returns `flyspell-correct-word'

3. `context-menu-map' should return this symbol unmodified

4. at the end, the symbol `flyspell-correct-word' is executed
   as a command from the menu binding in `context-menu-entry'
   or from `context-menu-open':

    (if (commandp map)
        (call-interactively map)


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=context-menu-functions.patch

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 6b9accd6758..2cd2840bad9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -368,9 +368,10 @@ context-menu-map
 the function `context-menu-filter-function'."
   (let* ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))
          (click (or click last-input-event))
-         (window (posn-window (event-start click)))
-         (fun (mouse-posn-property (event-start click)
-                                   'context-menu-function)))
+         (start (event-start click))
+         (window (posn-window start))
+         (fun (mouse-posn-property start 'context-menu-function))
+         (funs (mouse-posn-property start 'context-menu-functions)))
 
     (unless (eq (selected-window) window)
       (select-window window))
@@ -380,7 +381,9 @@ context-menu-map
       (run-hook-wrapped 'context-menu-functions
                         (lambda (fun)
                           (setq menu (funcall fun menu click))
-                          nil)))
+                          nil))
+      (dolist (fun funs)
+        (setq menu (funcall fun menu click))))
 
     ;; Remove duplicate separators as well as ones at the beginning or
     ;; end of the menu.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 19 Mar 2023 17:53:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 19 13:53:07 2023
Received: from localhost ([127.0.0.1]:52686 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdxDP-0002eG-8l
	for submit <at> debbugs.gnu.org; Sun, 19 Mar 2023 13:53:07 -0400
Received: from relay11.mail.gandi.net ([217.70.178.231]:55033)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pdxDN-0002dc-SZ
 for 62250 <at> debbugs.gnu.org; Sun, 19 Mar 2023 13:53:06 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id C2A51100003;
 Sun, 19 Mar 2023 17:52:56 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <878rftrjah.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 18
 Mar 2023 19:44:38 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <86fsa1or67.fsf@HIDDEN>
 <878rftrjah.fsf@HIDDEN>
Date: Sun, 19 Mar 2023 19:40:09 +0200
Message-ID: <86h6ugu2oy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: Eli Zaretskii <eliz@HIDDEN>, 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Actually, a member of context-menu-functions can override the
>> previous menu it receives as an argument.  And the last member
>> always wins by overriding the whole menu.  So it's just a question
>> of ordering the members of context-menu-functions.
>
> Right.  What I suggested would make the overriding independent of the
> ordering of the members, which also (typically) influences the order of
> the menu items.  But maybe overriding the menu is not such a common
> use-case anyway, and either mechanism is sufficient.

What I still don't understand is why a function in the middle of
context-menu-functions should be able to say "I'm the boss" and
override everything that comes later.  Maybe this could be
implemented as well if needed, but the current implementation already
allows adding such a function to the end by specifying quite a large
value for the argument DEPTH of `add-hook'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 18:44:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 14:44:48 2023
Received: from localhost ([127.0.0.1]:49067 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdbXr-0003vQ-R1
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:44:48 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:36515)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdbXq-0003vD-Bx
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:44:46 -0400
Received: by mail-ed1-f41.google.com with SMTP id w9so32394615edc.3
 for <62250 <at> debbugs.gnu.org>; Sat, 18 Mar 2023 11:44:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679165080;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=eKzzJ/K0Z2KAooumUsOwJT4bXBrJ0FOwEqbBWxJi2XY=;
 b=VQm2lTc8qDm1jANQETdVwigFnveS80eC/7iWbSyvG5JzFQ8FHDRIvGfQ5x5f1S9cc0
 jLFEnm5HShvYoFULmxaeRD34scvj4GORrCrZzuakVFrBV1kgShnUM08jhLiYz0xFKvc3
 U7qsbcdxbiJjxeHqPxqNI9WmOtjfKhl8fYLuQbn/v3ulx50garsI0hhSdGVzIuJ0Q/gj
 y+bEn2U0Jt2DoSMMX1v1eJmP4zPJHCbymLqRY4F3E1xrsaw+hn2vq5ywc5HRTiR0+nh5
 BENoprMnkUp/sQm6mrAK1WVvUbZRscwyifap87KeLjHokhEdgbtp3t6GZb3+O+vL9YcV
 FHkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679165080;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=eKzzJ/K0Z2KAooumUsOwJT4bXBrJ0FOwEqbBWxJi2XY=;
 b=TqyfkXZo0rYILge1pqNE7gNI9C2kBA5D9KJpdskqBy8MkJ9e2i18wp/KvaU8MS1gYw
 w4eDoMD0bmRYEjZX7o+43hjLrY4xF7mhIHlddnXNG2Rno4JgaZ3MmypMJVsLZErI1R3D
 uxJIDoI3O0mUBhaUUG6x1sKF2AXPl9OF8Sd5l3vNG9ESCv+8TNphfZbtHhrrfablhb/i
 5yzA8QWIoydVI1bLTpuTnJ4vcmrdW96YXBgK3TKEznECAs3SAQBSdFqUiuBgiJyzu350
 vHIISmPl2TIVALiZ7gnfEdFCSVg29MzWGE8GTcFnMpGxz4BuTaVMdXUrUbauRFRWvHY0
 H24w==
X-Gm-Message-State: AO0yUKWe1eQvKpyVMFddmq9nibjdNdXsVZj0M+MaU6iZSGsshnn7R1Zf
 gUlz5ejlIkWsYg3U4jyW0NExg7BXVQA=
X-Google-Smtp-Source: AK7set8t5QoRae7dhoAFLL23Pe4eb8wfhVlOHUVPBvihgqJc7wZEKYdxkx53VvENdsUgE0W7RqD5Nw==
X-Received: by 2002:a17:906:33d0:b0:932:dae5:2af9 with SMTP id
 w16-20020a17090633d000b00932dae52af9mr3596168eja.51.1679165080057; 
 Sat, 18 Mar 2023 11:44:40 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 e28-20020a170906749c00b0092a7c28c348sm2442192ejl.69.2023.03.18.11.44.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 11:44:39 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <86fsa1or67.fsf@HIDDEN> (Juri Linkov's message of "Sat, 
 18 Mar 2023 20:10:40 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <86fsa1or67.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 19:44:38 +0100
Message-ID: <878rftrjah.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: Eli Zaretskii <eliz@HIDDEN>, 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, 18 Mar 2023 at 20:10, Juri Linkov wrote:

>> Note that currently a member of context-menu-functions cannot override
>> the menu,
>
> Actually, a member of context-menu-functions can override the
> previous menu it receives as an argument.  And the last member
> always wins by overriding the whole menu.  So it's just a question
> of ordering the members of context-menu-functions.

Right.  What I suggested would make the overriding independent of the
ordering of the members, which also (typically) influences the order of
the menu items.  But maybe overriding the menu is not such a common
use-case anyway, and either mechanism is sufficient.

The really interesting feature would be to be able to add to the context
menu with a text property.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 18:39:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 14:39:50 2023
Received: from localhost ([127.0.0.1]:49062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdbT4-0003nf-2s
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:39:50 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:34538)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdbT2-0003nR-IA
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:39:48 -0400
Received: by mail-ed1-f41.google.com with SMTP id x13so32364057edd.1
 for <62250 <at> debbugs.gnu.org>; Sat, 18 Mar 2023 11:39:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679164782;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=nicWuPw7IkzPqlTqrobWpyFV02eMCZ++nkk7Y1zDcpo=;
 b=R1sHAWEAlo+SC2OuuWMZ2auylkaI3C5Jffbjb+vtjh0lwhr4NZ2x6Pq2OdeBXBnk2J
 OFnwVxCswdshRodJxA+zY1kROOPLs+AZGN+xMsfbvMaplhHxk46PIuA42s7bNPS32N4a
 6uZrS9E1P+LWDaNhQt3AqW/BXrZ5sDskCp5KCHyv4EVPAtp0NXEF0zcZOR1Va7SxbRCk
 ummf4Xoc3mCh31mUnQSp4rzv4CZQRAwEap0aRaRO5uq60cIYJ5IHzjVN20Vip3K7DS+D
 NxLFAY6kbty9w9/IrGSzVZkSt37jTXNAMUuqu/2GMGrrAnK150XT5CxKRiEx/nb9UvMb
 g4Qg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679164782;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nicWuPw7IkzPqlTqrobWpyFV02eMCZ++nkk7Y1zDcpo=;
 b=4ep5swKcr+5d7Vcv6oLYt1Gp8QyimG9Eujt9EuKbmwQFSvO+zYXZiVOWnSfykYyJAH
 e/ohPaLRDfWx3nxxjmpBDduNIln0X6ZfxFFeLpNXcbg8c6FoL0RraTEPRGy32Mr7ux2V
 E84C5cTQLBUrf+wB/mI7SxGpsCL8n+eX0Y6NNsAHnpC+BDhwHxEg/aMO3q7OANQ5a6Jm
 K9hbCxkfkoU2VwFPcFItTkgrpoKL/WF9YdrKHK2VPjE1LzjNXasszJamXVhNrPgW3GIG
 GS/8ZsG7DNudWatAcPIVbfoOMayQRs2lOjzVDrGyg8xyNSBwYSZTQRgzbyxu2EzUhAig
 uLTw==
X-Gm-Message-State: AO0yUKUGvkM4SEKbJ0V0677H2TNMm1DQHDUtAHooxgacGqhgB4thCaDT
 D+cOaUCpWIC1NT4ZCCOGi+rNd3ObOLs=
X-Google-Smtp-Source: AK7set/qL3ocoyJouVOm3VB8Ywk46lY+nxiyWqNjYeq47j/oh078vH9YSLchhROn1oXuAQIWNa1EUQ==
X-Received: by 2002:a05:6402:219:b0:4af:51b6:fe49 with SMTP id
 t25-20020a056402021900b004af51b6fe49mr7443257edv.13.1679164782187; 
 Sat, 18 Mar 2023 11:39:42 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 1-20020a508e41000000b004fc6709cdd6sm2690576edx.35.2023.03.18.11.39.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 11:39:41 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <865yaxq5xh.fsf@HIDDEN> (Juri Linkov's message of "Sat, 
 18 Mar 2023 20:08:34 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <865yaxq5xh.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 19:39:40 +0100
Message-ID: <87cz55rjir.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, 18 Mar 2023 at 20:08, Juri Linkov wrote:

> I already envisioned such request

All right.  Just for the record, this would be useful to create a
context menu for images.  Also, I could take advantage of it to slightly
simplify the context menu of jit-spell.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 18:29:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 14:29:06 2023
Received: from localhost ([127.0.0.1]:49049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdbIg-0003WR-Ad
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:29:06 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:35455)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pdbIe-0003Vl-Nf
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:29:05 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 7FE551C000C;
 Sat, 18 Mar 2023 18:28:55 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <878rfu1f37.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 18
 Mar 2023 12:19:56 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 20:10:40 +0200
Message-ID: <86fsa1or67.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: Eli Zaretskii <eliz@HIDDEN>, 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Note that currently a member of context-menu-functions cannot override
> the menu,

Actually, a member of context-menu-functions can override the
previous menu it receives as an argument.  And the last member
always wins by overriding the whole menu.  So it's just a question
of ordering the members of context-menu-functions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 18:29:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 14:29:02 2023
Received: from localhost ([127.0.0.1]:49046 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdbIb-0003WB-Vl
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:29:02 -0400
Received: from relay10.mail.gandi.net ([217.70.178.230]:39049)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pdbIZ-0003Va-OT
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 14:29:00 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 544D124000C;
 Sat, 18 Mar 2023 18:28:51 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <87ttyixzt2.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 18
 Mar 2023 08:51:21 +0100")
Organization: LINKOV.NET
References: <87ttyixzt2.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 20:08:34 +0200
Message-ID: <865yaxq5xh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> It would be nice if the context menu defined by a text property had the
> option of adding to instead of overriding the menu specified by
> `context-menu-functions'.
>
> I think this can be done in a backwards-compatible way as follows:
>
> (defun context-menu-map (&optional click)
> ...
> When there is a text property `context-menu-function' at CLICK, it is
> handled as if it were the first entry of `context-menu-functions'.

I already envisioned such request, so the text property is named
`context-menu-function' (singular).  As an improvement we could add
another text property `context-menu-functions' (plural) that will
play more nicely with the variable `context-menu-functions'.
For example, we could append the list from the text property
to the value of the variable before running `run-hook-wrapped'
on the composite list.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 11:34:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 07:34:04 2023
Received: from localhost ([127.0.0.1]:46431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdUp1-0006Q5-RV
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:34:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33178)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pdUp0-0006P4-8M
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:34:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdUou-0004Ia-Vq; Sat, 18 Mar 2023 07:33:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=zviD1RwgW+zAVW5WN1UTrDkQpgOD2h+qMPUKP/frHlI=; b=qE4hg6HJK+Xu
 68IntFwQtIsyDGNbtvK55JtzmhAZktdu+0jCxINw7ZHTM6klJV42mqb1yJPju7/Jgq0w8iyQKwBuD
 BbT+zANigOxtKdijU+CEHD3h4PIAQv8Z5MR9MsIFezTzu/glX7jiZ+wOzLmdhzo0nEehuYg13wcGR
 A5sI/P7HB/S3iDf26nz4Iz8mLl7Ef7Ryv+fCegZOud8sSaUgLhznWARKMfWcN//kPGBE/fFvvj/hG
 f7u9Nieu0skBkqWzvJEbvkonM8F5wGz5z2MJtHZLJ4P02XenhtTk8g0dxjFgB+2t/pKTFXSSIF3tB
 u14pgn/VXfg/k+6nJW0qlw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdUou-0000EN-23; Sat, 18 Mar 2023 07:33:56 -0400
Date: Sat, 18 Mar 2023 13:33:59 +0200
Message-Id: <83mt4ab8ew.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <875yay5mcw.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 18 Mar 2023 12:29:19 +0100)
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <83o7oqb8ug.fsf@HIDDEN> <875yay5mcw.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: 62250 <at> debbugs.gnu.org,  juri@HIDDEN
> Date: Sat, 18 Mar 2023 12:29:19 +0100
> 
> On Sat, 18 Mar 2023 at 13:24, Eli Zaretskii wrote:
> 
> > What MENU argument?  I see only a CLICK argument.
> 
> --8<---------------cut here---------------start------------->8---
> (defun context-menu-map (&optional click)
>   "Return menu map constructed for context near mouse CLICK.
> The menu is populated by calling functions from `context-menu-functions'.
> Each function receives the menu and the mouse click event
>                            ^^^^
> and returns the same menu after adding own menu items to the composite menu.
> When there is a text property `context-menu-function' at CLICK,
> it overrides all functions from `context-menu-functions'.
> At the end, it's possible to modify the final menu by specifying
> the function `context-menu-filter-function'."
> --8<---------------cut here---------------end--------------->8---

Now I'm completely confused regarding your proposal.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 11:29:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 07:29:29 2023
Received: from localhost ([127.0.0.1]:46419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdUka-0003sl-Qf
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:29:29 -0400
Received: from mail-ed1-f52.google.com ([209.85.208.52]:36760)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdUkY-0003sa-Ky
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:29:26 -0400
Received: by mail-ed1-f52.google.com with SMTP id w9so29778531edc.3
 for <62250 <at> debbugs.gnu.org>; Sat, 18 Mar 2023 04:29:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679138960;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=fUOWszO4XXB0IS6W6++K1Dtnz/HEjk6ZYjA/U5S5RTs=;
 b=BWuTq0GAFsMaEM07WpKI0XQ13MS0O70xe4l2329mELHXRQ3pkDqIhoA9mwG3xHDbk2
 E1kKxwXn3sXN6DpVyZaB81zp4dvAb/SJ4jTespT/QYhJesE2Y0GMpuBrNI5aS7/NE4ca
 /OJi+1iRH4g+xcQE+iKFGrvfCGaRzFVgK7XyP5+BToMlJtOmy/tuLovz6DkY0uBTlWEJ
 JsDLHuFaLKnsr5nPbTYWvqhBo5TAYzcWme4Y5oIpfMz2+Cqb6+7/Ysz0i0Iv8i18auS2
 g7JLPZ5n747TiDbXwJsD+QyvdWHPsow+3QDnmMfqt1CK7t+NYUmyYnn5RsBK7sX6SdGd
 cU4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679138960;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fUOWszO4XXB0IS6W6++K1Dtnz/HEjk6ZYjA/U5S5RTs=;
 b=Dupu8RQb5OYLR5BB/0F58Wb1S80GFttiQTsQMJwmeU8KswktQtfvbi/qTH0EBtJhXF
 Of9iCC8PH9nDJyhuznympjSnhJEPvcGjstCAyvTmRd8dYnlGiok2VL3bjBFrHa7+JcJo
 3UoIEqvfLzFL9TzeufgG5ckmBKNNTQYjuP+Mi/PGJqqPepgxUGWfN8sL6YOg+cQkFcFC
 hRyP0AwAD/ffd+PgW5nH0V8rZNHxG6kObgQ4KdoewXnCvqxCpvml7xj3me4I7ufgzOGk
 8N+HCWqhu/933xZ7ql2Juszz5F9cJVltO0BJQI+KoeUTvHzdjGGKtKztY+FXalCqdYEp
 BI5A==
X-Gm-Message-State: AO0yUKU/IPrGGH+l4H/qXuzxOQLlcVC2ZREYhNd5Ka81TQyL3kvuGpVG
 KqKZyX4AkjmHZApDMAMbkSk=
X-Google-Smtp-Source: AK7set9W89x8lJe01H7joFHg5mu2xtt4kc3NajbkM0+D64a48shaeTocQ251kh68+xCvrekWj4JAjw==
X-Received: by 2002:a17:906:c193:b0:932:1af9:7386 with SMTP id
 g19-20020a170906c19300b009321af97386mr2431433ejz.27.1679138960663; 
 Sat, 18 Mar 2023 04:29:20 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 gz4-20020a170907a04400b0090e0a4e1bacsm2053761ejc.159.2023.03.18.04.29.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 04:29:20 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <83o7oqb8ug.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 18 Mar
 2023 13:24:39 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN> <83o7oqb8ug.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 12:29:19 +0100
Message-ID: <875yay5mcw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, 18 Mar 2023 at 13:24, Eli Zaretskii wrote:

> What MENU argument?  I see only a CLICK argument.

--8<---------------cut here---------------start------------->8---
(defun context-menu-map (&optional click)
  "Return menu map constructed for context near mouse CLICK.
The menu is populated by calling functions from `context-menu-functions'.
Each function receives the menu and the mouse click event
                           ^^^^
and returns the same menu after adding own menu items to the composite menu.
When there is a text property `context-menu-function' at CLICK,
it overrides all functions from `context-menu-functions'.
At the end, it's possible to modify the final menu by specifying
the function `context-menu-filter-function'."
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 11:24:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 07:24:45 2023
Received: from localhost ([127.0.0.1]:46405 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdUg0-0003lZ-TA
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:24:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42430)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pdUfz-0003lL-9m
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:24:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdUft-00024X-2W; Sat, 18 Mar 2023 07:24:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=2j540Y42Gn5LYRXpSR7m+36t8ikifEbKF6R41Fztc48=; b=jubU6JSH1IKL
 wEv24uET1WFViG1vmzzDV8eWx1LoyAFyau+FRVgTulD1zoXlB1D961YpKETNZvvMuJvvciO7pdoO+
 0+Z4/RyPaPeQCzPlnS0oWteUKq2moQbrHOogkkKPTzjuWOZTfkz78ischyPdHIy9h1Wga3UPqvln6
 xnEcHfdrD6fRzd0ZAm+A7L19v7T2V9SoqQP1Zeu/mKH3g6+yYRgcOqsENeLN0VZsROnaKph7V9Aj8
 DPcDgyqy3FHOJnzqVsYtekUOnGswPOJbPXXw8CI8/lBNx+eqPP/TwyYenfZGyhgDAjoeGx0ZJOj8p
 nFHcwvaE8ws5iGS4lte1Ng==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdUfs-000440-GP; Sat, 18 Mar 2023 07:24:36 -0400
Date: Sat, 18 Mar 2023 13:24:39 +0200
Message-Id: <83o7oqb8ug.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <878rfu1f37.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 18 Mar 2023 12:19:56 +0100)
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
 <878rfu1f37.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: 62250 <at> debbugs.gnu.org,  juri@HIDDEN
> Date: Sat, 18 Mar 2023 12:19:56 +0100
> 
> On Sat, 18 Mar 2023 at 10:31, Eli Zaretskii wrote:
> 
> >> Alternatively, it can return a completely new menu.  In
> >> this case, no further functions from `context-menu-functions' are
> >> called.
> 
> > What if a Lisp program _does_ want to override the menu specified by
> > context-menu-functions? or what if it wants the menu specified by the
> > text property to be the _last_ entry, not the first?
> 
> It's explained in the bit I kept: you ignore the MENU argument and
> return a totally new keymap / not `eq'.

What MENU argument?  I see only a CLICK argument.

> Adding things at the beginning or end of a menu is an option that
> easy-menu-add-item etc already offer, right?

I admit I don't see how easy-menu-add-item is related to this.

> Note that currently a member of context-menu-functions cannot override
> the menu, and a context-menu-function cannot _not_ override it.  My
> suggestions allows all possibilities.

That part I did understand, but it looked to me that your proposal
stops short of covering all the possible situations.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 11:20:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 07:20:05 2023
Received: from localhost ([127.0.0.1]:46396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdUbU-0003eN-RX
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:20:05 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:46614)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdUbT-0003dg-Ve
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 07:20:04 -0400
Received: by mail-ed1-f41.google.com with SMTP id eg48so29533961edb.13
 for <62250 <at> debbugs.gnu.org>; Sat, 18 Mar 2023 04:20:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679138398;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=4HIBOh9PI5hvc+JfFqJigk7pyW2WGF5cKM9+13YxF4U=;
 b=iYbF0flaGtnBUps5QJA9S9+PsJhXoUbPuvIz9+BiKoGYIyXhPmZlvY5Ehb4KCtnIH9
 UuRWhpXMQWGQNqy+1nI5fehKj/QVGiFoA/1c48rvKdpV+xYsWWdx5fCyvudAYxRK5j3n
 tMTa94FG4k/E+BomOTZF+Ud4p1cve/c0vC7qlQLcQ5x1rN7UU0OblldBmAfePU4fhm2X
 5vZEtQnr8PyiAHsC3/LC2wKn2bL//bN8ZokveQ0rlnH/kHAvdOCYQtFktEkiY4oys9ej
 iJe/LTDErMUWY/lXI22m5qw6xS1v3jS7oogCXKkKTeUZCcwJ1Y7DVgM4fl01wthByFYE
 4L8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679138398;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=4HIBOh9PI5hvc+JfFqJigk7pyW2WGF5cKM9+13YxF4U=;
 b=N4ygegWRQQ2rYOxuRgBuskzWDWXP7E/+csYz+AT3udr3DDrMl6bUgBJMm+vSmpQ7Ll
 smK2jMvryQB0sBVAJKl8HkjssFwgUWupUGc6pMsK0hm4iHIFzU874xXX2fVXcCxPSh9G
 vRETclbOEzEc/0te4jfsuSAQeskYPyhIiAW3zyDxGEvqTv5qUZq9g6FwKnzruWWvx00a
 IWo3JmET5BU1MLD0pIVZBFMPGYbavqmMt6HANHbTeBs3cV3qdPOppWT1lfz6UvAEsAHN
 JRI2kF+s2+U6rtuQqCaRnbngtGeiwT4ew5x7qYMvcosVEjH5LVobq8FMpCqYOIGUmNzE
 lEbA==
X-Gm-Message-State: AO0yUKUGhbuoYffz3f4DNihHPLo8P0koiWjXb1tVZ/lqXevDyNWB2+2a
 QMRsYKCDP158hNeDaipTZ/0=
X-Google-Smtp-Source: AK7set+IkBhZ/YjUFDuuTlG/X51L36Z14ObwqgGzdB9dfOfseOFG8OCy0rCfDdxJ9XV9x0P+8Lzsew==
X-Received: by 2002:a17:906:eb9a:b0:931:42d2:a77f with SMTP id
 mh26-20020a170906eb9a00b0093142d2a77fmr2353522ejb.15.1679138397724; 
 Sat, 18 Mar 2023 04:19:57 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 zc14-20020a170906988e00b00927f6c799e6sm2075424ejb.132.2023.03.18.04.19.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 04:19:57 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62250: 29.0.60; Allow context menu from text properties to
 not override everything
In-Reply-To: <833562cvfb.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 18 Mar
 2023 10:31:36 +0200")
References: <87ttyixzt2.fsf@HIDDEN> <833562cvfb.fsf@HIDDEN>
Date: Sat, 18 Mar 2023 12:19:56 +0100
Message-ID: <878rfu1f37.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, 18 Mar 2023 at 10:31, Eli Zaretskii wrote:

>> Alternatively, it can return a completely new menu.  In
>> this case, no further functions from `context-menu-functions' are
>> called.

> What if a Lisp program _does_ want to override the menu specified by
> context-menu-functions? or what if it wants the menu specified by the
> text property to be the _last_ entry, not the first?

It's explained in the bit I kept: you ignore the MENU argument and
return a totally new keymap / not `eq'.  Adding things at the beginning
or end of a menu is an option that easy-menu-add-item etc already offer,
right?

Note that currently a member of context-menu-functions cannot override
the menu, and a context-menu-function cannot _not_ override it.  My
suggestions allows all possibilities.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at 62250 <at> debbugs.gnu.org:


Received: (at 62250) by debbugs.gnu.org; 18 Mar 2023 08:31:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 04:31:42 2023
Received: from localhost ([127.0.0.1]:46155 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdRyX-0004w1-Tp
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 04:31:42 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49782)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pdRyW-0004vd-9r
 for 62250 <at> debbugs.gnu.org; Sat, 18 Mar 2023 04:31:40 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdRyQ-0005nF-GP; Sat, 18 Mar 2023 04:31:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=DXTgpLlHK4QBEOmu3BX4Zq+Hhw1AY45oKiDUnVrV+8E=; b=dyQNDxrlKBqN
 JCU0jaHfnbdK9Gc5Ag5hcX+dsX7Nnlnci2KATEc/bCIGrD3gBMQG1EUF7KNRJfT+i0wbgZ8zWPBZ/
 K18YPw39k1ue4G6gUmrrrInssGoQ6fCcHSwJmkdxUzKTdTX1PuIuSOdpelk4J0HroA0dFcc1iel7M
 DPiQF2ChS3Ye1moZHseRnF01C25PVn6ox90cC8etI7NmV1WOXyIYruqj5ejmqODIHHsErGG/cyZu8
 8hlfq5fnj3iqh5RunMmkEzFsOG55Vl/HjJIcByJY9Tr49v3jwcBZ+P8xQIhg50+Kt0qVey8lWG6lb
 HkyaFUrg/5/VFYxPLS/YLw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pdRyP-0003vU-TQ; Sat, 18 Mar 2023 04:31:34 -0400
Date: Sat, 18 Mar 2023 10:31:36 +0200
Message-Id: <833562cvfb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <87ttyixzt2.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 18 Mar 2023 08:51:21 +0100)
Subject: Re: bug#62250: 29.0.60;
 Allow context menu from text properties to not override everything
References: <87ttyixzt2.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62250
Cc: 62250 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: Juri Linkov <juri@HIDDEN>
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Date: Sat, 18 Mar 2023 08:51:21 +0100
> 
> It would be nice if the context menu defined by a text property had the
> option of adding to instead of overriding the menu specified by
> `context-menu-functions'.
> 
> I think this can be done in a backwards-compatible way as follows:
> 
> --8<---------------cut here---------------start------------->8---
> (defun context-menu-map (&optional click)
>   "Return menu map constructed for context near mouse CLICK.
> The menu is populated by calling functions from
> `context-menu-functions'.  Each function receives the menu and the mouse
> click event and returns the same menu after adding own menu items to the
> composite menu.  Alternatively, it can return a completely new menu.  In
> this case, no further functions from `context-menu-functions' are
> called.
> 
> When there is a text property `context-menu-function' at CLICK, it is
> handled as if it were the first entry of `context-menu-functions'.
> 
> At the end, it's possible to modify the final menu by specifying the
> function `context-menu-filter-function'."
> --8<---------------cut here---------------end--------------->8---

What if a Lisp program _does_ want to override the menu specified by
context-menu-functions? or what if it wants the menu specified by the
text property to be the _last_ entry, not the first?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Mar 2023 07:51:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 03:51:32 2023
Received: from localhost ([127.0.0.1]:46115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdRLf-0003tY-UM
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 03:51:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:53926)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1pdRLd-0003tO-5h
 for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 03:51:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1pdRLc-0006bJ-VC
 for bug-gnu-emacs@HIDDEN; Sat, 18 Mar 2023 03:51:28 -0400
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1pdRLb-0003jh-ES
 for bug-gnu-emacs@HIDDEN; Sat, 18 Mar 2023 03:51:28 -0400
Received: by mail-ed1-x534.google.com with SMTP id y4so28626920edo.2
 for <bug-gnu-emacs@HIDDEN>; Sat, 18 Mar 2023 00:51:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679125883;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=jjcTbO7/19hD9V2LFrsfdjm6u4VVRN1QeIuyDmJI5rg=;
 b=KZZCa+NDjjO05OvfiLMJ8wGf8aAAnU/Np+rJe6pJ0wi/Vt8FB81mUrB0sNsvYCvVaj
 QhX/0R/593HooRmZbQJ+1H6NnSUlP+Lokz6/EDlCIUrbP9DgeDN8po5Ss9IU9WJSMyNc
 qmh/p4aOKJg/NbszKsfhMA7r2JFOeV0bPsqoTySl4Y22ak5iap371grBM+pJGovT0zEf
 sQz6kdntvGD16h2+BuvMlAIKpW9uOEnlZFFbpL/tnPznF9ZodQil9P1+uof/fmrM2Cu/
 iayMaR6moVLSYr6YSNPD6K9kdM61Z4isyhAD5FdbWWb7AcUUMriBeUGIiRyKLXo+PaMP
 SKeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679125883;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=jjcTbO7/19hD9V2LFrsfdjm6u4VVRN1QeIuyDmJI5rg=;
 b=WzwngQukSIHCEXgfC+aDFQhU5hF4O9xe79vdtyMDaD8DCmSCEl/STAfdwGSUGPOMu4
 nacJc/ziX+JQEvcGfQcWEZe4/+Yd93ga1x8p3RZtu1aW/h+din8/ax6YGrHWkTwSyrem
 1+pTf8/hdjpqSAVUreofmh5aA4O/E8sF4j1Uo43R5O5fgCyGm2ESluklHqB2ANNRPAv/
 rl9H2h/mnPwUndrDUYxKUn6F7TLvXNy+OlbQs/Bln4HI2x1CSOOMCuR1Bww1xOtxpO48
 CefNu6idBtMkbsOfpjuO0iUsNaeB99fBNNVs+MCx1IBzQFqgw4svnUPFQYpei2kDo7dh
 mhTw==
X-Gm-Message-State: AO0yUKV/lOK/B3DgByaYhe0v7tQnGBK3e8AjCNeo/xFK5dpIFgj7PGgN
 IXTVxc/1NMCOu30C/YrW97tupB7SfZs=
X-Google-Smtp-Source: AK7set8qrDhp72jNlC/5l1fKu4E8WRTHmGrtGDLb5KPLnXyaLGP7Tefy1ktZW9hDA4ZAZjakKOpn0w==
X-Received: by 2002:a17:906:fb0d:b0:8b2:d30:e722 with SMTP id
 lz13-20020a170906fb0d00b008b20d30e722mr2356692ejb.3.1679125883524; 
 Sat, 18 Mar 2023 00:51:23 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8ca4])
 by smtp.gmail.com with ESMTPSA id
 jj4-20020a170907984400b009323f08827dsm1403606ejc.13.2023.03.18.00.51.22
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 00:51:22 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; Allow context menu from text properties to not override
 everything
X-Debbugs-Cc: Juri Linkov <juri@HIDDEN>
Date: Sat, 18 Mar 2023 08:51:21 +0100
Message-ID: <87ttyixzt2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::534;
 envelope-from=arstoffel@HIDDEN; helo=mail-ed1-x534.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

It would be nice if the context menu defined by a text property had the
option of adding to instead of overriding the menu specified by
`context-menu-functions'.

I think this can be done in a backwards-compatible way as follows:

--8<---------------cut here---------------start------------->8---
(defun context-menu-map (&optional click)
  "Return menu map constructed for context near mouse CLICK.
The menu is populated by calling functions from
`context-menu-functions'.  Each function receives the menu and the mouse
click event and returns the same menu after adding own menu items to the
composite menu.  Alternatively, it can return a completely new menu.  In
this case, no further functions from `context-menu-functions' are
called.

When there is a text property `context-menu-function' at CLICK, it is
handled as if it were the first entry of `context-menu-functions'.

At the end, it's possible to modify the final menu by specifying the
function `context-menu-filter-function'."
--8<---------------cut here---------------end--------------->8---




Acknowledgement sent to Augusto Stoffel <arstoffel@HIDDEN>:
New bug report received and forwarded. Copy sent to juri@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to juri@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#62250; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 12 Sep 2023 00:15:01 UTC

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