GNU bug report logs - #11233
24.1.50; Wishlist: dired mouse-2 other window behavior

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Fri, 13 Apr 2012 03:30:02 UTC

Severity: wishlist

Merged with 1532

Found in version 24.1.50

To reply to this bug, email your comments to 11233 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Fri, 13 Apr 2012 03:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to michael_heerdegen <at> web.de:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 13 Apr 2012 03:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Fri, 13 Apr 2012 05:34:41 +0200
Hi,

here is a question that Emacs newbies ask often: "How can I configure
dired so that mouse clicks don't create a new window/frame."
Unfortunately, this is currently not trivial.

Obviously, Emacs dired differs from most "common" file browsers which
just replace the current buffer/tab with the content of the clicked
file.

Not every user will like the behavior of Emacs here - we should give
users the possibility to configure this easily.

At least, we should define a new command dired-mouse-find-file
(without "-other-window") which users can bind if they want.  It's
missing.

But since dired is a very basic and widely used tool, and many newbies
will not know hooks, I think it would be a better solution if we could
provide a new user option that controls the behavior of mouse-2 in
dired in this regard.

(Note: if you want to do something like that, please don't forget to
change the tooltips.)


Regards,

Michael.






Forcibly Merged 1532 11233. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 13 Apr 2012 04:06:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Sat, 06 Oct 2012 12:57:15 GMT) Full text and rfc822 format available.

Message #10 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: michael_heerdegen <at> web.de
Cc: 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Sat, 06 Oct 2012 14:56:51 +0200
> here is a question that Emacs newbies ask often: "How can I configure
> dired so that mouse clicks don't create a new window/frame."
> Unfortunately, this is currently not trivial.
>
> Obviously, Emacs dired differs from most "common" file browsers which
> just replace the current buffer/tab with the content of the clicked
> file.
>
> Not every user will like the behavior of Emacs here - we should give
> users the possibility to configure this easily.
>
> At least, we should define a new command dired-mouse-find-file
> (without "-other-window") which users can bind if they want.  It's
> missing.
>
> But since dired is a very basic and widely used tool, and many newbies
> will not know hooks, I think it would be a better solution if we could
> provide a new user option that controls the behavior of mouse-2 in
> dired in this regard.

The basic problem is that the default for `mouse-1-click-follows-link'
has a short mouse-1 click do the same as mouse-2 whatever the latter is
bound to.  If you set `mouse-1-click-follows-link' to nil, the patch
below should do what you want.

Alternatively, we could bind mouse-2 to a command
`dired-mouse-find-file' which according to some option say
`dired-mouse-find-file-other-window' would visit the file in the
selected or another window.

martin


*** lisp/dired.el	2012-09-30 09:10:59 +0000
--- lisp/dired.el	2012-10-06 10:25:26 +0000
***************
*** 1383,1388 ****
--- 1383,1389 ----
    ;;  (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
    (let ((map (make-keymap)))
      (set-keymap-parent map special-mode-map)
+     (define-key map [mouse-1] 'dired-mouse-find-file-this-window)
      (define-key map [mouse-2] 'dired-mouse-find-file-other-window)
      (define-key map [follow-link] 'mouse-face)
      ;; Commands to mark or flag certain categories of files
***************
*** 2047,2055 ****
  ;; Don't override the setting from .emacs.
  ;;;###autoload (put 'dired-find-alternate-file 'disabled t)

! (defun dired-mouse-find-file-other-window (event)
!   "In Dired, visit the file or directory name you click on."
!   (interactive "e")
    (let (window pos file)
      (save-excursion
        (setq window (posn-window (event-end event))
--- 2048,2055 ----
  ;; Don't override the setting from .emacs.
  ;;;###autoload (put 'dired-find-alternate-file 'disabled t)

! (defun dired-mouse-find-file (event &optional other-window)
!   "Subroutine for visting file or directory name clicked on."
    (let (window pos file)
      (save-excursion
        (setq window (posn-window (event-end event))
***************
*** 2064,2072 ****
  		 (dired-goto-subdir file))
  	    (progn
  	      (select-window window)
! 	      (dired-other-window file)))
        (select-window window)
!       (find-file-other-window (file-name-sans-versions file t)))))

  (defun dired-view-file ()
    "In Dired, examine a file in view mode, returning to Dired when done.
--- 2064,2086 ----
  		 (dired-goto-subdir file))
  	    (progn
  	      (select-window window)
! 	      (if other-window
! 		  (dired-other-window file)
! 		(dired file))))
        (select-window window)
!       (if other-window
! 	  (find-file-other-window (file-name-sans-versions file t))
! 	(find-file (file-name-sans-versions file t))))))
!
! (defun dired-mouse-find-file-this-window (event)
!   "In Dired, visit the file or directory name you click on in this window."
!   (interactive "e")
!   (dired-mouse-find-file event))
!
! (defun dired-mouse-find-file-other-window (event)
!   "In Dired, visit the file or directory name you click on in other window."
!   (interactive "e")
!   (dired-mouse-find-file event t))

  (defun dired-view-file ()
    "In Dired, examine a file in view mode, returning to Dired when done.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Sat, 06 Oct 2012 13:50:01 GMT) Full text and rfc822 format available.

Message #13 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Sat, 06 Oct 2012 09:48:55 -0400
> +     (define-key map [mouse-1] 'dired-mouse-find-file-this-window)

I don't think we can use this by default (but a user can have it as
a local customization, of course).

> Alternatively, we could bind mouse-2 to a command
> `dired-mouse-find-file' which according to some option say
> `dired-mouse-find-file-other-window' would visit the file in the
> selected or another window.

I hope we can start moving in this direction, indeed.

As mentioned months ago, I'd like to move away from all the
foo(|-other-(frame-window)) madness since I suspect that most users
only use one of those alternatives.

So instead, we should only have `find-file' (which the user could
customize the use this-window, other-window, or other-frame) and that
would be complemented by new prefix commands that cause the next command
to use "other-window" or "this-window" or "other-frame".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Sat, 06 Oct 2012 17:20:01 GMT) Full text and rfc822 format available.

Message #16 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Sat, 06 Oct 2012 19:19:25 +0200
> As mentioned months ago, I'd like to move away from all the
> foo(|-other-(frame-window)) madness since I suspect that most users
> only use one of those alternatives.
>
> So instead, we should only have `find-file'

Would this be `dired-find-file'?

> (which the user could
> customize the use this-window, other-window, or other-frame) and that
> would be complemented by new prefix commands that cause the next command
> to use "other-window" or "this-window" or "other-frame".

Prefix commands when using the mouse?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Sat, 06 Oct 2012 18:15:02 GMT) Full text and rfc822 format available.

Message #19 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Sat, 06 Oct 2012 14:14:17 -0400
>> As mentioned months ago, I'd like to move away from all the
>> foo(|-other-(frame-window)) madness since I suspect that most users
>> only use one of those alternatives.
>> So instead, we should only have `find-file'
> Would this be `dired-find-file'?

For dired, yes, probably.

>> (which the user could customize the use this-window, other-window, or
>> other-frame) and that would be complemented by new prefix commands
>> that cause the next command to use "other-window" or "this-window" or
>> "other-frame".
> Prefix commands when using the mouse?

Yup.
Just like C-u can be used for them.  Clearly, it's not convenient if
it's a frequent occurrence, but for occasional use, that's
perfectly fine.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Mon, 08 Oct 2012 06:59:02 GMT) Full text and rfc822 format available.

Message #22 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Mon, 08 Oct 2012 08:57:32 +0200
> Just like C-u can be used for them.  Clearly, it's not convenient if
> it's a frequent occurrence, but for occasional use, that's
> perfectly fine.

Suppose we wanted to make it convenient for frequent occurrence:
Wouldn't we have enough modifier combinations available for mouse
clicks?  Say C-S for "other window", M-S for "other frame" ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Mon, 08 Oct 2012 11:37:02 GMT) Full text and rfc822 format available.

Message #25 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Mon, 08 Oct 2012 14:05:48 +0300
> Suppose we wanted to make it convenient for frequent occurrence:
> Wouldn't we have enough modifier combinations available for mouse
> clicks?  Say C-S for "other window", M-S for "other frame" ...

I suggest to use the same modifiers as used in web browsers:
mouse-1 opens in the same window, C-mouse-1 opens in other window
(not selected), C-S-mouse-1 opens in other window (and selected),
S-mouse-1 opens in other frame.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Mon, 08 Oct 2012 13:34:01 GMT) Full text and rfc822 format available.

Message #28 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>, "'martin rudalics'" <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: RE: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Mon, 8 Oct 2012 06:33:01 -0700
> > Suppose we wanted to make it convenient for frequent occurrence:
> > Wouldn't we have enough modifier combinations available for mouse
> > clicks?  Say C-S for "other window", M-S for "other frame" ...
> 
> I suggest to use the same modifiers as used in web browsers:
> mouse-1 opens in the same window, C-mouse-1 opens in other window
> (not selected), C-S-mouse-1 opens in other window (and selected),
> S-mouse-1 opens in other frame.

I haven't followed this thread; excuse if I've misunderstood.

Please do not make mouse-1 follow links etc., except according to
`mouse-1-click-follows-link'.  A user who has set that option to nil should not
be bothered by having mouse-1 do such things.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Mon, 08 Oct 2012 14:13:01 GMT) Full text and rfc822 format available.

Message #31 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Mon, 08 Oct 2012 10:12:01 -0400
>> Just like C-u can be used for them.  Clearly, it's not convenient if
>> it's a frequent occurrence, but for occasional use, that's
>> perfectly fine.
> Suppose we wanted to make it convenient for frequent occurrence:
> Wouldn't we have enough modifier combinations available for mouse
> clicks?  Say C-S for "other window", M-S for "other frame" ...

I guess so.  And the two can be done independently.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Tue, 09 Oct 2012 09:38:02 GMT) Full text and rfc822 format available.

Message #34 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Tue, 09 Oct 2012 11:36:23 +0200
> I suggest to use the same modifiers as used in web browsers:
> mouse-1 opens in the same window, C-mouse-1 opens in other window
> (not selected), C-S-mouse-1 opens in other window (and selected),

Does this mean the buffer would appear in two windows?  On Firefox
C-S-mouse-1 behaves just as C-mouse-1 here.

> S-mouse-1 opens in other frame.

Would we decode this in `find-file' or `dired-find-file'?  IIUC we'd
have to check

(a) whether the mouse was used at all and, if so, which modifier was
    applied,

(b) whether the mouse was over a text with a this-window / other-window
    / other-frame interpretation, and

(c) what any user customizations wrt prefix key and modifiers are in the
    present context.

`push-button' and `button-activate' do something related.  Could we
interact with these functions?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Tue, 09 Oct 2012 23:22:02 GMT) Full text and rfc822 format available.

Message #37 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Wed, 10 Oct 2012 02:15:05 +0300
>> I suggest to use the same modifiers as used in web browsers:
>> mouse-1 opens in the same window, C-mouse-1 opens in other window
>> (not selected), C-S-mouse-1 opens in other window (and selected),
>
> Does this mean the buffer would appear in two windows?

No, only in one window - in the window where the user wants it to appear.

> On Firefox C-S-mouse-1 behaves just as C-mouse-1 here.

I meant the default settings.  But of course, they should be configurable.

>> S-mouse-1 opens in other frame.
>
> Would we decode this in `find-file' or `dired-find-file'?  IIUC we'd
> have to check
>
> (a) whether the mouse was used at all and, if so, which modifier was
>     applied,
>
> (b) whether the mouse was over a text with a this-window / other-window
>     / other-frame interpretation, and
>
> (c) what any user customizations wrt prefix key and modifiers are in the
>     present context.
>
> `push-button' and `button-activate' do something related.  Could we
> interact with these functions?

This could be processed at the same level where `mouse-1-click-follows-link'
and `mouse-1-click-in-non-selected-windows' are already in effect for
the [follow-link] event.

A more difficult question is how to allow packages to override this default
processing, e.g. allow clicking `C-mouse-1' in Info to clone (fork) the
Info buffer, but `mouse-1' should still visit a link in the same buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Tue, 13 Nov 2012 13:52:01 GMT) Full text and rfc822 format available.

Message #40 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Tue, 13 Nov 2012 14:50:26 +0100
> As mentioned months ago, I'd like to move away from all the
> foo(|-other-(frame-window)) madness since I suspect that most users
> only use one of those alternatives.
>
> So instead, we should only have `find-file' (which the user could
> customize the use this-window, other-window, or other-frame) and that
> would be complemented by new prefix commands that cause the next command
> to use "other-window" or "this-window" or "other-frame".

What would an appropriate prefix be and how would it coexist with
ctl-x-4-map and ctl-x-5-map?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Tue, 13 Nov 2012 17:43:01 GMT) Full text and rfc822 format available.

Message #43 received at 11233 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: martin rudalics <rudalics <at> gmx.at>
Cc: michael_heerdegen <at> web.de, 11233 <at> debbugs.gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Tue, 13 Nov 2012 12:42:05 -0500
>> As mentioned months ago, I'd like to move away from all the
>> foo(|-other-(frame-window)) madness since I suspect that most users
>> only use one of those alternatives.
>> 
>> So instead, we should only have `find-file' (which the user could
>> customize the use this-window, other-window, or other-frame) and that
>> would be complemented by new prefix commands that cause the next command
>> to use "other-window" or "this-window" or "other-frame".

> What would an appropriate prefix be and how would it coexist with
> ctl-x-4-map and ctl-x-5-map?

The way I see it, C-x 4 would be a new command which sets some vars that
affect subsequent commands (i.e. a prefix command, much like C-u or C-x RET
c) and it would also set-temporary-overlay-map with ctl-x-4-map, so that
C-x 4 f can be used as a shorthand for C-x 4 C-x C-f.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11233; Package emacs. (Wed, 14 Nov 2012 15:36:02 GMT) Full text and rfc822 format available.

Message #46 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior
Date: Wed, 14 Nov 2012 16:35:06 +0100
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> > What would an appropriate prefix be and how would it coexist with
> > ctl-x-4-map and ctl-x-5-map?
>
> The way I see it, C-x 4 would be a new command which sets some vars that
> affect subsequent commands (i.e. a prefix command, much like C-u or C-x RET
> c) and it would also set-temporary-overlay-map with ctl-x-4-map, so that
> C-x 4 f can be used as a shorthand for C-x 4 C-x C-f.

+1 - that would be great, especially if that worked with all stuff like
C-h i, C-x r j, M-x find-function, ...  But I think it's not trivial to
implement this.  E.g. when using C-x 5, I don't necessarily want
*Completions* to pop up in a new frame.




This bug report was last modified 12 years and 212 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.