简体   繁体   中英

Customize Emacs for Mac OSX app

I am using the Emacs for Mac OSX app, and I need to modify the init.el file, according to the instructions on MELPA . The problem is I can't find any init.el file. Is there one in an obscure location, or is there some other file serving the same purpose? The goal is to make the MELPA packages available for the Emacs 24 package installer.

==== UPDATE ====

To add the MELPA repository, one should add a few lines " before the call to package-initialize in the init.el file", according to the MELPA page. The Emacs for OSX app doesn't seem to have an init.el file, though. Using the command (suggested by @alexander-poslavsky)

C-H (Control-h) v user-init-file RET

I get "~/.emacs", as predicted by @abo-abo. However, that file doesn't exist, so there is no call to package-initialize. Anyway, I created ~/.emacs and added my custom lines to it, as suggested by @abo-abo, and it works. Thanks!

These are currently the only contents of the .emacs file:

(require 'package)
(add-to-list 'package-archives
  '("melpa" . "http://melpa.milkbox.net/packages/") t)

Emacs for OSX uses a 'normal' configuration setup (unlike, for example Aquamacs, or on Windows where the init-file is located somewhere else.

Usually your configuration should be stored in ~/.emacs.d/init.el (see here for a complete explanation .

Your current config-file should be stored in the variable user-init-file:

use Ch (Control-h) v user-init-file RET

This will show whatever Emacs is using (it might be nil, if it is not using anything).

Hope this helps!

Here is how to create "init.el".

Run terminal with + space terminal RET

Then input these command in terminal.

  1. ls -a .emacs
  2. ls -a .emacs.d

If terminal says

.emacs: No such file or directory

and

.emacs.d: No such file or directory

you need to create emacs config file like these command.

  1. mkdir .emacs.d
  2. touch .emacs.d/init.el

Now you got "init.el". Customize it as you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM