5

I added a custom auto-insert to my init file and reloaded the .emacs file with

M-x load-file
~/.emacs

And then later I revised the auto-insert instruction and reloaded. Now I get strange behaviour because I have evaluated two similar auto-inserts. How can I have only the most recent evaluation of my .emacs init file?

In a bit more detail.

I added

(eval-after-load 'autoinsert
  '(define-auto-insert '("\.c\'" . "C \"script\" hack")
  '( "stuff" \n )))

reloaded .emacs file

(eval-after-load 'autoinsert
  '(define-auto-insert '("\.c\'" . "C \"script\" hack")
  '( "other stuff" \n )))

reloaded .emacs file

then I had problems.

7

In general, you can't. Your init file is unconstrained in its ability to manipulate the Emacs environment, and there is no such thing as un-evaluating the code you've run. You could write new code which specifically reverses the effects of some particular old code, but only on a case-by-case basis. Restarting Emacs is the only general 'reset switch' there is.

In this instance, however, you have only modified a user option, and those do remember their original values. Type the following, and use the "Revert..." button to get rid of your unwanted customizations, and then "Apply" the changes.

M-x customize-option RET auto-insert-alist RET

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.