From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: (insert ...) won't respect delete-selection-mode Date: Tue, 7 Oct 2008 12:57:06 -0700 Message-ID: <000601c928b6$e04a62a0$0200a8c0@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1223409477 6769 80.91.229.12 (7 Oct 2008 19:57:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Oct 2008 19:57:57 +0000 (UTC) To: "'Xah'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 07 21:58:54 2008 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.50) id 1KnIha-0008Po-1g for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Oct 2008 21:58:38 +0200 Original-Received: from localhost ([127.0.0.1]:35774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KnIgW-0006Ne-Af for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Oct 2008 15:57:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KnIgC-0006Ma-Fl for help-gnu-emacs@gnu.org; Tue, 07 Oct 2008 15:57:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KnIgA-0006M4-Oq for help-gnu-emacs@gnu.org; Tue, 07 Oct 2008 15:57:12 -0400 Original-Received: from [199.232.76.173] (port=34701 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KnIgA-0006Lv-Jf for help-gnu-emacs@gnu.org; Tue, 07 Oct 2008 15:57:10 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]:52887) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KnIgA-0006mD-A2 for help-gnu-emacs@gnu.org; Tue, 07 Oct 2008 15:57:10 -0400 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m97Jv6iV027616; Tue, 7 Oct 2008 14:57:06 -0500 Original-Received: from acsmt703.oracle.com (acsmt703.oracle.com [141.146.40.81]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m97Jv4Ms029529; Tue, 7 Oct 2008 13:57:05 -0600 Original-Received: from dradamslap1 (/141.144.57.24) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 Oct 2008 19:57:04 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AckotTnC8edj5xgiQ8qrQ2plSx/FUgAAQywQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:58504 Archived-At: > i have a some 20 personal commands that insert some text. However, i > have delete-selection-mode on, meaning that when a region is active, > any typing should delete/override it. > > But when calling my insert text commands it will just insert at the > end of region. Here's a example: > (defun insert-date () "Insert current date." (interactive) > (insert (format-time-string "%Y-%m-%d"))) > > Do i need to modify each commands to check on mark-active and delete- > selection-mode then call delete region first? Or, is there some > variable i can just set? See the Commentary at the beginning of `delsel.el': ;; Commands that delete the selection need a `delete-selection' ;; property on their symbols. Commands that insert text but do not ;; have this property do not delete the selection. The property can ;; be one of these values: ;; 'yank ;; For commands which do a yank; ensures the region about to be ;; deleted isn't yanked. ;; 'supersede ;; Delete the active region and ignore the current command, ;; i.e. the command will just delete the region. ;; 'kill ;; `kill-region' is used on the selection, rather than ;; `delete-region'. (Text selected with the mouse will typically ;; be yankable anyhow.) ;; non-nil ;; The normal case: delete the active region prior to executing ;; the command which will insert replacement text. Example: (put 'insert-date 'delete-selection t)