emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: delete-selection-mode


From: Drew Adams
Subject: RE: delete-selection-mode
Date: Tue, 23 Mar 2010 11:09:06 -0700

> What do you think about marking commands that should delete the active
> region with a new interactive character (like "^" is used to call
> `handle-shift-selection'), so e.g. a new function
> `handle-delete-region' could delete the active region before
> running a command?

Delete-selection mode has just such a property: `delete-selection'. (But it is
simply a symbol property.)

This is precisely how it allows control over which commands delete the active
region and what behavior that deletion entails. It is the basis/essence of
`delete-selection-mode'.

The possible values of property `delete-selection' are:

kill        - kill region
yank        - delete region; adjust kill-ring for the yank 
supersede   - delete region only (ignore current command)
t (non-nil) - delete region (current command inserts text)

Property values for the commands handled by default:

kill: open-line
yank: (clipboard-)yank
t:    self-insert-(command|iso)
      insert-register
      newline(-and-indent)

As an example of how users can take advantage of this, I put a value of t also
on `insert-parentheses' and
`completion-separator-self-insert-(command|autofilling)' (from completion.el).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]