[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kill-region defadvice

From: Kevin Rodgers
Subject: Re: kill-region defadvice
Date: Sun, 08 Jun 2008 14:51:02 -0600
User-agent: Thunderbird (Macintosh/20080421)

Nikolaj Schumacher wrote:
Kevin Rodgers <address@hidden> wrote:

Nikolaj Schumacher wrote:
Joe <address@hidden> 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)
     (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.

(if (and (or (interactive-p) executing-kbd-macro)

Kevin Rodgers
Denver, Colorado, USA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]