unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Olson <mwolson@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: package.el: bytecode portability across emacs versions
Date: Fri, 25 May 2007 21:32:14 -0400	[thread overview]
Message-ID: <87lkfc74kh.fsf@hariken.mwolson.org> (raw)
In-Reply-To: m3zm3s28qt.fsf@fleche.redhat.com


[-- Attachment #1.1: Type: text/plain, Size: 3066 bytes --]

Tom Tromey <elpa@tromey.com> writes:

> I know that sharing bytecode is bad.  I just didn't know what to do
> about it.
>
> It would be pretty easy to have separate package universes depending
> on what Emacs you are running.  But that doesn't seem very
> user-friendly.  Putting the bytecode elsewhere could be done but I
> gather that this doesn't work too well in some situations.  package.el
> could re-byte-compile everything when it detects that you switched
> Emacs -- this would be fine for cases like "I upgraded my system and
> got a new Emacs", but it would be very unfriendly for other cases.
> And of course there's always "don't byte compile at all", but that
> would probably rule out installing some of the larger and more
> performance-sensitive packages.
>
> Anyway, I'm open to implementing whatever the Emacs experts agree is
> the best solution.

I would recommend doing things in the following way.

Store the byte code in subdirectories like
~/.emacs.d/elpa/emacs-22.0.98.1/.  Ensure that symlinks in that
directory exist that point to the source files in ~/.emacs/elpa/.  When
elpa is started, it should only add the proper version-specific
subdirectory to the load-path.  If under Windows, package.el would
simply copy every source file to the subdirectory rather than use a
symlink.

If package.el is run from a "new" version of Emacs/XEmacs/SXEmacs during
startup, it will display a message like "Byte-compiling ELPA packages
for <Emacs variant and version>", create the directory, copy or symlink
source files to it (also create subdirectories of symlinks/copies for
larger projects that have their own elpa subdirectory), byte compile
that directory, and add it to load-path.

Here's some code that could be used to detect the current Emacs variant
and version.  I'm just guessing about the (featurep 'sxemacs) part
because I have yet to use SXEmacs.

(defun package-get-emacs-version (&optional display-friendly)
  "Return a string that describes the current variant and version of Emacs.
If DISPLAY-FRIENDLY is non-nil, return a string that would be
useful as part of a displayed message.
Otherwise, return a string of the form \"<variant>-<version>.\""
  (let ((variant (cond ((featurep 'sxemacs) "SXEmacs")
                       ((featurep 'xemacs) "XEmacs")
                       (t "Emacs")))
        (version (cond ((featurep 'xemacs)
                        (concat (number-to-string emacs-major-version)
                                "." (number-to-string emacs-minor-version)
                                "." (number-to-string emacs-patch-level)))
                       (t emacs-version))))
    (if display-friendly
        (concat variant " " version)
      (concat (downcase variant) "-" version))))

-- 
       Michael Olson -- FSF Associate Member #652     |
 http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\ | | |
            Sysadmin -- Hobbies: Lisp, GP2X, HCoop    | |_] | \| |_|
Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-05-26  1:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 13:47 package.el: bytecode portability across emacs versions Trent Buck
2007-05-21 18:10 ` David Kastrup
2007-05-21 23:01   ` Kevin Ryde
2007-05-22  0:11   ` Trent Buck
2007-05-25 16:00     ` Tom Tromey
2007-05-26  1:32       ` Michael Olson [this message]
2007-05-26  6:34         ` David Kastrup
2007-05-26 10:34           ` Eli Zaretskii
2007-05-26 10:40             ` David Kastrup
2007-05-26  5:33       ` Trent Buck
2007-05-26  6:02         ` Eli Zaretskii
2007-05-27  1:00       ` Richard Stallman
2007-05-27  3:54         ` Trent Buck
2007-05-27  5:41         ` David Kastrup
2007-05-27 23:21           ` Richard Stallman
2007-05-28  6:33             ` David Kastrup
2007-05-29  0:02               ` Richard Stallman
2007-05-30  0:44           ` Michael Olson
2007-05-30 15:44             ` Richard Stallman
2007-05-28 21:35       ` Stefan Monnier

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=87lkfc74kh.fsf@hariken.mwolson.org \
    --to=mwolson@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).