[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proper use of add-function
From: |
Noam Postavsky |
Subject: |
Re: proper use of add-function |
Date: |
Tue, 22 May 2018 19:18:09 -0400 |
On 22 May 2018 at 18:58, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
> (add-function
> :filter-args
> (local 'canonically-space-region)
> #'my-canonical-space-region)
You're adding to the function value in the (non-existent) buffer-local
variable `canonically-space-region'
canonically-space-region’s value is
#f(advice-wrapper :filter-args #f(compiled-function
(&rest args)
#<bytecode 0x15054ad>)
my-canonical-space-region)
Local in buffer *scratch*; globally void
You probably want advice-add instead:
(advice-add 'canonically-space-region
:filter-args
#'my-canonical-space-region)
Note: this affects canonically-space-region globally, so you have to
change the implementation of my-canonical-space-region so that it's a
nop except when operating in the relevant buffers.