Subject: Re: bug#52973: Adding a few context-menu-mode commands

From: Eli Zaretskii <[email-masked]>
Date: Fri, 07 Jan 2022 10:37:58 +0200

> From: Philip Kaludercic <[email-masked]>
> Cc: Juri Linkov <[email-masked]>,  Lars Ingebrigtsen <[email-masked]>,
>   [email-masked]
> Date: Fri, 07 Jan 2022 08:29:20 +0000
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> The patches from Philip just add new functions.
> >> Whether to include them in the default value
> >> of the context function is a separate discussion.
> >
> > How does it make sense to add functions that aren't used?
> >
> > Lars, what is your opinion about these issues?  Am I the only one who
> > thinks that context-menu-mode should automatically activate context
> > menus in every mode that has support for it?
> 
> Unless I have missed it, do mean that all context menus should be loaded
> by default (auto loading all *-context-menu functions and adding all of
> them to the default value value of context-menu-functions), or that each
> context menu definition should be accompanied by a add-to-list on
> context-menu-functions?

I'm not sure I understand why any of what you say should follow.  I'm
probably missing something.

My mental picture is that context menus are specific to modes.  When a
buffer has certain modes turned on (one major mode and one or more
minor modes), those modes are already loaded, and so any functions
those modes define are already defined.  So when the user right-clicks
some spot on display, and one or more modes have defined context-menu
items for this spot, the code which does that is already loaded, and
calling the functions to produce the menu should not need any
autoloading.

As for add-to-list, if the implementation of context menus requires
adding stuff to some list only when the menu is about to be popped up,
then yes, the add-to-list should be done only when the user clicks.
But if adding to the list is done when a mode is loaded, then again,
since all the relevant modes are already loaded, these functions will
have been added to that list already.

What am I missing?