all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: kill-region defadvice
Date: Sun, 08 Jun 2008 14:51:02 -0600	[thread overview]
Message-ID: <g2hgnm$upt$1@ger.gmane.org> (raw)
In-Reply-To: <m21w37snti.fsf@nschum.de>

Nikolaj Schumacher wrote:
> Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
> 
>> Nikolaj Schumacher wrote:
>>> Joe <joesmoe10@gmail.com> 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.

(if (and (or (interactive-p) executing-kbd-macro)
	 mark-active)
...

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2008-06-08 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-08  3:47 kill-region defadvice Joe
2008-06-08  9:10 ` Nikolaj Schumacher
2008-06-08 16:45   ` Kevin Rodgers
2008-06-08 19:56     ` Nikolaj Schumacher
2008-06-08 20:51       ` Kevin Rodgers [this message]
2008-06-09  8:25         ` Nikolaj Schumacher
2008-06-08 21:18 ` Barry Margolin
2008-06-09  1:23   ` Joe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='g2hgnm$upt$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.