2

If I would like to keep my emacs settings and packages in another computer or after a format is there a way to avoid having to install all the packages from the beginning?

I don't just mean saving the .emacs as to have the customizations but also the packages that come with it. I was wondering if I copy and save my elpa file and then paste it in a new PC is there going to be any problem?

Do the packages install files also in other folders of a system, so the aforementioned technique may cause problems, or is this a good way to keep your Emacs always with you?

  • .elc files are portable byte code -- you can most definitely copy them from one machine to another, rather than going through the package installation processes. That's not to say it's not possible to get compiled elisp with machine-specific code (e.g. macros are expanded at compile type, and can be written to produce system-specific code at that time), but it's unusual to see that. In most situations, you will be absolutely fine if you simply copy all of the files. – phils Nov 7 '14 at 8:01
  • 5
    possible duplicate of Synchronize packages between different machines – itsjeyd Nov 7 '14 at 8:26
  • 2
    @caisah compiled elc files are version-specific, but not system-specific. You can carry them around as long as you use the same emacs version. – Malabarba Nov 7 '14 at 9:03
  • @Malabarba Sorry, I didn't know that. – caisah Nov 7 '14 at 11:56
  • 3
    In my opinion, this is NOT a duplicate. He's specifically saying he doesn't want reinstall everything. And he's asking where the packages are stored. – Malabarba Nov 7 '14 at 12:53
3

If I would like to keep my emacs settings and packages in another computer or after a format is there a way to avoid having to install all the packages from the beginning?

I don't just mean saving the .emacs as to have the customizations but also the packages that come with it. I was wondering if I copy and save my elpa file and then paste it in a new PC is there going to be any problem?

I posted an answer on Synchronize packages between different machines describing how I manage installation of packages from scratch when I want to install emacs on a new machine.

On the new machine, you simply need to copy your emacs customizations. Make sure that the my-packages list and the setup-packages.el that I explain in detail in my above referenced answer are also copied to the new machine.

Are the packages install files also in other folders of a system so to cause the aforementioned technique problems or is this a good way to keep your Emacs always with you?

Till now I haven't faced a situation like that. You would have to review what packages you have installed and where they save stuff that you would want to port to a new machine. Let me take multiple-cursors package as an example. By default, it creates a file .mc-lists.el in .emacs.d. But that is not a problem as I copy my whole emacs setup folder (.emacs.d) when porting my emacs customization to a new machine.

1

You can copy and paste your entire .emacs.d folder to a new computer and not have any problems as long as you are using the same version of emacs on the new computer. You can also put the entirety of your configuration, including elpa/ in distributed version control and pull it to any new computer.

1

Providing you will be using the same version of Emacs, you can duplicate your .emacs.d with all compiled / packages in-place.

This is also true of keeping your .emacs.d in version control.

Personally I would recommend this method.

There is a current trend of using require-package (in various forms) which will implicitly install a package.

This is useful if you use many versions of Emacs, although a compiled .elc isn't always incompatible across point releases and re-compiling a broken package is relatively trivial.

The drawback of tools like require-package, is when a package (or version) or repository isn't available. This has happened to me often enough to be a problem.

0

This does not respond to the part about updating/installing/loading the same packages etc. But with respect to porting some other aspects of your Emacs setup, you can also try using a saved desktop in the other environment (e.g. on the other machine). Just copy your desktop file(s) to the other environment.

You can have any number of saved Emacs desktops (desktop files). And starting with Emacs 24.4, they can even restore frame and window configurations, buffer associations, etc.

A handy way to switch among desktops is to use desktop bookmarks. For that, you just need library Bookmark+. C-x p K saves the current setup as a desktop bookmark. Just "jump" to the bookmark to restore that particular desktop.

0

check my project elpa-mirror https://github.com/redguardtoo/elpa-mirror

you build a package repository on your memory stick. redirect your .emacs to that local repository. end of story.

copy ~/.emacs.d may not work. because different versions of Emacs will compile the same package into in-compatible *.elc

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.