Function: delete-selection-local-mode

delete-selection-local-mode is an autoloaded, interactive and byte-compiled function defined in delsel.el.gz.

Signature

(delete-selection-local-mode &optional ARG)

Documentation

Toggle delete-selection-mode(var)/delete-selection-mode(fun) only in this buffer.

For compatibility with features and packages that are aware of delete-selection-mode(var)/delete-selection-mode(fun), this local mode sets the variable delete-selection-mode(var)/delete-selection-mode(fun) in the current buffer as needed.

This is a minor mode. If called interactively, toggle the Delete-Selection-Local 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 (buffer-local-value \=delete-selection-mode
(current-buffer))'.

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

View in manual

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/delsel.el.gz
;;;###autoload
(define-minor-mode delete-selection-local-mode
  "Toggle `delete-selection-mode' only in this buffer.

For compatibility with features and packages that are aware of
`delete-selection-mode', this local mode sets the variable
`delete-selection-mode' in the current buffer as needed."
  :global nil :group 'editing-basics
  :variable (buffer-local-value 'delete-selection-mode (current-buffer))
  (cond
   ((eq delete-selection-mode (default-value 'delete-selection-mode))
    (kill-local-variable 'delete-selection-mode))
   ((not (default-value 'delete-selection-mode))
    ;; Locally enabled, but globally disabled.
    (delete-selection-mode 1)                ; Setup the hooks.
    (setq-default delete-selection-mode nil) ; But keep it globally disabled.
    )))