Skip to main content
Cleaned up the question a bit, so we can direct duplicates here.
Source Link
Malabarba
  • 23.3k
  • 6
  • 81
  • 166

Why do I have to add each package to load-path and require each package? (or Problem with require 'package in my init file)

Each time I install a package from the Package Menu, if I havetry to require it in my init file I get an error unless I manually add it to the load-path and explicitly require the functions:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automatic these steps?

Update

I use ~/.emacs.d/init.el as the configuration file and there's no ~/.emacs. I guess this might be the problem so I added (load "~/.emacs.d/init.el") to ~/.emacs, andautomate this time, I don't need to add those load-path.

According to the Emacs documentation:

49.4 The Emacs Initialization File

When Emacs is started, it normally tries to load a Lisp program from an "initialization file", or "init file" for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el; you can choose to use any one of these three names (*note Find Init::). Here, ~/ stands for your home directory.

I don't see any difference between .emacs and init.el. Can anyone explain?

Why I have to add load-path and require each package?

Each time I install a package, I have to manually add load-path and explicitly require the functions:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automatic these steps?

Update

I use ~/.emacs.d/init.el as the configuration file and there's no ~/.emacs. I guess this might be the problem so I added (load "~/.emacs.d/init.el") to ~/.emacs, and this time, I don't need to add those load-path.

According to the Emacs documentation:

49.4 The Emacs Initialization File

When Emacs is started, it normally tries to load a Lisp program from an "initialization file", or "init file" for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el; you can choose to use any one of these three names (*note Find Init::). Here, ~/ stands for your home directory.

I don't see any difference between .emacs and init.el. Can anyone explain?

Why do I have to add each package to load-path? (or Problem with require 'package in my init file)

Each time I install a package from the Package Menu, if I try to require it in my init file I get an error unless I manually add it to the load-path:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automate this?

edited tags
Link

Each time I install a package, I have to manually add load-path and explicitly require the functions:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automatic these steps?

Update

I use ~/.emacs.d/init.el as the configuration file and there's no ~/.emacs. I guess this might be the problem so I added (load "~/.emacs.d/init.elel") to ~/.emacs, and this time, I don't need to add those load-path.

According to the Emacs documentation:

49.4 The Emacs Initialization File

When Emacs is started, it normally tries to load a Lisp program from an "initialization file", or "init file" for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs', emacs~/.emacs.el', ~/.emacs.el, or ~/.emacs.d/init.el'; you can choose to use any one of these three names (el; you can choose to use any one of these three names (*note Find Init::). Here, ~/'). Here, ~/ stands for your home directory.

I didn'tdon't see any difference between .emacs and init.el. Can anybodyanyone explain?

Each time I install a package, I have to manually add load-path and explicitly require the functions:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automatic these steps?

Update

I use ~/.emacs.d/init.el as the configuration file and there's no ~/.emacs. I guess this might be the problem so I added (load "~/.emacs.d/init.el) to ~/.emacs, and this time, I don't need to add those load-path.

According to the Emacs documentation:

49.4 The Emacs Initialization File

When Emacs is started, it normally tries to load a Lisp program from an "initialization file", or "init file" for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs', ~/.emacs.el', or ~/.emacs.d/init.el'; you can choose to use any one of these three names (*note Find Init::). Here, ~/' stands for your home directory.

I didn't see any difference between .emacs and init.el. Can anybody explain?

Each time I install a package, I have to manually add load-path and explicitly require the functions:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automatic these steps?

Update

I use ~/.emacs.d/init.el as the configuration file and there's no ~/.emacs. I guess this might be the problem so I added (load "~/.emacs.d/init.el") to ~/.emacs, and this time, I don't need to add those load-path.

According to the Emacs documentation:

49.4 The Emacs Initialization File

When Emacs is started, it normally tries to load a Lisp program from an "initialization file", or "init file" for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el; you can choose to use any one of these three names (*note Find Init::). Here, ~/ stands for your home directory.

I don't see any difference between .emacs and init.el. Can anyone explain?

added 871 characters in body
Source Link
Nick
  • 4.6k
  • 4
  • 27
  • 46
Loading
Source Link
Nick
  • 4.6k
  • 4
  • 27
  • 46
Loading