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.

Disabling this minor mode will unmark all files within the Dired buffer.

dired-click-to-select-mode(var)/dired-click-to-select-mode(fun) is automatically disabled after any Dired operation (command whose name starts with dired-do) completes.

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.

Disabling this minor mode will unmark all files within the Dired
buffer.

`dired-click-to-select-mode' is automatically disabled after any
Dired operation (command whose name starts with `dired-do')
completes."
  :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))