From: Drew Adams <drew.adams@oracle.com>
To: Ergus <spacibba@aol.com>
Cc: philipk@posteo.net, Richard Stallman <rms@gnu.org>,
emacs-devel@gnu.org, Arthur Miller <arthur.miller@live.com>,
Dmitry Gutov <dgutov@yandex.ru>, Gregory Heytings <ghe@sdf.org>
Subject: Context menus and mouse-3 [was: Changes for emacs 28]
Date: Mon, 14 Sep 2020 03:06:43 +0000 (UTC) [thread overview]
Message-ID: <eccb22bb-1ef0-405f-a844-82f3f4eeefd0@default> (raw)
Ergus> The real problem is that now the right click
Ergus> is bind to mouse-save-then-kill which I have
Ergus> never ever used, but probably others have.
and earlier:
Ergus> Sadly we have <mouse-3> bind to mouse-save-then-kill
Ergus> which I don't find useful at all, but maybe
Ergus> somebody will complain if we change it to
Ergus> C-<mouse-3> and move the panel to <mouse-3>.
I suspect that people who use a mouse but feel
that `mouse-save-then-kill' isn't useful have
never really understood what it offers.
Part of the lack of understanding may come from
not having read the manual about it. Node `Mouse
Commands' of the Emacs manual makes the behavior
clear, and thus how useful it can be.
`mouse-3' lets you select text, delete or kill
text, and extend or reduce the selection.
That's a lot, and the actions to do those things
fit well together.
The extend-or-reduce bit works in a special way
if you've selected text by multiple clicking:
double-clicking or triple-clicking `mouse-1'.
I invite you to read the full text, if you
haven't already. And then play with it a bit.
___
What happens if you just read the doc string?
You don't get a great idea of the richness of
`mouse-3' behavior, IMO. It's OK, as far as a
doc string goes. But it's unlikely to teach
someone what they can do with it.
Here's a suggestion for that doc string, and
also for the doc strings for other `mouse-*'
bindings (keys and commands): Provide a link
to that `Mouse Commands' node in the manual.
___
To me, the behavior of `mouse-save-then-kill'
is super useful. So much so that my library
`mouse3.el' has, as a big part of its design,
to keep that behavior, while supplementing it
with `mouse-3' context menus.
You can of course optionally just get the menus.
But that's not where it's at - not the default
behavior. The idea is to let you use the normal
behavior as many times as you like - extend,
reduce, kill, whatever - and then, if you like,
click `mouse-3' at the same place again, to pop
up a context menu.
The first part is optional, and so is the menu
popping. Click in the same spot for the menu.
Click anywhere else for the vanilla behavior.
The other big part of the design is context
menu definition and behavior. Those two parts
are logically independent, but it makes sense
for them to be in the same library.
There are alternative ways to define the menus,
and alternative ways to present them. Menus can
be mode-dependent or not, dynamic (programmed)
or static.
Menus can, and generally do, differ, depending
on whether or not the region is active. When
active, a context menu provides actions on the
region or things in it. When inactive, it
provides actions on thing(s) located where you
click.
(There are always multiple things located at the
spot where you click. It's up to a particular
menu to decide which things to act on.)
___
Should a context menu include _only_ items that
pertain to the region or the location clicked?
In general, no. But you can certainly have
menus that do provide only that, if you want.
Should a context menu include global menus as
submenus, i.e., major-mode menus or menu-bar
menus? That's up to you - an option controls
this. If non-nil then yes: if the menu-bar is
visible then include the major-mode menus; else
include the menu-bar menus.
___
There are two alternative ways to define the
menus: (1) use keymaps and extended menu items
or (2) use the `x-poup-menu' form. The former
is the default method. It gives you more
control: keywords such as :visible and :enable,
for instance. The latter is a bit simpler for
defining, perhaps.
Simple example code of using each method is
provided in `mouse3.el', with explanation.
An example of method #1 is provided for use
with Dired mode. An example of #2 is provided
for use with Picture mode.
___
`mouse3.el' is completely compatible with the
traditional Emacs `mouse-3' behavior. The
only place where they overlap is if you click
`mouse-3' twice at the same spot.
If you do that to delete the selected text,
then to get that effect with `mouse3.el' you
double-click instead. Vanilla Emacs doesn't
distinguish a double-click from two clicks
separated by more than the double-click time.
(You can swap those two behaviors: slow 2-click
to delete instead of to show menu.)
next reply other threads:[~2020-09-14 3:06 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 3:06 Drew Adams [this message]
2020-09-14 6:11 ` Context menus and mouse-3 [was: Changes for emacs 28] Ergus
2020-09-14 6:28 ` Stefan Monnier
2020-09-14 6:48 ` Ergus
2020-09-14 7:49 ` tomas
2020-09-14 7:58 ` Thibaut Verron
2020-09-14 8:29 ` tomas
2020-09-14 9:03 ` Thibaut Verron
2020-09-14 9:12 ` Göktuğ Kayaalp
2020-09-14 11:37 ` tomas
2020-09-14 12:36 ` Thibaut Verron
2020-09-14 15:59 ` Drew Adams
2020-09-14 15:12 ` Eli Zaretskii
2020-09-14 15:47 ` Drew Adams
2020-09-14 20:54 ` tomas
2020-09-15 4:35 ` Richard Stallman
2020-09-15 13:11 ` Stefan Monnier
2020-09-19 7:47 ` Tak Kunihiro
2020-09-19 8:02 ` Tak Kunihiro
2021-07-11 23:38 ` Context menus and mouse-3 Juri Linkov
2021-07-12 1:25 ` [External] : " Drew Adams
2021-07-12 11:55 ` Eli Zaretskii
2021-07-12 20:56 ` Juri Linkov
2021-07-13 0:19 ` [External] : " Drew Adams
2021-07-13 11:32 ` Eli Zaretskii
2021-07-13 23:46 ` Juri Linkov
2021-07-14 4:30 ` Eli Zaretskii
2021-07-14 23:37 ` Juri Linkov
2021-07-15 6:22 ` Eli Zaretskii
2021-07-15 22:23 ` Juri Linkov
2021-07-16 6:49 ` Eli Zaretskii
2021-07-16 18:59 ` Juri Linkov
2021-07-16 20:05 ` [External] : " Drew Adams
2021-07-18 5:13 ` Tak Kunihiro
2021-07-18 15:53 ` Stefan Monnier
2021-07-19 15:55 ` Juri Linkov
2021-07-19 16:37 ` Stefan Monnier
2021-07-20 20:52 ` Juri Linkov
2021-07-20 22:24 ` Stefan Monnier
2021-07-20 23:15 ` Juri Linkov
2021-07-21 4:39 ` Tak Kunihiro
2021-07-21 5:07 ` [External] : " Drew Adams
2021-07-21 12:45 ` Stefan Monnier
2021-07-21 17:26 ` [External] : " Drew Adams
2021-07-22 3:49 ` Tak Kunihiro
2021-07-22 4:06 ` [External] : " Drew Adams
2021-07-19 19:59 ` Ergus via Emacs development discussions.
2021-07-20 20:51 ` Juri Linkov
2021-07-12 22:32 ` Stefan Monnier
2021-07-12 23:56 ` Juri Linkov
2021-07-13 3:01 ` Stefan Monnier
2021-07-13 23:32 ` Juri Linkov
2021-07-14 2:14 ` Stefan Monnier
2021-07-14 23:32 ` Juri Linkov
2021-07-15 1:18 ` Stefan Monnier
2021-07-15 22:31 ` Juri Linkov
2021-07-16 15:46 ` Stefan Monnier
2021-07-16 18:50 ` Juri Linkov
2021-07-16 19:25 ` Stefan Monnier
2021-07-15 6:24 ` Eli Zaretskii
2021-07-15 22:28 ` Juri Linkov
2021-07-16 6:51 ` Eli Zaretskii
2021-07-16 18:56 ` Juri Linkov
2021-07-16 23:13 ` Stefan Kangas
2021-07-17 6:22 ` Eli Zaretskii
2021-07-17 21:46 ` Juri Linkov
2021-07-17 6:02 ` Eli Zaretskii
2021-07-19 17:48 ` Stefan Kangas
2021-07-19 18:08 ` Stefan Monnier
2020-09-14 15:10 ` Context menus and mouse-3 [was: Changes for emacs 28] Eli Zaretskii
2020-09-14 16:42 ` Göktuğ Kayaalp
2020-09-14 8:15 ` Göktuğ Kayaalp
2020-09-14 8:33 ` tomas
2020-09-14 15:57 ` Drew Adams
2020-09-15 19:17 ` Juri Linkov
2020-09-15 20:33 ` Drew Adams
2020-09-15 22:47 ` Ergus via Emacs development discussions.
2020-09-16 0:29 ` Corwin Brust
2020-09-16 1:47 ` Drew Adams
2020-09-16 1:25 ` Drew Adams
2020-09-16 8:10 ` Ergus
2020-09-16 15:02 ` Drew Adams
2020-09-17 3:57 ` Richard Stallman
2020-09-17 20:10 ` Ergus
2020-09-17 21:58 ` Philip K.
2020-09-17 3:51 ` Richard Stallman
2020-09-16 14:13 ` Eli Zaretskii
2020-09-16 19:41 ` Juri Linkov
2020-09-16 2:24 ` Eli Zaretskii
2020-09-16 19:35 ` Juri Linkov
2020-09-16 23:10 ` Dmitry Gutov
2020-09-17 3:58 ` Richard Stallman
2020-09-17 7:48 ` Juri Linkov
2020-09-17 20:13 ` Ergus
2020-09-18 8:19 ` Juri Linkov
2020-09-18 10:53 ` Stefan Kangas
2020-09-19 4:01 ` Richard Stallman
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=eccb22bb-1ef0-405f-a844-82f3f4eeefd0@default \
--to=drew.adams@oracle.com \
--cc=arthur.miller@live.com \
--cc=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=ghe@sdf.org \
--cc=philipk@posteo.net \
--cc=rms@gnu.org \
--cc=spacibba@aol.com \
/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).