unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22456: 24.5; Have \\[...] handle mouse commands differently
@ 2016-01-24 16:14 Drew Adams
  2022-05-12 12:45 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2016-01-24 16:14 UTC (permalink / raw)
  To: 22456

Enhancement request:

If a command that can only be bound to a mouse event is mentioned in a
doc string, and if that command is not bound currently, the mention is
inappropriate (unhelpful).

(defun foo (event)
  "..."
  (interactive "e")
  (message "foo"))

(defun bar ()
  "... mouse command \\[foo] is ..."
  (interactive)
  (message "bar"))

C-h f bar

  bar is an interactive Lisp function.

  (bar)

  ... mouse command `M-x foo' is ...

This is quite wrong: `foo' *cannot* be invoked using `M-x'.

The request is for Emacs to do something better for this case.  It
should just write "... mouse command `foo' is ...", for example, leaving
off the "M-x " part.

Maybe these are some possible approaches (?):

* Check the `interactive' spec for "e" or an argument that is
  `mouse-event-p'.

* Allow for "mouse command" in a doc string to indicate that the command
  name that follows it is to be considered a mouse command.


In either case, if a command is indicated to be a mouse command, render
its use within "\\[...]" without the prefix "M-x ".


In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/usr --host=i686-pc-mingw32'





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#22456: 24.5; Have \\[...] handle mouse commands differently
  2016-01-24 16:14 bug#22456: 24.5; Have \\[...] handle mouse commands differently Drew Adams
@ 2022-05-12 12:45 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-12 12:45 UTC (permalink / raw)
  To: Drew Adams; +Cc: 22456

Drew Adams <drew.adams@oracle.com> writes:

> If a command that can only be bound to a mouse event is mentioned in a
> doc string, and if that command is not bound currently, the mention is
> inappropriate (unhelpful).
>
> (defun foo (event)
>   "..."
>   (interactive "e")
>   (message "foo"))
>
> (defun bar ()
>   "... mouse command \\[foo] is ..."
>   (interactive)
>   (message "bar"))
>
> C-h f bar
>
>   bar is an interactive Lisp function.
>
>   (bar)
>
>   ... mouse command `M-x foo' is ...
>
> This is quite wrong: `foo' *cannot* be invoked using `M-x'.
>
> The request is for Emacs to do something better for this case.  It
> should just write "... mouse command `foo' is ...", for example, leaving
> off the "M-x " part.

When you write \\[...] in your doc string, you've asked Emacs to display
the key binding to execute the command.  In this case there is no key
binding that can execute that command, so you've asked Emacs to do
something paradoxical.

Changing the output here would be easy enough, but I don't see that
saying "mouse command `foo'" is much better -- it's still not expanding
to a key sequence.

So I think this is a "don't do that, then" thing, and I'm closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-12 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-24 16:14 bug#22456: 24.5; Have \\[...] handle mouse commands differently Drew Adams
2022-05-12 12:45 ` Lars Ingebrigtsen

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).