unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* finding emacs version
@ 2007-05-14 16:32 Rustom Mody
  2007-05-14 16:39 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rustom Mody @ 2007-05-14 16:32 UTC (permalink / raw)
  To: help-gnu-emacs


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

How do you find out which emacs version is running in elisp?

I want to do:

if version is emacs-21
    some code
else
    some other code

[-- Attachment #1.2: Type: text/html, Size: 212 bytes --]

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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: finding emacs version
  2007-05-14 16:32 finding emacs version Rustom Mody
@ 2007-05-14 16:39 ` Drew Adams
  2007-05-14 16:41 ` Lennart Borgman (gmail)
  2007-05-22  4:37 ` Xavier Maillard
  2 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2007-05-14 16:39 UTC (permalink / raw)
  To: Rustom Mody, help-gnu-emacs

> How do you find out which emacs version is running in elisp?

See these variables (via C-h v):
emacs-major-version, emacs-minor-version, emacs-version

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: finding emacs version
  2007-05-14 16:32 finding emacs version Rustom Mody
  2007-05-14 16:39 ` Drew Adams
@ 2007-05-14 16:41 ` Lennart Borgman (gmail)
  2007-05-22  4:37 ` Xavier Maillard
  2 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-05-14 16:41 UTC (permalink / raw)
  To: Rustom Mody; +Cc: help-gnu-emacs

Rustom Mody wrote:
> How do you find out which emacs version is running in elisp?
> 
> I want to do:
> 
> if version is emacs-21
>     some code
> else
>     some other code



Something like this perhaps:

(condition-case err
     (progn
       (cond
        ( (equal emacs-version "21.3.1")
	 (setq custom-file "~/.emacs-cust-21.3.el"))
        ( t
	 (setq custom-file "~/.emacs-cust-cvs.el")
          ))
       (when (file-exists-p custom-file)
	(load custom-file)))
   (error
    (lwarn 'my-emacs :error "Error loading custom:\n  %s" 
(error-message-string err))))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: finding emacs version
       [not found] <mailman.654.1179160858.32220.help-gnu-emacs@gnu.org>
@ 2007-05-14 16:55 ` Tassilo Horn
  2007-05-14 17:03 ` Harald Hanche-Olsen
  2007-06-09 22:11 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2007-05-14 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

"Rustom Mody" <rustompmody@gmail.com> writes:

Hi,

> How do you find out which emacs version is running in elisp?

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

HTH,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: finding emacs version
       [not found] <mailman.654.1179160858.32220.help-gnu-emacs@gnu.org>
  2007-05-14 16:55 ` Tassilo Horn
@ 2007-05-14 17:03 ` Harald Hanche-Olsen
  2007-06-09 22:11 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Harald Hanche-Olsen @ 2007-05-14 17:03 UTC (permalink / raw)
  To: help-gnu-emacs

+ "Rustom Mody" <rustompmody@gmail.com>:

| How do you find out which emacs version is running in elisp?I want
| to do:if version is emacs-21 some codeelse some other code

(cond ((string= (substring emacs-version 0 2) "21")
       code for version 21)
      ((string= (substring emacs-version 0 2) "22")
       code for version 22)
      (t code for other versions))

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: finding emacs version
  2007-05-14 16:32 finding emacs version Rustom Mody
  2007-05-14 16:39 ` Drew Adams
  2007-05-14 16:41 ` Lennart Borgman (gmail)
@ 2007-05-22  4:37 ` Xavier Maillard
  2 siblings, 0 replies; 7+ messages in thread
From: Xavier Maillard @ 2007-05-22  4:37 UTC (permalink / raw)
  To: Rustom Mody; +Cc: help-gnu-emacs

Hi,

This is what I am currently using to load a custom file according
to my `xm-emacs-name' variable which is set to emacs-23 for this
session.

(when (featurep 'custom)
  (setq custom-file
	(concat
	 (or (getenv "XDG_CONFIG_HOME") "~") "/emacs/conf/"
	 xm-emacs-name
	 "-custom.el")
	)

  ;; load it, if it's there.
  (load custom-file t))

Hope that'll help.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: finding emacs version
       [not found] <mailman.654.1179160858.32220.help-gnu-emacs@gnu.org>
  2007-05-14 16:55 ` Tassilo Horn
  2007-05-14 17:03 ` Harald Hanche-Olsen
@ 2007-06-09 22:11 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2007-06-09 22:11 UTC (permalink / raw)
  To: help-gnu-emacs

> How do you find out which emacs version is running in elisp?
> I want to do:

> if version is emacs-21
>    some code
> else
>    some other code

Please check the archive for this mailing list.  It's been asked many times
in the past.  And part of the answer is that you probably want to check
something more specific than the version number.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-06-09 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-14 16:32 finding emacs version Rustom Mody
2007-05-14 16:39 ` Drew Adams
2007-05-14 16:41 ` Lennart Borgman (gmail)
2007-05-22  4:37 ` Xavier Maillard
     [not found] <mailman.654.1179160858.32220.help-gnu-emacs@gnu.org>
2007-05-14 16:55 ` Tassilo Horn
2007-05-14 17:03 ` Harald Hanche-Olsen
2007-06-09 22:11 ` Stefan Monnier

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