Function: smart-dired
smart-dired is an interactive and byte-compiled function defined in
hui-mouse.el.
Signature
(smart-dired)
Documentation
Use a single key or mouse key to manipulate directory entries.
Invoked via a key press when in dired-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 selected file/directory is displayed
for editing, normally in another window but if an entry has been dragged
for display in another window, then this entry is displayed in the current
window (DisplayHere minor mode is shown in the mode-line; use {g}
to disable it)
(2) on a Dired header line (other than the end of line):
(a) within the leading whitespace, then if any deletes are to be
performed, they are executed after user verification; otherwise,
nothing is done;
(b) otherwise, Dired is run in another window on the ancestor directory
of the current directory path up through the location of point;
if point is on the first character, then the / root directory
is used.
(3) on or after the last line in the buffer, this Dired invocation is quit.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-mouse.el
(defun smart-dired ()
"Use a single key or mouse key to manipulate directory entries.
Invoked via a key press when in `dired-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 selected file/directory is displayed
for editing, normally in another window but if an entry has been dragged
for display in another window, then this entry is displayed in the current
window (DisplayHere minor mode is shown in the mode-line; use {g}
to disable it)
(2) on a Dired header line (other than the end of line):
(a) within the leading whitespace, then if any deletes are to be
performed, they are executed after user verification; otherwise,
nothing is done;
(b) otherwise, Dired is run in another window on the ancestor directory
of the current directory path up through the location of point;
if point is on the first character, then the / root directory
is used.
(3) on or after the last line in the buffer, this Dired invocation is quit."
(interactive)
(cond ((save-excursion
(forward-line 0)
(looking-at dired-subdir-regexp))
(cond ((and (looking-at "\\s-")
(save-excursion
(skip-syntax-backward "-"))
(bolp))
;; In whitespace at beginning of a directory header line, perform deletes.
(if (save-excursion
(goto-char (point-min))
(re-search-forward "^D" nil t))
(dired-do-flagged-delete)))
(t (hpath:find (smart-dired-pathname-up-to-point)))))
((last-line-p) (quit-window))
(t (hpath:find (or (dired-get-filename nil t) "")))))