[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ztree 1ebb00c 07/23: Issue #52: Added 'd' hotkey for th
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ztree 1ebb00c 07/23: Issue #52: Added 'd' hotkey for the ztree-dir to open dired. |
Date: |
Thu, 17 Dec 2020 23:17:03 -0500 (EST) |
branch: externals/ztree
commit 1ebb00cea3f4d85422d733a51e989bdb237ae3eb
Author: Alexey Veretennikov <txm.fourier@gmail.com>
Commit: Alexey Veretennikov <txm.fourier@gmail.com>
Issue #52: Added 'd' hotkey for the ztree-dir to open dired.
Now in ztree-dir mode hitting 'd' will open a dired
for the directory the point is standing on;
otherwise the dired will be open for the parent directory.
---
README.md | 1 +
ztree-dir.el | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index dc1907a..200843a 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,7 @@ M-x ztree-dir
* To toggle open/closed state of the subtree of the current directory, hit the
`x` key.
* To visit a file, press `Space` key.
* To open file in other window, use `RET` key.
+* To open `Dired` with the directory the point is currently on, use the `d`
key.
### Customizations
Set the `ztree-dir-move-focus` variable to `t` in order to move focus to the
other window when the `RET` key is pressed; the default behavior is to keep
focus in `ztree-dir` window.
diff --git a/ztree-dir.el b/ztree-dir.el
index dada7d0..20795d7 100644
--- a/ztree-dir.el
+++ b/ztree-dir.el
@@ -1,6 +1,6 @@
;;; ztree-dir.el --- Text mode directory tree -*- lexical-binding: t; -*-
-;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
;;
;; Author: Alexey Veretennikov <alexey.veretennikov@gmail.com>
;;
@@ -97,7 +97,8 @@ One could add own filters in the following way:
`(
(,(kbd "H") . ztree-dir-toggle-show-filtered-files)
(,(kbd ">") . ztree-dir-narrow-to-dir)
- (,(kbd "<") . ztree-dir-widen-to-parent)))
+ (,(kbd "<") . ztree-dir-widen-to-parent)
+ (,(kbd "d") . ztree-dir-open-dired-at-point)))
@@ -180,6 +181,19 @@ up of the opened."
(ztree-change-start-node parent))))
+(defun ztree-dir-open-dired-at-point ()
+ "If the point is on a directory, open DIRED with this directory.
+Otherwise open DIRED with the parent directory"
+ (interactive)
+ (let* ((line (line-number-at-pos))
+ (node (ztree-find-node-in-line line))
+ (parent (ztree-get-parent-for-line line)))
+ (cond ((and node (file-directory-p node))
+ (dired node))
+ (parent
+ (dired (ztree-find-node-in-line parent))))))
+
+
;;;###autoload
(defun ztree-dir (path)
"Create an interactive buffer with the directory tree of the PATH given."
- [elpa] externals/ztree 369fd05 10/23: Issue #50: Show file permission differences, (continued)
- [elpa] externals/ztree 369fd05 10/23: Issue #50: Show file permission differences, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 00d3318 12/23: Issue #59: Position curson on the beginning of the text, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 3273e1f 13/23: Issue #60: ztree-dir change Emacs default directory, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree a3e0442 14/23: Issue #59: Place cursor at the beginning of the text, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 2f62ba7 18/23: Issue #62: Cleared warnings, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 4879576 19/23: Issue #39: restore cursor position and window configuration, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree c54425a 21/23: Updated README for issue #65., Stefan Monnier, 2020/12/17
- [elpa] externals/ztree d078daf 08/23: Issue #54: Added (optional) number of directory entries, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree c5a1190 15/23: Issue #61: Error on unaccessible directory contents, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 0a5b25f 23/23: Merge pull request #68 from webzak/fix_ws_ignore, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 1ebb00c 07/23: Issue #52: Added 'd' hotkey for the ztree-dir to open dired.,
Stefan Monnier <=
- [elpa] externals/ztree 30dbda7 16/23: Issue #62, #63, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 50412fa 20/23: Issue #65: added ztree-diff-additional-options variable, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 901c3e3 22/23: support -w for different file size, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 17f8f32 17/23: Update to issue #62, Stefan Monnier, 2020/12/17