GNU bug report logs -
#27435
patch for dired-mouse-find-file-other-window
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27435 in the body.
You can then email your comments to 27435 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Wed, 21 Jun 2017 02:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 21 Jun 2017 02:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <tkk <at> misasa.okayama-u.ac.jp>
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)}
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Tue, 18 Jul 2017 05:00:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Is the patch I sent 4 weeks ago NG?
From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
Subject: patch for dired-mouse-find-file-other-window
Date: Wed, 21 Jun 2017 10:41:00 +0900 (JST)
> 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 <tkk <at> misasa.okayama-u.ac.jp>
>
> 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)}
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sat, 26 Aug 2017 06:29:01 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
I have sent a patch to let mouse click on dired to open file (or
directory) in this-window not in other-window, 8 weeks ago. This
patch does not change default, and (I think) lets dired respond to
what non-expert expects, with following two local lines.
(setq dired-mouse-find-dir-func (lambda (file) (interactive) (dired-find-alternate-file)))
(setq dired-mouse-find-file-func 'find-file)
Please respond to the patch (including rejection).
> 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 <tkk <at> misasa.okayama-u.ac.jp>
>
> 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)}
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sat, 26 Aug 2017 06:29:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sat, 26 Aug 2017 08:10:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 27435 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 26 Aug 2017 15:27:47 +0900 (JST)
> From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
> Cc: tkk <at> misasa.okayama-u.ac.jp
>
> I have sent a patch to let mouse click on dired to open file (or
> directory) in this-window not in other-window, 8 weeks ago. This
> patch does not change default, and (I think) lets dired respond to
> what non-expert expects, with following two local lines.
>
> (setq dired-mouse-find-dir-func (lambda (file) (interactive) (dired-find-alternate-file)))
> (setq dired-mouse-find-file-func 'find-file)
>
> Please respond to the patch (including rejection).
It is "wishlist" bug report, so lack of response generally means
there's not much interest in the proposal.
Can you describe a use case where you need to customize the function
used to visit a file from Dired?
(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.)
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sat, 26 Aug 2017 09:29:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 27435 <at> debbugs.gnu.org (full text, mbox):
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
<this-window> not in <other-window> 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 <tkk <at> misasa.okayama-u.ac.jp>
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)}
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sat, 26 Aug 2017 10:28:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 27435 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 26 Aug 2017 18:26:58 +0900 (JST)
> Cc: 27435 <at> debbugs.gnu.org, tkk <at> misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
>
> > 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
> <this-window> not in <other-window> with following customization.
>
> (setq dired-mouse-find-file-func 'find-file)
But you could have the same effect by rebinding mouse-2 to another
function. We just need to add such a function, which should work like
dired-mouse-find-file-other-window, but visit the file in the same
window. That sounds like a better alternative for this use case,
because customizing a function-valued variable is trickier for users
than rebinding keys.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sun, 27 Aug 2017 09:04:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 27435 <at> debbugs.gnu.org (full text, mbox):
>> 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
>> <this-window> not in <other-window> with following customization.
>>
>> (setq dired-mouse-find-file-func 'find-file)
>
> But you could have the same effect by rebinding mouse-2 to another
> function. We just need to add such a function, which should work like
> dired-mouse-find-file-other-window, but visit the file in the same
> window. That sounds like a better alternative for this use case,
> because customizing a function-valued variable is trickier for users
> than rebinding keys.
I agree.
Then the new function `dired-mouse-find-file-this-window' will look
very similar to `dired-mouse-find-file-other-window' but two lines.
Is that OK?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sun, 27 Aug 2017 12:57:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 27435 <at> debbugs.gnu.org (full text, mbox):
> Then the new function `dired-mouse-find-file-this-window' will look
> very similar to `dired-mouse-find-file-other-window' but two lines.
> Is that OK?
FWIW: Conventionally, we add `-other-window' or `-other-frame'
to the same-window command name, which lacks any such suffix.
IOW, typically we do not use `-this-window'.
FWIW2: Dired+ has had such a same-window mouse command since
1999 (if not before). There is also an `-other-frame' version.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sun, 27 Aug 2017 14:42:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 27435 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 27 Aug 2017 18:02:43 +0900 (JST)
> Cc: 27435 <at> debbugs.gnu.org, tkk <at> misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
>
> > But you could have the same effect by rebinding mouse-2 to another
> > function. We just need to add such a function, which should work like
> > dired-mouse-find-file-other-window, but visit the file in the same
> > window. That sounds like a better alternative for this use case,
> > because customizing a function-valued variable is trickier for users
> > than rebinding keys.
>
> I agree.
>
> Then the new function `dired-mouse-find-file-this-window' will look
> very similar to `dired-mouse-find-file-other-window' but two lines.
> Is that OK?
We could factor out the common part into a new function, and then make
those two functions call it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Mon, 28 Aug 2017 00:23:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 27435 <at> debbugs.gnu.org (full text, mbox):
Thank you for the comments.
>>> But you could have the same effect by rebinding mouse-2 to another
>>> function. We just need to add such a function, which should work like
>>> dired-mouse-find-file-other-window, but visit the file in the same
>>> window. That sounds like a better alternative for this use case,
>>> because customizing a function-valued variable is trickier for users
>>> than rebinding keys.
>>
>> Then the new function `dired-mouse-find-file-this-window' will look
>> very similar to `dired-mouse-find-file-other-window' but two lines.
>> Is that OK?
>
> We could factor out the common part into a new function, and then make
> those two functions call it.
> FWIW: Conventionally, we add `-other-window' or `-other-frame'
> to the same-window command name, which lacks any such suffix.
> IOW, typically we do not use `-this-window'.
>
> FWIW2: Dired+ has had such a same-window mouse command since
> 1999 (if not before). There is also an `-other-frame' version.
With the suggestions, I created two functions.
- dired-mouse-find-file (new, this inherits common part)
- dired-mouse-find-file-other-window
- dired-mouse-find-file-other-frame (new)
I attach the patch. This does not change the default behavior.
diff --git a/dired.252.el b/dired.el
index 39dc29e..3a4bbce 100644
--- a/dired.252.el
+++ b/dired.el
@@ -2117,9 +2117,12 @@ directory in another window."
;; 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."
+(defun dired-mouse-find-file (event &optional find-file-func find-dir-func)
+ "In Dired, visit the file or directory name you click on.
+FIND-FILE-FUNC and FIND-DIR-FUNC specify functions to visit the file and directory, respectively."
(interactive "e")
+ (or find-file-func (setq find-file-func 'find-file))
+ (or find-dir-func (setq find-file-func 'find-alternate-file))
(let (window pos file)
(save-excursion
(setq window (posn-window (event-end event))
@@ -2134,9 +2137,19 @@ directory in another window."
(dired-goto-subdir file))
(progn
(select-window window)
- (dired-other-window file)))
+ (funcall find-dir-func file)))
(select-window window)
- (find-file-other-window (file-name-sans-versions file t)))))
+ (funcall find-file-func (file-name-sans-versions file t)))))
+
+(defun dired-mouse-find-file-other-window (event)
+ "In Dired, visit the file or directory name you click on other window."
+ (interactive "e")
+ (dired-mouse-find-file event 'find-file-other-window 'dired-other-window))
+
+(defun dired-mouse-find-file-other-frame (event)
+ "In Dired, visit the file or directory name you click on other frame."
+ (interactive "e")
+ (dired-mouse-find-file event 'find-file-other-frame 'dired-other-frame))
(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#27435
; Package
emacs
.
(Sat, 02 Sep 2017 10:21:01 GMT)
Full text and
rfc822 format available.
Message #38 received at 27435 <at> debbugs.gnu.org (full text, mbox):
> From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
> Date: Mon, 28 Aug 2017 09:22:35 +0900
> Cc: 国広卓也 <tkk <at> misasa.okayama-u.ac.jp>,
> 27435 <at> debbugs.gnu.org
>
> With the suggestions, I created two functions.
>
> - dired-mouse-find-file (new, this inherits common part)
> - dired-mouse-find-file-other-window
> - dired-mouse-find-file-other-frame (new)
>
> I attach the patch. This does not change the default behavior.
Thanks. Some minor comments:
> +(defun dired-mouse-find-file (event &optional find-file-func find-dir-func)
> + "In Dired, visit the file or directory name you click on.
> +FIND-FILE-FUNC and FIND-DIR-FUNC specify functions to visit the file and directory, respectively."
This last line is too long, please break it into 2. Also, the doc
string should say explicitly these arguments are optional, and what
they default to if omitted or nil.
> + (or find-file-func (setq find-file-func 'find-file))
> + (or find-dir-func (setq find-file-func 'find-alternate-file))
I'm not sure I understand why these particular defaults. Can you
explain? In particular, find-alternate-file sounds strange to me.
Finally, 2 nits:
. please always provide a log message for the changes
. your patch doesn't apply cleanly, presumably due to some
difference in whitespace vs the Git repository; please make sure
your diffs are always against the latest Git version
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27435
; Package
emacs
.
(Sun, 03 Sep 2017 02:09:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 27435 <at> debbugs.gnu.org (full text, mbox):
Thank you for the response.
>> +(defun dired-mouse-find-file (event &optional find-file-func find-dir-func)
>> + "In Dired, visit the file or directory name you click on.
>> +FIND-FILE-FUNC and FIND-DIR-FUNC specify functions to visit the file and directory, respectively."
>
> This last line is too long, please break it into 2. Also, the doc
> string should say explicitly these arguments are optional, and what
> they default to if omitted or nil.
I separated the line into two. I revised the doc string to infer
option and default explicitly. Please modify it if unclear.
>> + (or find-file-func (setq find-file-func 'find-file))
>> + (or find-dir-func (setq find-file-func 'find-alternate-file))
>
> I'm not sure I understand why these particular defaults. Can you
> explain? In particular, find-alternate-file sounds strange to me.
I think `dired-mouse-find-file' should behave similar to <RET>
`dired-find-file'. For visiting a file in this window, the most
similar function to `dired-find-file' with similar argument to
`find-file-other-window' is `find-file'. For visiting a directory in
this window, the most similar function to `dired-find-file' with
similar argument to `dired-other-window' is `dired'. Also there was a
typo. On summary, current defaults are shown below.
(or find-file-func (setq find-file-func 'find-file))
(or find-dir-func (setq find-dir-func 'dired))
> . please always provide a log message for the changes
> . your patch doesn't apply cleanly, presumably due to some
> difference in whitespace vs the Git repository; please make sure
> your diffs are always against the latest Git version
I attach Change Log and a patch relative to the latest Git version.
I hope this meets your comments!
# Change log
2017-09-03 Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
Let mouse-2 on Dired visit a file or directory in this window, other window, and other frame
* lisp/dired.el (dired-mouse-find-file): Visit a file or directory by this
window. User can specify functions to visit a file or directory, respectively.
(dired-mouse-find-file-other-window): Visit a file or directory in other window.
(dired-mouse-find-file-other-frame): Visit a file or directory in other frame.
# PATCH
diff --git a/dired.260.el b/dired.el
index ff62183..da5ad0e 100755
--- a/dired.260.el
+++ b/dired.el
@@ -2233,9 +2233,15 @@ directory in another window."
;; 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."
+(defun dired-mouse-find-file (event &optional find-file-func find-dir-func)
+ "In Dired, visit the file or directory name you click on.
+The optional arguments FIND-FILE-FUNC and FIND-DIR-FUNC specify
+functions to visit the file and directory, respectively. By
+default, the file and directry are visited by `find-file' and
+`dired', respectively."
(interactive "e")
+ (or find-file-func (setq find-file-func 'find-file))
+ (or find-dir-func (setq find-dir-func 'dired))
(let (window pos file)
(save-excursion
(setq window (posn-window (event-end event))
@@ -2250,9 +2256,19 @@ directory in another window."
(dired-goto-subdir file))
(progn
(select-window window)
- (dired-other-window file)))
+ (funcall find-dir-func file)))
(select-window window)
- (find-file-other-window (file-name-sans-versions file t)))))
+ (funcall find-file-func (file-name-sans-versions file t)))))
+
+(defun dired-mouse-find-file-other-window (event)
+ "In Dired, visit the file or directory name you click on other window."
+ (interactive "e")
+ (dired-mouse-find-file event 'find-file-other-window 'dired-other-window))
+
+(defun dired-mouse-find-file-other-frame (event)
+ "In Dired, visit the file or directory name you click on other frame."
+ (interactive "e")
+ (dired-mouse-find-file event 'find-file-other-frame 'dired-other-frame))
(defun dired-view-file ()
"In Dired, examine a file in view mode, returning to Dired when done.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Fri, 08 Sep 2017 08:57:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
:
bug acknowledged by developer.
(Fri, 08 Sep 2017 08:57:02 GMT)
Full text and
rfc822 format available.
Message #46 received at 27435-done <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 03 Sep 2017 11:08:07 +0900 (JST)
> Cc: drew.adams <at> oracle.com, 27435 <at> debbugs.gnu.org, tkk <at> misasa.okayama-u.ac.jp
> From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
>
> I attach Change Log and a patch relative to the latest Git version.
>
> I hope this meets your comments!
Thanks, pushed. One more nit: please always mention the bug number in
the log message. (I added the missing reference this time.)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 06 Oct 2017 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 262 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.