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: Sat, 26 Aug 2017 18:26:58 +0900 (JST) Message-ID: <20170826.182658.1910804375178800263.tkk@misasa.okayama-u.ac.jp> References: <20170718.133803.63761803157557694.tkk@misasa.okayama-u.ac.jp> <20170826.152747.1961624282102985626.tkk@misasa.okayama-u.ac.jp> <83ziam698h.fsf@gnu.org> 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 1503739762 3814 195.159.176.226 (26 Aug 2017 09:29:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 26 Aug 2017 09:29:22 +0000 (UTC) Cc: 27435@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp To: eliz@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 26 11:29:16 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 1dlXOv-0000L0-I9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Aug 2017 11:29:09 +0200 Original-Received: from localhost ([::1]:56714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dlXP1-0000YY-Hp for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Aug 2017 05:29:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dlXOr-0000YO-OK for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2017 05:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dlXOo-0001lH-H4 for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2017 05:29:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47308) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dlXOo-0001l8-DC for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2017 05:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dlXOo-00013b-7D for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2017 05:29: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: Sat, 26 Aug 2017 09:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 27435-submit@debbugs.gnu.org id=B27435.15037396894003 (code B ref 27435); Sat, 26 Aug 2017 09:29:02 +0000 Original-Received: (at 27435) by debbugs.gnu.org; 26 Aug 2017 09:28:09 +0000 Original-Received: from localhost ([127.0.0.1]:55989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dlXNx-00012V-Ac for submit@debbugs.gnu.org; Sat, 26 Aug 2017 05:28:09 -0400 Original-Received: from mxl069v66.mxlogic.net ([208.81.69.66]:26733 helo=s18p02o143.mxlogic.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dlXNu-00012L-3Z for 27435@debbugs.gnu.org; Sat, 26 Aug 2017 05:28:07 -0400 Original-Received: from unknown [42.127.236.175] (EHLO mlsec.cc.okayama-u.ac.jp) by s18p02o143.mxlogic.net(mxl_mta-8.5.0-1834) over TLS secured channel with ESMTP id 02f31a95.0.145928.00-388.287201.s18p02o143.mxlogic.net (envelope-from ); Sat, 26 Aug 2017 03:28:02 -0600 (MDT) X-MXL-Hash: 59a13f226497ecf1-e41aa653b7c25f36c1c0fc5c8dcdc551ad5f62be Original-Received: from alml002.ouadm.okayama-u.ac.jp (unknown [42.127.236.168]) by mlsec.cc.okayama-u.ac.jp with smtp id 4794_20c5_6023e21e_0115_4a0e_9107_9b46a7bc435f; Sat, 26 Aug 2017 18:27:54 +0900 Original-Received: from localhost (p219225-ipngn200207tottori.tottori.ocn.ne.jp [153.182.218.225]) by alml002.ouadm.okayama-u.ac.jp (Postfix) with ESMTPSA id E0BFA4C0A9E; Sat, 26 Aug 2017 18:27:54 +0900 (JST) In-Reply-To: <83ziam698h.fsf@gnu.org> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) X-NAI-Spam-Flag: NO X-NAI-Spam-Level: ********** X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 10.1 X-NAI-Spam-Rules: 6 Rules triggered TS_MSG_REP_80_512=10, RCVD_BAD_SIP=0.1, EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_FAIL=0, RV6102=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6102> : inlines <6038> : streams <1760239> : uri <2490022> X-AnalysisOut: [v=2.2 cv=E6K9neVl c=1 sm=1 tr=0 a=8LLPK8U+aGQ6qN8QlyMYtQ==] X-AnalysisOut: [:117 a=8LLPK8U+aGQ6qN8QlyMYtQ==:17 a=kj9zAlcOel0A:10 a=KeK] X-AnalysisOut: [AF7QvOSUA:10 a=vGk2VsPmdfzh2YW93noA:9 a=CjuIK1q_8ugA:10] X-Spam: [F=0.5000000000; CM=0.500; MH=0.500(2017082605); S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [42.127.236.175] 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:136223 Archived-At: Thank you for the response! > Can you describe a use case where you need to customize the function > used to visit a file from Dired? On dired I use `RET', `o', and `C-o' on different occasions and I prefer mouse click to work as `RET' instead of `C-o'. This is especially true when there are more than three windows in a frame. The patch lets mouse click on dired visit a file or directory in not in with following customization. (setq dired-mouse-find-file-func 'find-file) > (Btw, we use "visit a file", not "open a file" in our terminology, so > at least that aspect in the doc strings of your patch should be > amended.) I revised phrases from "open a file" to "visit a file". I hope now this patch is ready for consideration and applied. # Change log 2017-08-26 Tak Kunihiro Let user specify function to visit a 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): Visit a file or directory by `dired-mouse-find-file-func' or `dired-mouse-find-dir-func'. (dired-mouse-find-file-func): Specify function to visit a file on `dired-mouse-find-file-other-window'. (dired-mouse-find-dir-func): Specify function to visit a directory on `dired-mouse-find-file-other-window'. # NEWS ** Use can specify function to visit a file or directory in dired using mouse click. You can specify function to visit a 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 visit a 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 visit a 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 visit the 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)}