What should I add in my init file so that whenever I set up a new machine with Emacs, the required packages install by itself?
-
I was setting up my in my new machine I got this error "File error: Cannot open load file, auto-complete". Now I guess this error is because I don't have auto-complete package installed in my new machine. (package-initialize) ;; Ask "y" or "n" instead of "yes" or "no". (fset 'yes-or-no-p 'y-or-n-p) ;; Highlight corresponding parentheses when cursor is on one (show-paren-mode t) ;; Highlight tabulations (setq-default highlight-tabs t) ;; Show trailing white spaces (setq-default show-trailing-whitespace t) ;; Remove useless whitespace before saving a file (add-hook 'before-save-hook 'whitespace-cleanup) (add-hook 'before-save-hook (lambda() (delete-trailing-whitespace))) ;; Remove all backup files (setq make-backup-files nil) (setq backup-inhibited t) (setq auto-save-default nil) ;; Save backup files in a dedicated directory (setq backup-directory-alist '(("." . "~/.emacs_saves"))) ;; Add package sources (setq package-archives '(("gnu" . "GNU ELPA Packages") ("marmalade" . "for all your EmacsLisp needs") ("melpa" . "Page on milkbox.net"))) ;; auto complete (add-to-list 'load-path "~/.emacs.d") (require 'auto-complete) (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict") (ac-config-default) ;; smex (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "M-X") 'smex-major-mode-commands) ;; This is old M-x. (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) ;; switch window (global-set-key (kbd "C-x o") 'switch-window) ;; yasnippet mode (require 'yasnippet) (yas-global-mode 1) This is my init file contents.
-
Answer:
1 2 3 4 5 6 7 8 910111213141516171819; list the packages you want (setq package-list '(package1 package2)) ; list the repositories containing them (setq package-archives '(("elpa" . "Welcome to ELPA") ("gnu" . "GNU ELPA Packages") ("marmalade" . "for all your EmacsLisp needs"))) ; activate all the packages (in particular autoloads) (package-initialize) ; fetch the list of packages available (unless package-archive-contents (package-refresh-contents)) ; install the missing packages (dolist (package package-list) (unless (package-installed-p package) (package-install package))) Taken from http://stackoverflow.com/questions/10092322/how-to-automatically-install-emacs-packages-by-specifying-a-list-of-package-name.
Sumit Sahrawat at Quora Visit the source
Related Q & A:
- How do I set up a new second yahoo account for my son?Best solution by Yahoo! Answers
- How do I set up a new email account?Best solution by Yahoo! Answers
- How do I set up a new email address with BT?Best solution by Yahoo! Answers
- How do I set up a new password on my Linksys wireless router?Best solution by eHow old
- I need to set up a new email address.Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.