From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: kill-region defadvice Date: Sun, 08 Jun 2008 17:18:56 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1212961279 8268 80.91.229.12 (8 Jun 2008 21:41:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Jun 2008 21:41:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 08 23:42:01 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 1K5SeH-000154-Fq for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jun 2008 23:42:01 +0200 Original-Received: from localhost ([127.0.0.1]:47751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5SdU-0000Qe-CL for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jun 2008 17:41:12 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 08 Jun 2008 16:18:56 -0500 Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody User-Agent: MT-NewsWatcher/3.5.3b2 (Intel Mac OS X) Original-Lines: 29 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 24.34.108.171 Original-X-Trace: sv3-ltkbY2XUqHbMorlrzpSMVTHuIYI0NicLBkDFiNwP+C9DmbOdtDHPiNpcpPn9eUyikORy3+97uJqY8nJ!mPhKde+uRYgnIvmMN/8RCE+bo69aj5aDvnc5wsC7SPXpMQyROZgfVoT2D1hanftYj1PPjqij+ZIT!EPhwlLQ5rSnk5V6QW9LJb6ulubZDWD5fbhxIz3I= Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:159272 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:54631 Archived-At: In article , Joe wrote: > Hey all, > > I liked the tip in Steve Yegge's "Effective Emacs" of rebinding > backward-kill-word to C-w but I still wanted to use C-w for kill- > region. Originally I did this by writing a new function that checked > if the mark was active. However, I think that using defadvice is a > better solution but I got stuck while trying to write it. Others have answered your programming question, but I'd like to comment on your original premise. I assume you only want this special behavior when the command is bound to C-w, because the "w" means "word" to you (was this the kill-word command in some other editor you've used in the past?). But if you use defadvice, your advice will be obeyed even if the command were on some other key. Or if a function used (call-interactively 'kill-region). So I think it would be better to write a new function, and bind C-w to that. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***