From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: can a command specify overwrite selection behavior? Date: Sun, 12 Dec 2010 07:16:00 -0800 (PST) Organization: http://groups.google.com Message-ID: <92235e12-464c-41d9-9a49-33598c157113@i25g2000prd.googlegroups.com> References: <33ac6984-0a0c-4db8-8ea1-50ec5c271a25@x18g2000pro.googlegroups.com> <05a87fbb-31a7-40c3-a890-6c7aacaefac3@t5g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1292259747 26067 80.91.229.12 (13 Dec 2010 17:02:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Dec 2010 17:02:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 13 18:02:23 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PSBmw-0002eN-DW for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Dec 2010 18:02:14 +0100 Original-Received: from localhost ([127.0.0.1]:42338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSBmv-0007tz-SM for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Dec 2010 12:02:13 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!i25g2000prd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 76.126.112.84 Original-X-Trace: posting.google.com 1292166960 22613 127.0.0.1 (12 Dec 2010 15:16:00 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 12 Dec 2010 15:16:00 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i25g2000prd.googlegroups.com; posting-host=76.126.112.84; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10, gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:183186 X-Mailman-Approved-At: Mon, 13 Dec 2010 11:59:52 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77449 Archived-At: On Dec 10, 3:37=A0pm, "Drew Adams" wrote: > > > i have this code that inserts date. > > > > (defun insert-date () > > > =A0 "Insert current date." > > > =A0 (interactive) > > > =A0 (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. =A0Th= at's true > also of any other command with a `delete-selection' property. =A0That 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) thanks Drew for this tip. I didn't know about it. btw, why the distinction on how the command is called? all i recall about this issue is that i entered a bug report and Richard Stallman specifically don't consider it a bug. Xah