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...

halloleo
  • 1,215
  • 9
  • 23

1 Answers1

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.

phils
  • 48,657
  • 3
  • 76
  • 115