From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: kill-region defadvice Date: Sun, 08 Jun 2008 21:56:25 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212955018 22281 80.91.229.12 (8 Jun 2008 19:56:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Jun 2008 19:56:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Kevin Rodgers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 08 21:57:40 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 1K5R1D-0004RB-Av for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jun 2008 21:57:35 +0200 Original-Received: from localhost ([127.0.0.1]:43278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5R0Q-0007ug-AH for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jun 2008 15:56:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5R09-0007sS-Bv for help-gnu-emacs@gnu.org; Sun, 08 Jun 2008 15:56:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5R07-0007pE-O6 for help-gnu-emacs@gnu.org; Sun, 08 Jun 2008 15:56:28 -0400 Original-Received: from [199.232.76.173] (port=58413 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5R07-0007p2-HM for help-gnu-emacs@gnu.org; Sun, 08 Jun 2008 15:56:27 -0400 Original-Received: from fmmailgate03.web.de ([217.72.192.234]:34148) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5R07-000468-Ch for help-gnu-emacs@gnu.org; Sun, 08 Jun 2008 15:56:27 -0400 Original-Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id 520F4DF178F3; Sun, 8 Jun 2008 21:56:26 +0200 (CEST) Original-Received: from [77.189.3.97] (helo=thursday-2.local) by smtp06.web.de with asmtp (WEB.DE 4.109 #226) id 1K5R06-00038j-00; Sun, 08 Jun 2008 21:56:26 +0200 In-Reply-To: (Kevin Rodgers's message of "Sun\, 08 Jun 2008 10\:45\:45 -0600") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) X-Sender: n_schumacher@web.de X-Provags-ID: V01U2FsdGVkX19j1W/q1CDgdL62GyWzDvFORMmCvvJ5E//8wNLk Pzm9e5g4Xtrzh4tGLm7B7nkjIbSBHqqtvcNIQBdOtOb1/esb6w 3Comf39GsxCHpWLawJaA== X-detected-kernel: by monty-python.gnu.org: 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:54625 Archived-At: Kevin Rodgers wrote: > Nikolaj Schumacher wrote: >> Joe wrote: >> >>> 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. >> >> No, it's not! By using advice, you modify the kill-region function and >> risk that any command using it will backward-kill-word instead. > > Just write the advice as > > (if (and (interactive-p) mark-active) > ad-do-it > (backward-kill-word 1)) Still not a good idea. `interactive-p' will return nil when used in a keyboard macro. That will most likely cause unintended behavior at some point. regards, Nikolaj Schumacher