help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: replacing a function with another one


From: Michael Heerdegen
Subject: Re: replacing a function with another one
Date: Wed, 12 Mar 2014 05:10:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

lee <address@hidden> writes:

> > Of course you can also write
> >
> > (advice-add
> >  'hi-lock-write-interactive-patterns :around
> >  (lambda (f)
> >    (let ((hi-lock-interactive-patterns
> >       (append hi-lock-interactive-patterns
> >               hi-lock-file-patterns))))
> >    (funcall f)))
>
> And if f refers to the original function, why not use a before advice
> instead?  And I thought "let" limits the scope of the variable to what
> is between its brackets.

Good catch!  Yes, sorry, the parens were wrong, I meant this:

(advice-add
 'hi-lock-write-interactive-patterns :around
 (lambda (f)
   (let ((hi-lock-interactive-patterns
          (append hi-lock-interactive-patterns
                  hi-lock-file-patterns)))
     (funcall f))))


Thanks,

Michael.




reply via email to

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