Function: dired-click-to-select-mode

dired-click-to-select-mode is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-click-to-select-mode &optional ARG)

Documentation

Toggle click-to-select inside this Dired buffer.

When this minor mode is enabled, using mouse-2 on a file name within a Dired buffer will toggle its mark instead of going to it within another window.

This minor mode is intended to be used when performing file management using a touch-screen device. The mode is automatically enabled when a
"hold" gesture over a file name is received, and is therefore
automatically disabled after any Dired operation on the marked files (any command whose name starts with "dired-do-" and which performs some operation on the marked files) completes. When the mode is automatically disabled, it unmarks all the marked files in the Dired buffer.

This is a minor mode. If called interactively, toggle the Dired-Click-To-Select mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable dired-click-to-select-mode(var)/dired-click-to-select-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(define-minor-mode dired-click-to-select-mode
  "Toggle click-to-select inside this Dired buffer.
When this minor mode is enabled, using `mouse-2' on a file name
within a Dired buffer will toggle its mark instead of going to it
within another window.

This minor mode is intended to be used when performing file management
using a touch-screen device.  The mode is automatically enabled when a
\"hold\" gesture over a file name is received, and is therefore
automatically disabled after any Dired operation on the marked
files (any command whose name starts with \"dired-do-\" and which
performs some operation on the marked files) completes.  When the mode
is automatically disabled, it unmarks all the marked files in the Dired
buffer."
  :group 'dired
  :lighter " Click-To-Select"
  (unless (derived-mode-p '(dired-mode wdired-mode))
    (error "Not a Dired buffer"))
  (if dired-click-to-select-mode
      (setq-local tool-bar-map
                  `(keymap (exit-click-to-select menu-item
                            "Exit Click To Select Mode"
                            dired-click-to-select-mode
                            :help "Exit `dired-click-to-select-mode'."
                            :image ,(tool-bar--image-expression "close")
                            :enable t)))
    ;; Reset the default tool bar.
    (kill-local-variable 'tool-bar-map)
    (dired-unmark-all-marks))
  ;; Repropertize this Dired buffer.
  (let ((inhibit-read-only t))
    (remove-text-properties (point-min) (point-max)
                            '(invisible nil
                              keymap nil
                              dired-filename nil
                              help-echo nil
                              mouse-face nil))
    (when dired-make-directory-clickable
      (dired--make-directory-clickable))
    (dired-insert-set-properties (point-min) (point-max)))
  ;; Redisplay the tool bar.
  (force-mode-line-update))