[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can a command specify overwrite selection behavior?
From: |
Xah Lee |
Subject: |
Re: can a command specify overwrite selection behavior? |
Date: |
Wed, 08 Dec 2010 15:26:51 -0000 |
User-agent: |
G2/1.0 |
On Aug 31, 10:33 pm, Xah Lee <xah...@gmail.com> wrote:
> 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.
> ...
work around:
(defun insert-date ()
"Insert current date."
(interactive)
(when (region-active-p)
(delete-region (region-beginning) (region-end) )
)
(insert (format-time-string "%Y-%m-%d"))
)
- can a command specify overwrite selection behavior?, Xah Lee, 2010/12/08
- Re: can a command specify overwrite selection behavior?,
Xah Lee <=
- RE: can a command specify overwrite selection behavior?, Drew Adams, 2010/12/10
- 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