emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Context menus and mouse-3


From: Drew Adams
Subject: RE: [External] : Re: Context menus and mouse-3
Date: Fri, 16 Jul 2021 20:05:09 +0000

> >> >> And some modes like org-mode, flyspell-mode, etc. already redefine
> >> >> down-mouse-3 to pop up context menus.
> >> >
> >> > But those modes define those context menus on special parts of
> >> > display, where pasting etc. makes less sense, no?
> >>
> >> When the buffer is not read-only, I see no reason to disallow
> >> pasting text because e.g. in flyspell-mode it makes sense
> >> to paste a correction to a misspelled word, etc.
> >
> > IMO, when mouse-3 is clocked on a misspelled word, it makes much more
> > sense to assume the user wants to fix that word than that the user
> > wants to paste.
> >
> > But here's an idea: how about merging the two menus into one in these
> > cases?  We could add a top-level menu with the two alternatives, each
> > one would then drop down one of the two possible menus.
> > Alternatively, just make a long menu by concatenating the contents of
> > the two original ones.
> >
> > WDYT?
> 
> Tak Kunihiro had a very good idea of using a hook-like variable
> that contains a list of functions that return parts of the whole
> context-menu, then these parts will be collected into the final menu.

FWIW -

`mouse3.el' has these variables:

`mouse3-region-popup-entries'
`mouse3-noregion-popup-entries'

`mouse3-region-popup-x-popup-panes'
`mouse3-noregion-popup-x-popup-panes'

Whether the first two or the second two are used is
controlled by option `mouse3-popup-x-popup-panes-flag'.

The difference corresponds to the two possibilities
offered by `x-popup-menu'.  The default is nil, so you
can use keymaps and extended menu items to define the
`mouse-3' menu.  The alternative is easy to use but
offers fewer possibilities.

The 2 `region' vars are used when the region is active.
The 2 `noregion' vars are used otherwise.
___

As for the choice of whether global menus should
be included in a `mouse-3' menu: Why decide that
at design time, hard-coding the behavior?
`mouse3.el' lets users decide, with option
`mouse3-popup-include-global-menus-flag'.
If non-nil then:

If the menu bar is visible then the major-mode menu
is the global menu to include on the `mouse-3' menu.
If the menu-bar is not shown then the menu-bar menus
are the menus to include on the `mouse-3' menu.
___

By default, the `mouse-3' menu has predefined submenus.
Users and code can modify the contents, of course.
(If the alternative panes approach is used, then the
operations are available in the single-level menu.)

These are the predefined submenus.  All except the
first are for when the region is active and nonempty.

`mouse3-noregion-popup-misc-submenu'
  Miscellaneous operations on a thing at mouse pointer:
    Email, open, visit, Dired, find, describe, highlight etc.

`mouse3-region-popup-change-text-submenu'
  Change the selected text:
    Fill, indent, transpose regions, upcase, etc.

`mouse3-region-popup-check-convert-submenu'
  Check, correct, or convert the selected text.

`mouse3-region-popup-copy-submenu'
  Copy selected text: text props, kill, to register etc.

`mouse3-region-popup-highlight-submenu'
  Highlight, unhighlight, copy/yank text props.

`mouse3-region-popup-misc-submenu'
  Miscellaneous operations on selected text:
    Count, narrow, eval, shell, write to file, etc.

`mouse3-region-popup-print-submenu'
  Print, PostScript print, BNF PostScript operations.

`mouse3-region-popup-rectangle-submenu'
  Selected rectangle: kill, delete, open, yank, clear, etc.

`mouse3-region-popup-register-submenu'
  Selected text to register: copy to, delete to, etc.

`mouse3-region-popup-remove/replace-items'
  Remove/replace selected text: kill, delete, yank.

`mouse3-region-popup-remove/replace-rect-submenu'
  Remove/replace selected rectangle:
    Clear, replace from last killed, string, register.

`mouse3-region-popup-search/replace-submenu'
  Isearch, query replace etc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]