How to delete a function?












6














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










share|improve this question




















  • 3




    Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
    – Barmar
    2 days ago






  • 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
    2 days ago
















6














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










share|improve this question




















  • 3




    Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
    – Barmar
    2 days ago






  • 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
    2 days ago














6












6








6


2





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










share|improve this question















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







functions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Drew

46.9k462104




46.9k462104










asked Dec 27 at 14:17









A_P

547




547








  • 3




    Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
    – Barmar
    2 days ago






  • 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
    2 days ago














  • 3




    Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
    – Barmar
    2 days ago






  • 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
    2 days ago








3




3




Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
– Barmar
2 days ago




Why bother? They'll go away if and when you next restart Emacs (unless you're saving them in your .emacs).
– Barmar
2 days ago




1




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
2 days ago




@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
2 days ago










2 Answers
2






active

oldest

votes


















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.






share|improve this answer































    10














    Functions are unbound with:



    (fmakunbound 'NAME)


    (The equivalent for variables is makunbound.)






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "583"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46786%2fhow-to-delete-a-function%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      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.






      share|improve this answer




























        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.






        share|improve this answer


























          7












          7








          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.






          share|improve this answer














          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 11 hours ago

























          answered 2 days ago









          sds

          3,756826




          3,756826























              10














              Functions are unbound with:



              (fmakunbound 'NAME)


              (The equivalent for variables is makunbound.)






              share|improve this answer


























                10














                Functions are unbound with:



                (fmakunbound 'NAME)


                (The equivalent for variables is makunbound.)






                share|improve this answer
























                  10












                  10








                  10






                  Functions are unbound with:



                  (fmakunbound 'NAME)


                  (The equivalent for variables is makunbound.)






                  share|improve this answer












                  Functions are unbound with:



                  (fmakunbound 'NAME)


                  (The equivalent for variables is makunbound.)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 days ago









                  phils

                  25.9k23566




                  25.9k23566






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Emacs Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46786%2fhow-to-delete-a-function%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                      Alcedinidae

                      RAC Tourist Trophy