0

I want to extend a standard Emacs function (package--save-selected-packages), but to cover my tracks I want to save the old defintion under a new name and then redintion teh standard function.

I tried fset but that creates rather something like an alias from a new name to the old name, but it does not save the old definition...

1

You can use symbol-function to obtain the current function slot value for a given symbol, which is typically what you'd be after here.

You can store that value anywhere you want, and restore it later (perhaps with fset).

I tried fset but that creates rather something like an alias from a new name to the old name, but it does not save the old definition...

If you did something like (fset 'foo 'bar) then you are only storing the name of the function, rather than the function value associated with the name. Function indirection would therefore return whatever the current value associated with that name happens to be.

| improve this answer | |
  • What a great explanation! Exactly what I was looking for. Thanks! – halloleo Oct 23 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.