From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#11233: 24.1.50; Wishlist: dired mouse-2 other window behavior Date: Sat, 06 Oct 2012 14:56:51 +0200 Message-ID: <50702A93.7060008@gmx.at> References: <86vcl4uwxa.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1349528225 13856 80.91.229.3 (6 Oct 2012 12:57:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Oct 2012 12:57:05 +0000 (UTC) Cc: 11233@debbugs.gnu.org To: michael_heerdegen@web.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 06 14:57:11 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TKTwM-0000Lh-Ae for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Oct 2012 14:57:10 +0200 Original-Received: from localhost ([::1]:50700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKTwG-0006Ef-I0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Oct 2012 08:57:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKTwD-00065f-8A for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 08:57:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKTwB-0001v6-TX for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 08:57:01 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKTwB-0001v2-QG for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 08:56:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TKTwR-00035v-DB for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 08:57:15 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Oct 2012 12:57:15 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11233 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11233-submit@debbugs.gnu.org id=B11233.134952823111872 (code B ref 11233); Sat, 06 Oct 2012 12:57:15 +0000 Original-Received: (at 11233) by debbugs.gnu.org; 6 Oct 2012 12:57:11 +0000 Original-Received: from localhost ([127.0.0.1]:57902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKTwF-00035C-L0 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 08:57:05 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:52638) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1TKTw7-00034g-Cu for 11233@debbugs.gnu.org; Sat, 06 Oct 2012 08:57:00 -0400 Original-Received: (qmail invoked by alias); 06 Oct 2012 12:56:33 -0000 Original-Received: from 62-47-53-96.adsl.highway.telekom.at (EHLO [62.47.53.96]) [62.47.53.96] by mail.gmx.net (mp040) with SMTP; 06 Oct 2012 14:56:33 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+FRrxXFPGFJuXCwBgC4BS9QOFmtUPIj2x+RbLhR2 1kuYoHoemHwHbu In-Reply-To: <86vcl4uwxa.fsf@web.de> X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65265 Archived-At: > 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.