unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <yamato@redhat.com>
To: monnier@iro.umontreal.ca
Cc: emacs-devel@gnu.org
Subject: Where the menu should be appeared when C-mouse-3 is triggered (Was: [patch v3] showing menu bar temporarily when f10 is pressed)
Date: Thu, 19 Jul 2012 17:32:53 +0900 (JST)	[thread overview]
Message-ID: <20120719.173253.1324462371913652728.yamato@redhat.com> (raw)
In-Reply-To: <jwvipdkxnst.fsf-monnier+emacs@gnu.org>

Thank you for reviewing.
I'll revise my patch and submit it again.

>>>> Why do you need the menu-bar?  Why not pop up the menu usually bound to
>>>> C-mouse-3?
>>> To be honest, I didn't know that.
>>> I've just tried C-mouse-3; and found some advantages of C-mouse-3
>>> comparing with f10 for KEYBOARD USER.
> 
> While I agree we should also support the f10 behavior (so your current
> patch is acceptable), I think the problem you point out for the
> C-mouse-3 behavior could/should be fixed.
> 
>>> 1. With C-mouse-3, the menu is pop up where mouse pointer is.
> 
> That should be easy to fix so that the menu is popped up at point.
> 
>>> 2. With C-mouse-3, the contents of menu is chosen based
>>> on the window where the mouse pointer is.
> 
> Same here.

I don't this is easy to fix.

For KEYBOARD USER it is nice to popped up at point.
Howto, it is not nice for MOUSE USER.

Emacs has many useful commands(mouse oriented commands) which are
expected to be triggered from MOUSE. Some of them, including
C-mouse-3, are not suitable for keyboard operatoin.

I've been thinking about this gap between mouse operation and keyboard
operation in emacs. 

I'd like to introduce `bring-mouse-to-point' for fill the gap.  Its
behavior is too tricky, so I'd like to introduce is after f10 patch is
accepted. The behavior of f10 patch is a bit tricky.

`bring-mouse-to-point' is for for keyboard user, who don't want to 
use mouse but want to use mouse oriented commands from key board.

As the name shown, `bring-mouse-to-point' moves the mouse cursor to
the point.  So you can do what Stefan suggests with following 
key sequence:

    \C-. C-mouse-3

(Here I bind \C-. to `bring-mouse-to-point' privately. I know \C-. is
reserved to user customization.)

If you are using note-PC, this is enough useful because mouse-[123]
are near keyboard. 

After invoking \C-. C-mouse-3, you can type \C-. again. In that case
the mouse cursor moves somewhere far away from point; 
mouse-avoidance-banish is called. It means the behavior or \C-. is 
toggle.

How do you think `bring-mouse-to-point'?
I hope this is included to emacs officially.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Taken from avoid.el
;;
(require 'avoid)
(defun point-position ()
  (let ((edges (window-inside-edges))
	(x-y (posn-x-y (posn-at-point))))
    (cons (selected-frame)
	  (cons (+ (car edges)
		   (/ (car x-y) (frame-char-width)))
		(+ (car (cdr edges))
		   (/ (cdr x-y) (frame-char-height)))))))

(defun bring-mouse-to-point (avoiding)
  (interactive "P")
  (let ((op (mouse-position))
	(np (point-position)))
    (if (or avoiding
	    (equal op np))
	(mouse-avoidance-banish)
      (set-mouse-position (car np) (cadr np) (cddr np)))))
(define-key global-map [(control .)] 'bring-mouse-to-point)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Masatake YAMATO



  reply	other threads:[~2012-07-19  8:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19 18:41 [patch] showing menu bar temporarily when f10 is pressed Masatake YAMATO
2012-06-19 20:31 ` Lluís
2012-06-19 21:42 ` Stefan Monnier
2012-06-20  6:17   ` [patch v2] " Masatake YAMATO
2012-07-18 11:29     ` [patch v3] " Masatake YAMATO
2012-07-19  6:54       ` Stefan Monnier
2012-07-19  8:32         ` Masatake YAMATO [this message]
2012-07-19  9:07           ` Where the menu should be appeared when C-mouse-3 is triggered Stefan Monnier
2012-07-20  4:55             ` Masatake YAMATO
2012-07-20 11:38               ` Stefan Monnier
2012-07-20 11:56                 ` Masatake YAMATO
2012-07-28  9:31                   ` Masatake YAMATO
2012-08-09 11:13                     ` Masatake YAMATO
2012-08-10 12:44                       ` Stefan Monnier
2012-08-10 13:21                         ` Drew Adams
2012-08-10 13:52                         ` Masatake YAMATO
2012-08-10 14:47                         ` Stefan Monnier
2012-07-20 12:48                 ` Masatake YAMATO

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=20120719.173253.1324462371913652728.yamato@redhat.com \
    --to=yamato@redhat.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).