From: Doug Lewan <dougl@shubertticketing.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Clear trailing whitespace on save, but not at the cursor
Date: Thu, 22 Mar 2012 21:08:08 +0000 [thread overview]
Message-ID: <495248DFDEA08C469BBDED2D4AA6C614409AB6@DAKIYA1.pegasus.local> (raw)
Aaron Meurer writes:
> But it seems to me that the whole emacs lisp system is designed
> from the ground up to do hooking (by the way, where I come from, "hooking"
> is given the much auspicious name "monkey patching").
First:
Today I learned "monkey patching" (and, by going to Wikipedia, it's synonym "duck punching"). Thanks for giving me a techno-chuckle.
Second:
(Assuming I understand the meaning of monkey patching) Hooks are /not/ the same thing. Hooks are favors you ask for when something happens. Hooks are easily removed. Often they are if they are badly behaved. See the documentation for after-change-functions.
Advice seem like they fit the definition of monkey patching. A piece of advice can be enabled and disabled, but it stays once it has been (defadvice)d.
The emacs lisp manual has lots of warnings about advice. It has legitimate uses, but they are rare -- typically there's-no-other-darn-way-to-do-this kind of things. It's usually worthwhile spending time to find another way because it's hard to write interesting advice that doesn't have unexpected consequences.
The emacs lisp manual has no general warnings about hooks.
There's probably something to that.
,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224
next reply other threads:[~2012-03-22 21:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 21:08 Doug Lewan [this message]
2012-03-23 19:57 ` Clear trailing whitespace on save, but not at the cursor Aaron Meurer
2012-03-25 14:12 ` Le Wang
-- strict thread matches above, loose matches on Subject: below --
2012-03-05 0:48 Aaron Meurer
2012-03-05 11:02 ` Thien-Thi Nguyen
2012-03-05 15:07 ` Juanma Barranquero
2012-03-06 8:23 ` Thien-Thi Nguyen
2012-03-22 0:13 ` Aaron Meurer
2012-03-22 15:45 ` Le Wang
2012-03-22 16:56 ` Aaron Meurer
2012-03-05 16:04 ` Deniz Dogan
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=495248DFDEA08C469BBDED2D4AA6C614409AB6@DAKIYA1.pegasus.local \
--to=dougl@shubertticketing.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.
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).