unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Tim X'" <timx@nospam.dev.null>, <help-gnu-emacs@gnu.org>
Subject: RE: running multiple Emacs versions
Date: Fri, 12 Feb 2010 17:04:27 -0800	[thread overview]
Message-ID: <B68792A2762B4CE2A97B258A04F48AA6@us.oracle.com> (raw)
In-Reply-To: <87sk966mzd.fsf@lion.rapttech.com.au>

> Using one .emacs file is probably not going to be the big issue. Your
> problem is likely to be byte code incompatibility, especially as emacs
> 23 moved to utf-8 encoding, which makes the *.elc files incompatible
> with versions prior to 23. Emacs 23 can read older *.elc files, but it
> does a translation/conversion process 'on the fly' which can
> substantially slow down file loading etc.
> 
> There are ways around all of this, but take a bit of work. As an
> example, you cold look at how Debian/Ubuntu handle running multiple
> emacs versions at the same time. For your init file, look at 
> initz (see emacs wiki). I htink there is some other info on this
> in the wiki as well. 
> 
> For your .emacs, you may be able to just get by using simple 'when'
> blocks for the version specific stuff i.e.
> 
> (when (= emacs-major-version 23)
>   ;; do 23 specific stuff
> )

Everything Tim said is true, I believe.

But as (only) one data point (FWIW), I routinely byte-compile in Emacs 20 (or in
22, if the library isn't designed for 20/21), and then use the *.elc in more
recent versions, including Emacs 23. I haven't particularly noticed any slowdown
(but I don't doubt that there is one, at least theoretically).

However, some Emacs 23-specific features are available only if you byte-compile
the code in Emacs 23. Likewise, some Emacs 22-specific features need to be
compiled using Emacs 22 (or 23). So while byte-compiling using an older release
generally works and I haven't noticed a slowdown, you might lose some features
that are specific to more recent releases. In practice, this is pretty rare,
however (IMO/experience).

Wrt version testing, to protect/expose various code sections (e.g. in your init
file): Yes, `emacs-major-version' is your friend.

But if you know something more specific about the code that is needed from that
release, then it's often better to test for the presence of that specific
object.  Testing the Emacs version is generally a last resort, but sometimes it
is the most appropriate thing to do.

You can test for a given feature (library) using (require... nil t) - or
`featurep' if already loaded. You can test for the presence of a specific
function using `fboundp'. You can test for the presence of a specific variable
using `boundp'.

(What's not so easy to test for is a specific function signature. If a function
has a different number of arguments in different releases, then about the only
way to test which is which is to use `condition-case' and tempt an error.)

HTH.





  reply	other threads:[~2010-02-13  1:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 19:47 running multiple Emacs versions nchubrich
2010-02-12 23:00 ` Peter Dyballa
2010-02-12 23:41 ` Tim X
2010-02-13  1:04   ` Drew Adams [this message]
     [not found]   ` <mailman.1186.1266023178.14305.help-gnu-emacs@gnu.org>
2010-02-13  5:55     ` nchubrich
2010-02-13 16:10       ` Tim X
2010-02-13 16:16       ` Drew Adams
2010-02-13 18:58 ` Pascal J. Bourguignon

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=B68792A2762B4CE2A97B258A04F48AA6@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=timx@nospam.dev.null \
    /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).