unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: About advices.
Date: Wed, 27 Nov 2013 15:52:26 -0500	[thread overview]
Message-ID: <jwvvbzdk1v4.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAFkz2yq5qB9j_R3OMvXnc=HpzQVupbd4GJhezmKVY-vORwSPhg@mail.gmail.com

> What the right way to use advices? (I know that best way it to not use it
> at all.;))

Here's how in Emacs-24.4:

   (defun my-advice (&rest args)
     (message "After s-t-b: %S" args))
   
   (advice-add 'switch-to-buffer :after #'my-advice)

and when you're tired of those messages, you turn them off with

   (advice-remove 'switch-to-buffer #'my-advice)


-- Stefan




  reply	other threads:[~2013-11-27 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27  8:19 About advices Constantin Kulikov
2013-11-27 20:52 ` Stefan Monnier [this message]
2013-11-28 17:23   ` Constantin Kulikov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvvbzdk1v4.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).