mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
Add delete-selection-local-mode.
* lisp/delsel.el (delete-selection-local-mode): Add local version of 'delete-selection-mode'. The local mode sets the value of the variable 'delete-selection-mode' to maintain compatibility with packages and features that consider the existing mode. * doc/emacs/mark.texi (Using Region): Describe 'delete-selection-local-mode'. * etc/NEWS: Describe 'delete-selection-local-mode'.
This commit is contained in:
parent
fb974171b4
commit
e0b21b6c4d
@ -306,6 +306,7 @@ instead signal an error if the mark is inactive.
|
||||
@cindex Delete Selection mode
|
||||
@cindex mode, Delete Selection
|
||||
@findex delete-selection-mode
|
||||
@findex delete-selection-local-mode
|
||||
@vindex delete-selection-temporary-region
|
||||
By default, text insertion occurs normally even if the mark is
|
||||
active---for example, typing @kbd{a} inserts the character @samp{a},
|
||||
@ -323,7 +324,8 @@ setting @code{delete-selection-temporary-region} to @code{selection}:
|
||||
then temporary regions by @kbd{C-u C-x C-x} won't be replaced, only
|
||||
the ones activated by dragging the mouse or shift-selection. To
|
||||
toggle Delete Selection mode on or off, type @kbd{M-x
|
||||
delete-selection-mode}.
|
||||
delete-selection-mode}. To toggle Delete Selection mode on or off
|
||||
in the current buffer only, type @kbd{M-x delete-selection-local-mode}.
|
||||
|
||||
@node Mark Ring
|
||||
@section The Mark Ring
|
||||
|
6
etc/NEWS
6
etc/NEWS
@ -206,6 +206,12 @@ Typing 'M-~' while saving some buffers means not to save the buffer and
|
||||
also to mark it as unmodified. This is an alternative way to mark a
|
||||
buffer as unmodified which doesn't require switching to that buffer.
|
||||
|
||||
** New minor mode 'delete-selection-local-mode'.
|
||||
This mode sets 'delete-selection-mode' buffer-locally. This can be
|
||||
useful for enabling or disabling the features of 'delete-selection-mode'
|
||||
based on the state of the buffer, such as for the different states of
|
||||
modal editing packages.
|
||||
|
||||
|
||||
* Changes in Specialized Modes and Packages in Emacs 31.1
|
||||
|
||||
|
@ -95,6 +95,24 @@ information on adapting behavior of commands in Delete Selection mode."
|
||||
(remove-hook 'pre-command-hook 'delete-selection-pre-hook)
|
||||
(add-hook 'pre-command-hook 'delete-selection-pre-hook)))
|
||||
|
||||
;;;###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.
|
||||
)))
|
||||
|
||||
(defvar delsel--replace-text-or-position nil)
|
||||
|
||||
;;;###autoload
|
||||
|
Loading…
Reference in New Issue
Block a user