1

On my mac, when I create a popup menu I always get a few extra items tacked on:

Example

(defun tab-line-tab-context-menu (&optional event)
  "Pop up the context menu for a tab-line tab."
  (interactive "e")
  (let ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t))))
    (define-key-after menu [close]
      '(menu-item "Close" tab-line-close-tab :help "Close the tab"))
    (define-key-after menu [shiftleft]
      '(menu-item "Shift Left" tab-line-shift-tab-left :help "Shift the tab left"))
    (define-key-after menu [shiftright]
      '(menu-item "Shift Right" tab-line-shift-tab-right :help "Shift the tab right"))
    (define-key-after menu [copypath]
      '(menu-item "Copy Path" tab-copy-current-filename-to-clipboard :help "Copy the current tab filename to the clipboard"))

    (popup-menu menu)))

This will create a popup but in addition to the defined items I'm getting two extra items "Autofill" and "Services" which seem to be some kind of global set of entries. I notice they are there for all the system defined context menus as well

enter image description here

Does anyone know what controls this behavior? Is it possible to turn it off?

2
  • Which version of macOS?
    – mmmmmm
    Commented Mar 23 at 15:49
  • Latest Sonoma version.
    – benleis
    Commented Mar 23 at 19:52

1 Answer 1

1

Services is a standard macOS feature it appears on every popup menu created using Apple's tools. It is the same as on the main Application menu e.g. the Emacs menu on Emacs.

For example right click on a edit window on StackExchange in Safari and you will see services.

Apple document on Services

Services let you use features of other apps for the task you’re doing without having to open those apps.

I think the only way to disable the Services menu is by changing the code in Emacs itself.

3
  • That's what I was wondering was the case. Running x-popup-menu also shows this behavior and that's one of the builtin c functions. I've never done anything with the mac cocoa layer. I wonder how hard that is to tinker with.
    – benleis
    Commented Mar 24 at 0:26
  • Not hard I think - but it does mean altering the C code in emacs - so not practical.
    – mmmmmm
    Commented Mar 24 at 20:39
  • As for Autofill I am only on Ventura and I don't see it - whether that is the reason I don't know
    – mmmmmm
    Commented Mar 24 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.