From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.bugs Subject: bug#27435: patch for dired-mouse-find-file-other-window Date: Wed, 21 Jun 2017 10:41:00 +0900 (JST) Message-ID: <20170621.104100.1058355568954942364.tkk@misasa.okayama-u.ac.jp> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1498010655 23397 195.159.176.226 (21 Jun 2017 02:04:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Jun 2017 02:04:15 +0000 (UTC) Cc: tkk@misasa.okayama-u.ac.jp To: 27435@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 21 04:04:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNV06-0005eW-9b for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Jun 2017 04:04:10 +0200 Original-Received: from localhost ([::1]:51418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNV08-0004iP-1g for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Jun 2017 22:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNV01-0004i9-V1 for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:04:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNUzy-0003Ra-Re for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:04:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNUzy-0003RW-OP for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dNUzy-000114-GV for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Jun 2017 02:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14980106113866 (code B ref -1); Wed, 21 Jun 2017 02:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jun 2017 02:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:58640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNUzS-00010I-M1 for submit@debbugs.gnu.org; Tue, 20 Jun 2017 22:03:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNUzQ-000106-M9 for submit@debbugs.gnu.org; Tue, 20 Jun 2017 22:03:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNUzK-0003Cd-9a for submit@debbugs.gnu.org; Tue, 20 Jun 2017 22:03:23 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42602) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dNUzK-0003CZ-6Q for submit@debbugs.gnu.org; Tue, 20 Jun 2017 22:03:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNUzI-0004gb-RN for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:03:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNUzF-0003B0-PN for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:03:20 -0400 Original-Received: from mxl065v67.mxlogic.net ([208.81.65.67]:37238 helo=s14p02o144.mxlogic.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dNUzF-00039p-8K for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2017 22:03:17 -0400 Original-Received: from unknown [42.127.236.175] (EHLO mlsec.cc.okayama-u.ac.jp) by s14p02o144.mxlogic.net(mxl_mta-8.5.0-1789) with ESMTP id 4e3d9495.7f4e5d7fb700.256791.00-579.557825.s14p02o144.mxlogic.net (envelope-from ); Tue, 20 Jun 2017 20:03:16 -0600 (MDT) X-MXL-Hash: 5949d3e47976971b-37bd18695b2da5522ff02729adb303af93a30922 Original-Received: from unknown [42.127.236.175] (EHLO mlsec.cc.okayama-u.ac.jp) by s14p02o144.mxlogic.net(mxl_mta-8.5.0-1789) over TLS secured channel with ESMTP id 0bec9495.0.256385.00-375.556896.s14p02o144.mxlogic.net (envelope-from ); Tue, 20 Jun 2017 19:41:05 -0600 (MDT) X-MXL-Hash: 5949ceb14c215d1c-7da5761d7b16134a8c10462d86773aa5fe215195 Original-Received: from alml002.ouadm.okayama-u.ac.jp (unknown [42.127.236.168]) by mlsec.cc.okayama-u.ac.jp with smtp id 7fca_3a33_7859ea3c_022d_4756_94e9_00936ecc91f1; Wed, 21 Jun 2017 10:41:00 +0900 Original-Received: from localhost (unknown [172.24.2.234]) by alml002.ouadm.okayama-u.ac.jp (Postfix) with ESMTPSA id AAA354C0AF0; Wed, 21 Jun 2017 10:41:01 +0900 (JST) X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 4 Rules triggered EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_PASS=0, RV6052=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6052> : inlines <5938> : streams <1750814> : uri <2447462> X-AnalysisOut: [v=2.2 cv=V/oN6avi c=1 sm=1 tr=0 a=8LLPK8U+aGQ6qN8QlyMYtQ==] X-AnalysisOut: [:117 a=8LLPK8U+aGQ6qN8QlyMYtQ==:17 a=kj9zAlcOel0A:10 a=LWS] X-AnalysisOut: [FodeU3zMA:10 a=vjyJgskHlLV86ca94-4A:9 a=CjuIK1q_8ugA:10] X-Spam: [F=0.5100000000; CM=0.500; MH=0.510(2017062006); S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [42.127.236.175] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:133789 Archived-At: For now, mouse click on dired displays file (or directory) in other-window. I am sending a patch to display file (or directory) using specified functions. # Change log 2017-05-20 Tak Kunihiro Let user specify function to open file or directory in dired using mouse-2 * doc/emacs/dired.texi (Navigation): Document support of customizing functions to be used by mouse-2. * lisp/dired.el (dired-mouse-find-file-other-window): Open file or directory by `dired-mouse-find-file-func' or `dired-mouse-find-dir-func'. (dired-mouse-find-file-func): Specify function to open file on `dired-mouse-find-file-other-window'. (dired-mouse-find-dir-func): Specify function to open directory on `dired-mouse-find-file-other-window'. # NEWS ** Use can specify function to open file or directory in dired using mouse click. You can specify function to open file or directory by 'dired-mouse-find-file-func' and 'dired-mouse-find-dir-func'. # Code diff --git a/dired.252.el b/dired.el index 39dc29e..8c21388 100644 --- a/dired.252.el +++ b/dired.el @@ -2117,8 +2117,20 @@ directory in another window." ;; Don't override the setting from .emacs. ;;;###autoload (put 'dired-find-alternate-file 'disabled t) +(defcustom dired-mouse-find-file-func 'find-file-other-window + "Function to open file by `dired-mouse-find-file-other-window'." + :group 'mouse + :type 'function + :version "26.1") +(defcustom dired-mouse-find-dir-func 'dired-other-window + "Function to open directory by `dired-mouse-find-file-other-window'." + :group 'mouse + :type 'function + :version "26.1") (defun dired-mouse-find-file-other-window (event) - "In Dired, visit the file or directory name you click on." + "In Dired, visit the file or directory name you click on. +To open file or directory, this uses +`dired-mouse-find-file-func' or `dired-mouse-find-dir-func'." (interactive "e") (let (window pos file) (save-excursion @@ -2134,9 +2146,9 @@ directory in another window." (dired-goto-subdir file)) (progn (select-window window) - (dired-other-window file))) + (funcall dired-mouse-find-dir-func file))) (select-window window) - (find-file-other-window (file-name-sans-versions file t))))) + (funcall dired-mouse-find-file-func (file-name-sans-versions file t))))) (defun dired-view-file () "In Dired, examine a file in view mode, returning to Dired when done. # Info diff --git a/dired.252.texi b/dired.texi index 0e62a9e..323d350 100644 --- a/dired.252.texi +++ b/dired.texi @@ -358,7 +358,9 @@ another window, but do not select that window (@code{dired-display-file @findex dired-mouse-find-file-other-window Visit the file whose name you clicked on (@code{dired-mouse-find-file-other-window}). This uses another window -to display the file, like the @kbd{o} command. +to display the file, like the @kbd{o} command. You can change which +window to display the file by customizing the variables +@code{dired-mouse-find-file-func} and @code{dired-mouse-find-dir-func}. @item v @kindex v @r{(Dired)}