[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: can a command specify overwrite selection behavior?
From: |
Drew Adams |
Subject: |
RE: can a command specify overwrite selection behavior? |
Date: |
Fri, 10 Dec 2010 15:37:10 -0800 |
> > i have this code that inserts date.
> >
> > (defun insert-date ()
> > "Insert current date."
> > (interactive)
> > (insert (format-time-string "%Y-%m-%d")))
> >
> > (put 'insert-date 'delete-selection t)
> >
> > the last line is to make sure that if i have a text selection, just
> > overwrite it. but it doesn't work.
Actually, it does work, Xah.
If you just try `M-x insert-date' then you won't see that it works. That's true
also of any other command with a `delete-selection' property. That has to do
with the region being deactivated when you exit the minibuffer.
To see that it works, bind it to a key and then use the key:
(global-set-key [insert] 'insert-date)
- can a command specify overwrite selection behavior?, Xah Lee, 2010/12/08
- Re: can a command specify overwrite selection behavior?, Xah Lee, 2010/12/08
- RE: can a command specify overwrite selection behavior?,
Drew Adams <=
- Message not available
- Re: can a command specify overwrite selection behavior?, Xah Lee, 2010/12/13
- RE: can a command specify overwrite selection behavior?, Drew Adams, 2010/12/13
- Message not available
- Re: can a command specify overwrite selection behavior?, Xah Lee, 2010/12/22
- RE: can a command specify overwrite selection behavior?, Drew Adams, 2010/12/22
- Message not available
- Re: can a command specify overwrite selection behavior?, Xah Lee, 2010/12/22
- Message not available
- Re: can a command specify overwrite selection behavior?, Ilya Zakharevich, 2010/12/25
- RE: can a command specify overwrite selection behavior?, Drew Adams, 2010/12/25
- Message not available
- Re: can a command specify overwrite selection behavior?, Ilya Zakharevich, 2010/12/25
- RE: can a command specify overwrite selection behavior?, Drew Adams, 2010/12/25
- Message not available
- Re: can a command specify overwrite selection behavior?, Xah Lee, 2010/12/25