0

I've spent a long time looking for my .emacs file and have yet to find it even after using the solution here: https://stackoverflow.com/questions/27869909/what-to-do-if-i-cannot-find-my-emacs-init-file

Someone also said if I start up with emacs -Q (without the init file) and it looks different then starting up regularly, I already have a .emacs file. Because of this discrepancy between emacs and emacs -Q, I think I already have .emacs file, but I cannot find it. What would happen if I create a new .emacs file and edit it?

5
  • How about satisfying your curiosity by putting the following inside your .emacs file: (message "Hello @Goldname -- how are you today?") Then, save the file and restart Emacs and go to the *Messages* buffer and see if your new message is there. If it is, then crack open a beer and celebrate because you have just located your .emacs file and verified that it is being read by Emacs. You can only have one of them, not more than one. So, do whatever you want with your one .emacs file. Use it to customize Emacs to your liking, including loading additional files or libraries.
    – lawlist
    Jul 5, 2016 at 5:53
  • I want to add line numbers to all my text files, but I don't know if bad things would happen Jul 5, 2016 at 22:49
  • The first step in using Emacs is to create a .emacs file in the home directory, or an init.el inside the .emacs.d folder in the home directory. Get that squared away before you do anything else. If you want to try out line numbers, just type M-x linum-mode in whatever buffer you want to use.
    – lawlist
    Jul 5, 2016 at 23:11
  • The .emacs file does not come with Emacs? Jul 6, 2016 at 4:06
  • 1
    Emacs only makes the .emacs.d folder inside the home directory, but it does not make the .emacs file in the home directory unless you customize and save a setting. You can customize some setting in the menu-bar like font, and then save the setting for all future sessions, and then Emacs will create the .emacs file with the new setting included inside the file. Otherwise, just create the file manually yourself -- either a .emacs in the home directory, or an init.el inside the .emacs.d folder, whichever you prefer. You can create the file using anything -- e.g., file manager . . .
    – lawlist
    Jul 6, 2016 at 4:55

1 Answer 1

1

Note that emacs -Q will start emacs without any init files. So the difference between emacs and emacs -Q may be due to a system-wide init file. To test for just a personal init file use emacs -q (that's a lower case q rather than an upper case Q).

And one of the answers on that other question tells you about how to locate your init file: type C-h v user-init-file RET and it tells you about the variable that holds that info, including its current value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .