Yes, if they're running the same version of Emacs.
The byte compilation format is portable across platforms (it depends neither on the processor architecture nor on the operating system). It's also mostly portable across minor versions of Emacs; see Portability of bytecode between Emacs versions for more details.
If you start mixing Emacs versions, or versions of third-party packages, then you may run into incompatibilities with bytecode not due to the bytecode format, but due to changes in macros. For example, suppose package A defines a macro m
and function f
, and package B uses both m
and f
, and version 1 and version 2 of package A have changed the way m
and f
work; if you compile package B against bytecode from version 1 of package A and then run it with version 2 of package A, then package B will be using m
version 1 and f
version A, which can break things. This is only an issue if you mix different versions of Lisp code (either with Emacs itself or from third-party packages). If you install the same version of Emacs everywhere and copy your whole .emacs.d
including all the third-party packages, you'll be fine on this count.
There is occasionally Lisp code that depends on the system, but this should be determined at runtime. It's technically possible that the installation of a package does something system-dependent, or that a macro is compiled into something that is system-dependent, but for the most part that would be a sign of a badly-written package.
There are a few packages that deliberately analyze your system when you install them, but this is should be rare and should be obvious from the description of the package. For example, AUCTeX can parse locally-installed TeX files to provide package-specific assistance; but given that TeX itself should remain compatible, the files generated on one machine should work anywhere else.
As I don't know anything about Spacemacs, I can't vouch for it.
(setq home-dir (cond ((eq system-type 'cygwin) "/cygdrive/c/Users/John/") ((eq system-type 'gnu/linux) "/home/john/")))