From: Robert Saye
Subject: Emacs versions
Date: 
Message-ID: <1127768960.436606.202290@g43g2000cwa.googlegroups.com>
Hi all,

   I just reimaged my debian box here at work, and it upgraded my GNU
emacs from 20.7.2 to 21.3.1. This broke my .emacs file when I call
(require 'tcl-mode). I see where I need to call (require 'tcl) for
major version 21+. Could someone post a simple version test since 90%
of my other linux boxes have 20.7.2. Something like:

psudeo code:

   if { emacs-version > 21 } {
      (require 'tcl)
   } else {
      (require 'tcl-mode)
   }

I realize this is simple, but I have zero experience in LISP and have
just hacked together my .emacs file from on the web.


Thank You

From: Robert Saye
Subject: Re: Emacs versions
Date: 
Message-ID: <1127771590.655328.38530@g49g2000cwa.googlegroups.com>
This works...

;; Specific Version 21+ code here
(cond ((>= emacs-major-version 21)
       (require 'tcl)
       (tool-bar-mode 0)
       ))
;; Specific less than Version 21 code here
(cond ((< emacs-major-version 21)
       (require 'tcl-mode)
       ))


Thank you anyway.
From: Tim X
Subject: Re: Emacs versions
Date: 
Message-ID: <87psqvgnyt.fsf@tiger.rapttech.com.au>
"Robert Saye" <·······@gmail.com> writes:

> Hi all,
> 
>    I just reimaged my debian box here at work, and it upgraded my GNU
> emacs from 20.7.2 to 21.3.1. This broke my .emacs file when I call
> (require 'tcl-mode). I see where I need to call (require 'tcl) for
> major version 21+. Could someone post a simple version test since 90%
> of my other linux boxes have 20.7.2. Something like:
> 
> psudeo code:
> 
>    if { emacs-version > 21 } {
>       (require 'tcl)
>    } else {
>       (require 'tcl-mode)
>    }
> 
> I realize this is simple, but I have zero experience in LISP and have
> just hacked together my .emacs file from on the web.
> 

Are you sure yo even need that line? I'm running emacs 21 under Debian
and the only tcl related command in my .emacs is one used to set the
prefered interpreter - there is no need to do a require. Although its
been some time since I've had to hack any Tcl, I've not required the
required line for quite some versions (emacs 19 I think). 

Its likely that if you created your .emacs from examples on the web it
contains a lot of stuff you don't really need, plus a lot of stuff you
see around is no longer necessary as such customizations are now
handled by emacs customize mode. 

I'd highly recommend commenting out much of what you have and see what
functionality is lost/broken and only add back what is necessary. 

For your original question regarding versions -

,----[ C-h v emacs-major-version RET ]
| emacs-major-version's value is 21
| 
| Documentation:
| Major version number of this version of Emacs.
| This variable first existed in version 19.23.
| 
| Defined in `version.el'.
`----

(if (< emacs-major-version 21)
    (require 'tcl-mode)
  (require 'tcl))

HTH

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
From: Ivan Boldyrev
Subject: Re: Emacs versions
Date: 
Message-ID: <nrnp03-b2b.ln1@ibhome.cgitftp.uiggm.nsc.ru>
On 9245 day of my life Tim X. wrote:
> (if (< emacs-major-version 21)
>     (require 'tcl-mode)
>   (require 'tcl))

Hey, that's lisp!  Write in this way:

(require (if (< emacs-major-version 21)
             'tcl-mode
           'tcl))

-- 
Ivan Boldyrev

              "Assembly of Japanese bicycle require great peace of mind."
From: Anselm Helbig
Subject: Re: Emacs versions
Date: 
Message-ID: <87achvmzdy.wl@nospam.anselm.chemie.fu-berlin.de>
At 26 Sep 2005 14:09:20 -0700,
"Robert Saye" <·······@gmail.com> wrote:
> 
> Hi all,
> 
>    I just reimaged my debian box here at work, and it upgraded my GNU
> emacs from 20.7.2 to 21.3.1. This broke my .emacs file when I call
> (require 'tcl-mode). I see where I need to call (require 'tcl) for
> major version 21+. Could someone post a simple version test since 90%
> of my other linux boxes have 20.7.2. Something like:
> 
> psudeo code:
> 
>    if { emacs-version > 21 } {
>       (require 'tcl)
>    } else {
>       (require 'tcl-mode)
>    }

you should not test for the version of emacs, test for features. you
just want to know if the library tcl-mode is available. this should
work:

(or (require 'tcl-mode nil t) 
    (require 'tcl))

this paraphrases to: try to require `tcl-mode'. if that fails, don't
throw an error but try `tcl' instead. 

regards, 

anselm