branch: externals/hyperbole commit 3c0df008da0a2e781a42c3d49324f3367f4c6091 Author: Mats Lidell <mats.lid...@lidells.se> Commit: GitHub <nore...@github.com>
Add support for dired-sidebar (#33) * Add support for dired-sidebar * Add doc about dired-sidebar support --- Changes | 4 ++++ HY-NEWS | 4 ++++ hui-dired-sidebar.el | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hui-mouse.el | 4 ++++ man/hkey-help.txt | 3 ++- man/hyperbole.texi | 32 ++++++++++++++++++++++++-- 6 files changed, 108 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index a09de9f..9f4e1d6 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +2020-07-27 Mats Lidell <ma...@gnu.org> + +* hui-dired-sidebar.el: Support for dired-sidebar added. + 2020-07-25 Bob Weiner <r...@gnu.org> * hib-kbd.el (kbd-key:execute-special-series): Added and used in kbd-key:act diff --git a/HY-NEWS b/HY-NEWS index d980eb7..945be78 100644 --- a/HY-NEWS +++ b/HY-NEWS @@ -15,6 +15,10 @@ associated with Agenda items such as TODOs in another window. The Assist Key shows help. + - Smart Dired Sidebar: Smart Key support for the dired-sidebar + package. See "(hyperbole)Smart Key - Dired Sidebar Mode". + + BUTTON TYPES - {Key Series} Button Support for Helm and Counsel: Key series buttons diff --git a/hui-dired-sidebar.el b/hui-dired-sidebar.el new file mode 100644 index 0000000..a86f71a --- /dev/null +++ b/hui-dired-sidebar.el @@ -0,0 +1,64 @@ +;;; hui-dired-sidebar.el --- Hyperbole Smart Key support for dired sidebar +;; +;; Author: Mats Lidell +;; +;; Orig-Date: 25-Jul-20 +;; +;; Copyright (C) 2020 Free Software Foundation, Inc. See the +;; "HY-COPY" file for license information. +;; +;; This file is part of GNU Hyperbole. + +;;; Commentary: + +;;; Code: +;;; ************************************************************************ +;;; Other required Elisp libraries +;;; ************************************************************************ + +(eval-and-compile (require 'dired-sidebar nil t)) + +;;; ************************************************************************ +;;; smart-dired-sidebar functions +;;; ************************************************************************ + +;;;###autoload +(defun smart-dired-sidebar () + "Use a single key or mouse key to manipulate directory entries. + +Invoked via a key press when in dired-sidebar-mode. It assumes +that its caller has already checked that the key was pressed in +an appropriate buffer and has moved the cursor there. + +If key is pressed: + (1) within an entry line, the item is displayed for editing, + normally in another window, or if it is a directory and + `dired-sidebar-cycle-subtree-on-click' is t it will expand + and collapse the entry + (2) at the end of an entry line: invoke `action-key-eol-function', + typically to scroll up proportionally, if an Action Key press; invoke + `assist-key-eol-function', typically to scroll down proportionally, + if an Asisst Key press; + (3) on the first line of the buffer (other than the end of line), + dired is run on the current directory of this dired-sidebar; + (4) at the end of the first or last line of the buffer, + this dired-sidebar invocation is hidden." + + (interactive) + (cond ((first-line-p) + (if (eolp) + (dired-sidebar-toggle-sidebar) + (hact 'link-to-directory default-directory))) + ((and (last-line-p) (eolp)) + (dired-sidebar-toggle-sidebar)) + ((eolp) + (funcall (if assist-flag assist-key-eol-function action-key-eol-function))) + (t (let ((file (dired-get-file-for-visit))) + (if (and dired-sidebar-cycle-subtree-on-click + (file-directory-p file) + (not (string-suffix-p "." file))) + (hact 'dired-sidebar-subtree-toggle) + (hact 'dired-sidebar-find-file file)))))) + +(provide 'hui-dired-sidebar) +;;; hui-dired-sidebar.el ends here diff --git a/hui-mouse.el b/hui-mouse.el index 38df759..47af510 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -100,6 +100,10 @@ Its default value is #'smart-scroll-down." (memq company-active-map (current-minor-mode-maps))) . ((smart-company-to-definition) . (smart-company-help))) ;; + ;; dired-sidebar-mode + ((eq major-mode 'dired-sidebar-mode) . + ((smart-dired-sidebar) . (smart-dired-sidebar))) + ;; ;; Treemacs hierarchical file manager ((eq major-mode 'treemacs-mode) . ((smart-treemacs) . (smart-treemacs))) diff --git a/man/hkey-help.txt b/man/hkey-help.txt index 17ae28c..1d1289e 100644 --- a/man/hkey-help.txt +++ b/man/hkey-help.txt @@ -78,7 +78,8 @@ Mouse-only Control Hyperbole Key Press/Click in Special Modes Region Active Yanks region at release Kills and yanks at release Company Mode Completion Displays definition Displays documentation - Treemacs Displays item Display item + Treemacs Displays item Displays item + Dired Sidebar Displays item Displays item Emacs Push Button Activates button Button help Thing Begin or End Mark thing region Mark & kill thing region Page Directory Listing Jumps to page <- same diff --git a/man/hyperbole.texi b/man/hyperbole.texi index 48d0ca2..0e7f1d7 100644 --- a/man/hyperbole.texi +++ b/man/hyperbole.texi @@ -432,6 +432,7 @@ Smart Keyboard Keys * Smart Key - Company Mode:: * Smart Key - Treemacs:: +* Smart Key - Dired Sidebar Mode:: * Smart Key - Emacs Pushbuttons:: * Smart Key - Argument Completion:: * Smart Key - ID Edit Mode:: @@ -8265,6 +8266,7 @@ If dragged from an Emacs window to outside of Emacs: @menu * Smart Key - Company Mode:: * Smart Key - Treemacs:: +* Smart Key - Dired Sidebar Mode:: * Smart Key - Emacs Pushbuttons:: * Smart Key - Argument Completion:: * Smart Key - ID Edit Mode:: @@ -8308,7 +8310,6 @@ If dragged from an Emacs window to outside of Emacs: * Smart Key - Default Context:: @end menu - @node Smart Key - Company Mode, Smart Key - Treemacs, Smart Keyboard Keys, Smart Keyboard Keys @subsection Smart Key - Company Mode @@ -8327,7 +8328,7 @@ When company-mode is active: @end format -@node Smart Key - Treemacs, Smart Key - Emacs Pushbuttons, Smart Key - Company Mode, Smart Keyboard Keys +@node Smart Key - Treemacs, Smart Key - Dired Sidebar Mode, Smart Key - Company Mode, Smart Keyboard Keys @subsection Smart Key - Treemacs @cindex Treemacs @@ -8359,6 +8360,33 @@ When in a Treemacs file browser buffer: @end group @end format +@node Smart Key - Dired Sidebar Mode, Smart Key - Emacs Pushbuttons, Smart Keyboard Keys, Smart Keyboard Keys +@subsection Smart Key - Dired Sidebar Mode + +@cindex dired-sidebar-mode +Dired-sidebar is an add-on Emacs package that puts dired in a sidebar +and optionally integrates with vareous other packages. Use the Emacs +package manager to install it and then invoke it with +@bkbd{M-x dired-sidebar-toggle-sidebar @key{RET}} and quit with @bkbd{q}. + +@format +@group +When in a dired-sidebar buffer: + ACTION KEY or ASSIST KEY + (1) within an entry line, the item is displayed for editing, + normally in another window, or if it is a directory and + `dired-sidebar-cycle-subtree-on-click' is t it will expand + and collapse the entry + (2) at the end of an entry line: invoke `action-key-eol-function', + typically to scroll up proportionally, if an Action Key press; invoke + `assist-key-eol-function', typically to scroll down proportionally, + if an Asisst Key press; + (3) on the first line of the buffer (other than the end of line), + dired is run on the current directory of this dired-sidebar; + (4) at the end of the first or last line of the buffer, + this dired-sidebar invocation is hidden. +@end group +@end format @node Smart Key - Emacs Pushbuttons, Smart Key - Argument Completion, Smart Key - Treemacs, Smart Keyboard Keys @subsection Smart Key - Emacs Pushbuttons