unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Rainer M Krug <Rainer@krugs.de>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Can I share ~/.emacs.d/elpa with two machines?
Date: Mon, 5 Oct 2015 08:46:33 -0400	[thread overview]
Message-ID: <CAFyQvY3+ySsaHvhic12b=wpq6sD6_3Dm0Wh0hBt-gQKzekeffw@mail.gmail.com> (raw)
In-Reply-To: <m2twq5eonj.fsf@krugs.de>

> My only question is the contrib directory. I assume I simply also have to
copy the files in the same version specific lisp dir?

For contrib packages (well, only one package that I use from there), I use
the org-plus-contrib package from the Org Elpa

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)

I have version-specific package-user-dir, so I have org-plus-contrib
installed and compiled for all emacs versions in their own elpa_<version>
directories.

;; Create the package install directory if it doesn't exist
(setq package-user-dir (concat user-emacs-directory "elpa_"
                               emacs-version-short "/")) ; default =
~/.emacs.d/elpa/

I prefer to have both the dev version and stable version of org installed.
So that if needed, I can switch between the two by toggling a variable and
restarting emacs. As the package that I use from contrib does not need to
be cutting-edge, I just use it from the already installed stable
org-plus-contrib :)

I use something like this for org version switching (if you are interested):

(when (bound-and-true-p org-load-version-dev)
    ;; if `org-load-version-dev' is non-nil
    (add-to-list 'load-path (concat user-emacs-directory
                                    "elisp/org-mode/lisp_"
                                    emacs-version-short "/")))

If I don't have the org-load-version-dev set to any value or if I have set
it to nil in my emacs config, the org-plus-contrib (stable version)
installed by the package manager will be used by default.



--
Kaushal Modi

On Mon, Oct 5, 2015 at 3:54 AM, Rainer M Krug <Rainer@krugs.de> wrote:

> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
> > I also update org via git and faced the compiled code incompatibility
> > issue. I resolved it the same way .. using version specific compiled org
> > dirs.
> >
> > Here's the full code gathered from various places in my config:
> >
> > Part 1:
> >
> https://github.com/kaushalmodi/.emacs.d/blob/56b84df6ff399ab65c040d4d872dc65fb45515e6/init.el#L9-L13
> > (setq user-home-directory     (concat (getenv "HOME") "/")) ; must end
> with
> > /
> > (setq user-emacs-directory    (concat user-home-directory ".emacs.d/")) ;
> > must end with /
> > (setq emacs-version-short     (replace-regexp-in-string
> >                                "\\([0-9]+\\)\\.\\([0-9]+\\).*"
> >                                "\\1_\\2" emacs-version)) ; 25.0.50.1 ->
> 25_0
> >
> > Part 2:
> >
> https://github.com/kaushalmodi/.emacs.d/blob/56b84df6ff399ab65c040d4d872dc65fb45515e6/setup-files/setup-org.el#L32-L34
> >     (add-to-list 'load-path (concat user-emacs-directory
> >                                     "elisp/org-mode/lisp_"
> >                                     emacs-version-short "/"))
> >
> > Part 3: The nasty part.
> > Use a shell script or script of your preferred flavor to build org-mode
> for
> > each of the emacs versions you are using and copy the built lisp/ dir to
> > the version specific lisp dir.
> >
> > #!/bin/tcsh -f
> > # Build script to compile org mode lisp for different emacs versions
> >
> >
> > #
> > # Back up your $PATH
> > #
> >
> > alias get_org_mode_lisp_dir_suffix '\emacs --version | \grep -oE
> '"'"'Emacs
> > [0-9]+\.[0-9]+'"'"' | \awk '"'"'{print $2}'"'"' | \tr "." "_"'
> >
> > #** Build for emacs master
> >
> > #
> > # Set the $PATH *here* to use the emacs master (built from latest in git)
> > # I use something work proprietary like GNU Modules to do this
> > #
> >
> > echo "\nBuilding for emacs version: "`\emacs --version | \grep -E 'Emacs
> > [0-9]+\.[0-9]+'`"\n"
> > make clean
> > make
> > set org_mode_lisp_dir = "lisp_"`get_org_mode_lisp_dir_suffix`
> > if ( -d "${org_mode_lisp_dir}" ) then
> >     \rm -rf ${org_mode_lisp_dir}
> > endif
> > \cp -rf lisp ${org_mode_lisp_dir}
> >
> > #** Build for emacs 24.5
> >
> > #
> > # Set the $PATH *here* to use emacs 24.5
> > # I use something work proprietary like GNU Modules to do this
> > #
> >
> > echo "\nBuilding for emacs version: "`\emacs --version | \grep -E 'Emacs
> > [0-9]+\.[0-9]+'`"\n"
> > make clean
> > make
> > set org_mode_lisp_dir = "lisp_"`get_org_mode_lisp_dir_suffix`
> > if ( -d "${org_mode_lisp_dir}" ) then
> >     \rm -rf ${org_mode_lisp_dir}
> > endif
> > \cp -rf lisp ${org_mode_lisp_dir}
> >
> > unalias get_org_mode_lisp_dir_suffix
> > unset {org_mode_lisp_dir}
> >
> > #
> > # Restore your $PATH to point to your default emacs version
> > #
> >
> > Part 4: Restart any one of the versions of emacs for which you compiled
> the
> > org files in Part 3. The org stuff will work just fine as it would pick
> out
> > the org files from the correct lisp_<<emacs-version-short>>/ directory.
> >
> > I hope all of this makes sense.
>
> Thanks - makes perfect sense. My only question is the contrib
> directory. I assume I simply also have to copy the files in the same
> version specific lisp dir?
>
> Rainer
>
>
> >
> >
> >
> > --
> > Kaushal Modi
> >
> > On Fri, Oct 2, 2015 at 3:05 PM, Rainer M Krug <Rainer@krugs.de> wrote:
> >
> >> Kaushal Modi <kaushal.modi@gmail.com> writes:
> >>
> >> > @Stefan, sharing elpa/ between at least emacs 24.5 and emacs 25.x (git
> >> > master) does not work as the complied .elc files are not compatible
> >> between
> >> > the two versions.
> >>
> >> Just jumping in as I have the two version problem.
> >>
> >> I am fine with most of my stuff managed by cask, therefore aware of
> >> versions. But how can I manage org, which is via git? Any smart
> >> suggestion how I can use this between two versions on one machine?
> >>
> >> Rainer
> >>
> >>
> >> >
> >> >
> >> > --
> >> > Kaushal Modi
> >> >
> >> > On Fri, Oct 2, 2015 at 11:54 AM, Stefan Monnier <
> >> monnier@iro.umontreal.ca>
> >> > wrote:
> >> >
> >> >> Yes, of course.
> >> >>
> >> >> Just like you can share it over NFS or any other file system.
> >> >> You can share them even between different systems using different
> >> >> Emacs versions, different processor architectures, and/or different
> >> OSes.
> >> >>
> >> >> At least, if that leads to problems, then I'd recommend you file them
> >> >> as bugs.
> >> >>
> >> >>
> >> >>         Stefan
> >> >>
> >> >>
> >> >>
> >> >
> >>
> >> --
> >> Rainer M. Krug
> >> email: Rainer<at>krugs<dot>de
> >> PGP: 0x0F52F982
> >>
> >
>
> --
> Rainer M. Krug
> email: Rainer<at>krugs<dot>de
> PGP: 0x0F52F982
>


  parent reply	other threads:[~2015-10-05 12:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 14:03 Can I share ~/.emacs.d/elpa with two machines? Jorge
2015-10-02 15:54 ` Stefan Monnier
2015-10-02 17:05   ` Kaushal Modi
2015-10-02 19:05     ` Rainer M Krug
2015-10-02 19:23       ` Kaushal Modi
2015-10-05  7:54         ` Rainer M Krug
2015-10-05 10:19           ` Suvayu Ali
2015-10-05 11:34             ` Rainer M Krug
2015-10-05 13:13               ` Suvayu Ali
2015-10-05 13:45                 ` Rainer M Krug
2015-10-05 12:55             ` Kaushal Modi
2015-10-05 12:46           ` Kaushal Modi [this message]
2015-10-05 13:16             ` Suvayu Ali
2015-10-05 13:56               ` Kaushal Modi
2015-10-05 15:21             ` Solved: " Rainer M Krug
2015-10-03 20:04       ` Phillip Lord
2015-10-02 19:35     ` Stefan Monnier
2015-10-02 15:59 ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3+ySsaHvhic12b=wpq6sD6_3Dm0Wh0hBt-gQKzekeffw@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=Rainer@krugs.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).