8

For what I do I tend to define a lot of functions that I use temporarily. Life span is usually about 1-2 weeks - and then I define a new set of functions.

I was not able to find where these definitions actually are, nor how to delete them just by supplying a function name (which would be useful).

Drew
  • 77,472
  • 10
  • 114
  • 243
A_P
  • 672
  • 4
  • 21
  • 3
    Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs). – Barmar Dec 27 '18 at 22:57
  • 1
    @Barmar. See, I didn't know that. My question got edited multiple times. What I do is to define a keyboard macro, save it as a functions, and bind it to a shortcut. Once I am done with what I do, usually define so more and rebind. But the function is still there if I press M-x. Hence the question. PS. I don't know a lot of Emacs internals so it might seem like an obvious question for some. – A_P Dec 28 '18 at 13:01

2 Answers2

13

Functions are unbound with:

(fmakunbound 'NAME)

(The equivalent for variables is makunbound.)

phils
  • 50,977
  • 3
  • 79
  • 122
7

In addition to removing the function definition with fmakunbound and variable binding with makunbound, you can also remove the name itself with unintern.

Note also that, unless you save your definitions in a file (e.g., init file) and load it, your functions and variables will be gone when you restart Emacs.

sds
  • 6,104
  • 22
  • 39