You say that you never want to use the secondary selection. In that case, just bind the keys that are bound to secondary-selection commands by default to commands that you find more useful. Or unbind them, by binding them to nil
. These are those keys:
M-mouse-1
(mouse-start-secondary
, by default)
M-drag-mouse-1
(mouse-set-secondary
, by default)
M-down-mouse-1
(mouse-drag-secondary
, by default)
M-mouse-2
(mouse-yank-secondary
, by default)
M-mouse-3
(mouse-secondary-save-then-kill
, by default)
For example:
(global-set-key [M-mouse-1] 'a-handy-mouse-command)
On the other hand, if the problem is that your window manager steals those keys, then consider binding different keys to those commands. For instance, add modifier Control
to each of the default keys: C-M-mouse-1
etc.
(global-set-key [C-M-mouse-1] 'mouse-start-secondary)
And if the problem is that you don't want to use the mouse for manipulating the secondary selection, then you can use the keyboard instead. Library second-sel.el
can help with this and other ways to use the secondary selection.
For example, you can get rid of the secondary selection interactively anytime this way, if you bind secondary-dwim
to C-M-y
(for example):
C-SPC
- to create an empty active region.
C-1 C-M-y
- to move the secondary selection to the region (which is empty).
This is the doc string of command secondary-dwim
, which second-sel.el
binds by default to C-M-y
:
C-M-y runs the command secondary-dwim, which is an interactive
compiled Lisp function in `second-sel.el'.
It is bound to C-M-y, menu-bar edit secondary-dwim.
(secondary-dwim ARG)
Do-What-I-Mean with the secondary selection.
Prefix arg:
None: Yank secondary.
Zero: Select secondary as region.
> 0: Move secondary to region.
< 0: Swap region and secondary.
Details:
No prefix arg: Yank the secondary selection at point. Move point to
the end of the inserted text. Leave mark where it was.
Zero arg: Select the secondary selection and pop to its buffer.
Non-zero arg: Move the secondary selection to this buffer's region.
Negative arg: Also go to where the secondary selection was and select
it as the region. That is, swap the region and the secondary
selection.
(delete-overlay secondary-mouse-overlay)
?