Gnus development mailing list
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: ding@gnus.org
Subject: Re: How to change definition of gnus-summary-exit?
Date: Thu, 15 Oct 2015 22:17:12 +0200	[thread overview]
Message-ID: <871tcvrinr.fsf@debian.uxu> (raw)
In-Reply-To: <87eggwvxat.fsf@thinkpad.rath.org>

Nikolaus Rath <Nikolaus@rath.org> writes:

> What's an advice (in this context)?

An advice can be a lot of things, in the Emacs
context, but in the context of your issue, I suspect
the person who gave the piece of advice to use an
advice, he suspected that you want something to always
happen say, before or after the invocation of the
regular function.

This can be done with advices. Here is an example that
I use, which isn't complicated to figure out what
it does:

    (advice-add 'gnus-summary-insert-old-articles :after
                (lambda (dummy) (gnus-apply-kill-file)))

Typically, advices are used when you don't want any
major and complicated changes to a function. (But
there are many thing that can be done with them.)

However, just because they can be done doesn't mean
that is the best way, and always so. Indeed, sometimes
it is better to redefine the function as you did.

However, in my experience the *best* way to do it is
to write a brand new function - use the existing code
if need be, but do everything new - that way, no
collisions, the help is intact, etc. But the best
advantage to this method is security. Because say you
invoke function F at situation S. It doesn't do
exactly what you want. So you change F and all is well
- *at S*! But often F is used in other situations, and
even by other software which you are unaware of.
So instead, copy and edit F into F', and at S, change
the keybinding that previously invoked F, so that it
now invokes F'!

-- 
underground experts united
http://user.it.uu.se/~embe8573




      parent reply	other threads:[~2015-10-15 20:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 17:28 Nikolaus Rath
2015-10-14 18:08 ` Adam Sjøgren
2015-10-15  6:34   ` Tassilo Horn
2015-10-15 17:47     ` Nikolaus Rath
2015-10-15 19:16       ` Tassilo Horn
2015-10-15 23:27         ` Nikolaus Rath
2015-10-16  7:19           ` Tassilo Horn
2015-10-15 20:17       ` Emanuel Berg [this message]

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=871tcvrinr.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=ding@gnus.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 NNTP newsgroup(s).