all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* checking emacs version
@ 2009-02-24  2:59 Eric
  2009-02-24  4:07 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Eric @ 2009-02-24  2:59 UTC (permalink / raw)
  To: help-gnu-emacs

I'm writing an .emacs file that will need to work under a few
different versions of emacs, and wanted to ask what the most reliable
method of checking the current emacs version. Is a simple string
search in (emacs-version) acceptable, or is there a more robust way of
doing it?

Thanks,
Eric


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

* Re: checking emacs version
  2009-02-24  2:59 checking emacs version Eric
@ 2009-02-24  4:07 ` Eli Zaretskii
       [not found] ` <mailman.1610.1235448457.31690.help-gnu-emacs@gnu.org>
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2009-02-24  4:07 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Eric <girzel@gmail.com>
> Date: Mon, 23 Feb 2009 18:59:43 -0800 (PST)
> 
> I'm writing an .emacs file that will need to work under a few
> different versions of emacs, and wanted to ask what the most reliable
> method of checking the current emacs version. Is a simple string
> search in (emacs-version) acceptable, or is there a more robust way of
> doing it?

You can do as simple as

   (if (>= emacs-major-version 21)
       (do-something))

or more sophisticated

   (if (version<= 23.0.98)
       (do-something-else))

Is that what you are looking for?




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

* Re: checking emacs version
       [not found] ` <mailman.1610.1235448457.31690.help-gnu-emacs@gnu.org>
@ 2009-02-24  4:21   ` Eric
  2009-02-24  4:36     ` Barry Margolin
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Eric @ 2009-02-24  4:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 24, 12:07 pm, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Eric <gir...@gmail.com>
> > Date: Mon, 23 Feb 2009 18:59:43 -0800 (PST)
>
> > I'm writing an .emacs file that will need to work under a few
> > different versions of emacs, and wanted to ask what the most reliable
> > method of checking the current emacs version. Is a simple string
> > search in (emacs-version) acceptable, or is there a more robust way of
> > doing it?
>
> You can do as simple as
>
>    (if (>= emacs-major-version 21)
>        (do-something))
>
> or more sophisticated
>
>    (if (version<= 23.0.98)
>        (do-something-else))
>
> Is that what you are looking for?

No, sorry! I totally failed to say what I was actually doing -- not
checking emacs versions but checking emacs ports: I use Carbon Emacs
on my mac at home, and vanilla emacs on my server, and want to set
some Carbon-specific variables when I'm at home. The string "Carbon"
show up in (emacs-version), that's why I was thinking that might be
how I have to do it.

Thanks,
Eric


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

* Re: checking emacs version
  2009-02-24  4:21   ` Eric
@ 2009-02-24  4:36     ` Barry Margolin
  2009-02-24  5:19       ` Eric
  2009-02-24 14:29     ` Jonathan Groll
       [not found]     ` <mailman.1644.1235485784.31690.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Barry Margolin @ 2009-02-24  4:36 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

In article 
<0cda7201-96b3-4625-a760-f5548658e968@l16g2000yqo.googlegroups.com>,
 Eric <girzel@gmail.com> wrote:

> On Feb 24, 12:07 pm, Eli Zaretskii <e...@gnu.org> wrote:
> > > From: Eric <gir...@gmail.com>
> > > Date: Mon, 23 Feb 2009 18:59:43 -0800 (PST)
> >
> > > I'm writing an .emacs file that will need to work under a few
> > > different versions of emacs, and wanted to ask what the most reliable
> > > method of checking the current emacs version. Is a simple string
> > > search in (emacs-version) acceptable, or is there a more robust way of
> > > doing it?
> >
> > You can do as simple as
> >
> >    (if (>= emacs-major-version 21)
> >        (do-something))
> >
> > or more sophisticated
> >
> >    (if (version<= 23.0.98)
> >        (do-something-else))
> >
> > Is that what you are looking for?
> 
> No, sorry! I totally failed to say what I was actually doing -- not
> checking emacs versions but checking emacs ports: I use Carbon Emacs
> on my mac at home, and vanilla emacs on my server, and want to set
> some Carbon-specific variables when I'm at home. The string "Carbon"
> show up in (emacs-version), that's why I was thinking that might be
> how I have to do it.

Are you sure you need to conditionalize on that, rather than something 
more generic?  E.g.

(if (eq window-system 'mac)
    (do-something))

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


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

* Re: checking emacs version
  2009-02-24  4:36     ` Barry Margolin
@ 2009-02-24  5:19       ` Eric
  0 siblings, 0 replies; 13+ messages in thread
From: Eric @ 2009-02-24  5:19 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 24, 12:36 pm, Barry Margolin <bar...@alum.mit.edu> wrote:
> In article
> <0cda7201-96b3-4625-a760-f5548658e...@l16g2000yqo.googlegroups.com>,
>
>
>
>
>
>  Eric <gir...@gmail.com> wrote:
> > On Feb 24, 12:07 pm, Eli Zaretskii <e...@gnu.org> wrote:
> > > > From: Eric <gir...@gmail.com>
> > > > Date: Mon, 23 Feb 2009 18:59:43 -0800 (PST)
>
> > > > I'm writing an .emacs file that will need to work under a few
> > > > different versions of emacs, and wanted to ask what the most reliable
> > > > method of checking the current emacs version. Is a simple string
> > > > search in (emacs-version) acceptable, or is there a more robust way of
> > > > doing it?
>
> > > You can do as simple as
>
> > >    (if (>= emacs-major-version 21)
> > >        (do-something))
>
> > > or more sophisticated
>
> > >    (if (version<= 23.0.98)
> > >        (do-something-else))
>
> > > Is that what you are looking for?
>
> > No, sorry! I totally failed to say what I was actually doing -- not
> > checking emacs versions but checking emacs ports: I use Carbon Emacs
> > on my mac at home, and vanilla emacs on my server, and want to set
> > some Carbon-specific variables when I'm at home. The string "Carbon"
> > show up in (emacs-version), that's why I was thinking that might be
> > how I have to do it.
>
> Are you sure you need to conditionalize on that, rather than something
> more generic?  E.g.
>
> (if (eq window-system 'mac)
>     (do-something))
>
> --
> Barry Margolin, bar...@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***

I'm not sure at all, and that's why I was asking! This is helpful,
I'll take a look at this and see what's more appropriate to use. I
think there are some variables that are specific to Carbon (ie the
name actually starts with carbon), but window system might be better
for more general stuff.

Thanks a lot!
Eric


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

* Re: checking emacs version
  2009-02-24  2:59 checking emacs version Eric
  2009-02-24  4:07 ` Eli Zaretskii
       [not found] ` <mailman.1610.1235448457.31690.help-gnu-emacs@gnu.org>
@ 2009-02-24  9:35 ` Leo
  2009-02-24 17:58   ` Peter Dyballa
       [not found] ` <mailman.1636.1235468408.31690.help-gnu-emacs@gnu.org>
  2009-02-24 18:37 ` Pascal J. Bourguignon
  4 siblings, 1 reply; 13+ messages in thread
From: Leo @ 2009-02-24  9:35 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-02-24 02:59 +0000, Eric wrote:
> I'm writing an .emacs file that will need to work under a few
> different versions of emacs, and wanted to ask what the most reliable
> method of checking the current emacs version. Is a simple string
> search in (emacs-version) acceptable, or is there a more robust way of
> doing it?

`system-type'

> Thanks,
> Eric

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.





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

* Re: checking emacs version
  2009-02-24  4:21   ` Eric
  2009-02-24  4:36     ` Barry Margolin
@ 2009-02-24 14:29     ` Jonathan Groll
       [not found]     ` <mailman.1644.1235485784.31690.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Jonathan Groll @ 2009-02-24 14:29 UTC (permalink / raw)
  To: Eric, help-gnu-emacs

On Mon, Feb 23, 2009 at 08:21:32PM -0800, Eric wrote:
>No, sorry! I totally failed to say what I was actually doing -- not
>checking emacs versions but checking emacs ports: I use Carbon Emacs
>on my mac at home, and vanilla emacs on my server, and want to set
>some Carbon-specific variables when I'm at home. The string "Carbon"
>show up in (emacs-version), that's why I was thinking that might be
>how I have to do it.

I have the following in my .emacs, if it'll help:
; Cocoa emacs, for some bizarre reason DELETE key is bound to
backward-delete-char-untabify
;;and make home and end behave in a non-mac way!
(if (string-match "darwin" (version))
( progn
(global-set-key (kbd "<kp-delete>") 'delete-char)
(global-set-key (kbd "<backspace>") 'backward-delete-char)
(global-set-key (kbd "<home>") 'move-beginning-of-line)
(global-set-key (kbd "<end>") 'move-end-of-line)
) )

To give you an idea of how others use it (and you may like pc-type
home, end, delete, backspace keys like I do).

Cheers,
Jonathan




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

* Re: checking emacs version
       [not found]     ` <mailman.1644.1235485784.31690.help-gnu-emacs@gnu.org>
@ 2009-02-24 15:23       ` Eric
  0 siblings, 0 replies; 13+ messages in thread
From: Eric @ 2009-02-24 15:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 24, 10:29 pm, Jonathan Groll <li...@groll.co.za> wrote:
> On Mon, Feb 23, 2009 at 08:21:32PM -0800, Eric wrote:
> >No, sorry! I totally failed to say what I was actually doing -- not
> >checking emacs versions but checking emacs ports: I use Carbon Emacs
> >on my mac at home, and vanilla emacs on my server, and want to set
> >some Carbon-specific variables when I'm at home. The string "Carbon"
> >show up in (emacs-version), that's why I was thinking that might be
> >how I have to do it.
>
> I have the following in my .emacs, if it'll help:
> ; Cocoa emacs, for some bizarre reason DELETE key is bound to
> backward-delete-char-untabify
> ;;and make home and end behave in a non-mac way!
> (if (string-match "darwin" (version))
> ( progn
> (global-set-key (kbd "<kp-delete>") 'delete-char)
> (global-set-key (kbd "<backspace>") 'backward-delete-char)
> (global-set-key (kbd "<home>") 'move-beginning-of-line)
> (global-set-key (kbd "<end>") 'move-end-of-line)
> ) )
>
> To give you an idea of how others use it (and you may like pc-type
> home, end, delete, backspace keys like I do).
>
> Cheers,
> Jonathan

Thanks to all! These are all good suggestions, and I'll probably use
them all in various places, where appropriate.

E


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

* Re: checking emacs version
       [not found] ` <mailman.1636.1235468408.31690.help-gnu-emacs@gnu.org>
@ 2009-02-24 17:40   ` Colin S. Miller
  0 siblings, 0 replies; 13+ messages in thread
From: Colin S. Miller @ 2009-02-24 17:40 UTC (permalink / raw)
  To: help-gnu-emacs

Leo wrote:
> On 2009-02-24 02:59 +0000, Eric wrote:
>> I'm writing an .emacs file that will need to work under a few
>> different versions of emacs, and wanted to ask what the most reliable
>> method of checking the current emacs version. Is a simple string
>> search in (emacs-version) acceptable, or is there a more robust way of
>> doing it?
> 
> `system-type'
> 
>> Thanks,
>> Eric
> 
Under xemacs, I use
(setq custom-file (concat "~/.xemacs/custom-" (symbol-name system-type) ".el"))

This allows me to have a different customisation file for each platform I use.

HTH,
Colin S. Miller
-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.


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

* Re: checking emacs version
  2009-02-24  9:35 ` Leo
@ 2009-02-24 17:58   ` Peter Dyballa
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Dyballa @ 2009-02-24 17:58 UTC (permalink / raw)
  To: Leo; +Cc: help-gnu-emacs


Am 24.02.2009 um 10:35 schrieb Leo:

> `system-type'

Not sufficient! Carbon Emacs, Cocoa Emacs.app, and X11 GNU Emacs all  
run on darwin. The variable window-system is the proper one: either  
mac or ns or x11 or nil – when without own frame.

--
Greetings

   Pete

The mathematician who pursues his studies without clear views of this  
matter, must often have the uncomfortable feeling that his paper and  
pencil surpass him in intelligence.
				– Ernst Mach







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

* Re: checking emacs version
  2009-02-24  2:59 checking emacs version Eric
                   ` (3 preceding siblings ...)
       [not found] ` <mailman.1636.1235468408.31690.help-gnu-emacs@gnu.org>
@ 2009-02-24 18:37 ` Pascal J. Bourguignon
  2009-02-24 22:02   ` Peter Dyballa
       [not found]   ` <mailman.1685.1235512964.31690.help-gnu-emacs@gnu.org>
  4 siblings, 2 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2009-02-24 18:37 UTC (permalink / raw)
  To: help-gnu-emacs

Eric <girzel@gmail.com> writes:

> I'm writing an .emacs file that will need to work under a few
> different versions of emacs, and wanted to ask what the most reliable
> method of checking the current emacs version. Is a simple string
> search in (emacs-version) acceptable, or is there a more robust way of
> doing it?


(list
    emacs-version emacs-major-version emacs-minor-version
    system-type system-name system-configuration
    window-system
    (when (boundp 'aquamacs-version) aquamacs-version))
-->
("22.3.1" 22 3 darwin "galatea.local" "i386-apple-darwin9.5.0" x nil) ; here.

-- 
__Pascal Bourguignon__


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

* Re: checking emacs version
  2009-02-24 18:37 ` Pascal J. Bourguignon
@ 2009-02-24 22:02   ` Peter Dyballa
       [not found]   ` <mailman.1685.1235512964.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Dyballa @ 2009-02-24 22:02 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs


Am 24.02.2009 um 19:37 schrieb Pascal J. Bourguignon:

> nil


Running Aquamacs Emacs in Terminal? Wouldn't Apple's emacs be  
adequate for this?

--
Greetings

   Pete

If all else fails read the instructions.
				- Donald Knuth







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

* Re: checking emacs version
       [not found]   ` <mailman.1685.1235512964.31690.help-gnu-emacs@gnu.org>
@ 2009-02-25  4:34     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2009-02-25  4:34 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 24.02.2009 um 19:37 schrieb Pascal J. Bourguignon:
>
>> nil
>
>
> Running Aquamacs Emacs in Terminal? Wouldn't Apple's emacs be
> adequate for this?

I don't run either of them if I can avoid them.  
I like my GNU emacs to be run in X, and sometimes in an xterm.

-- 
__Pascal Bourguignon__


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

end of thread, other threads:[~2009-02-25  4:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24  2:59 checking emacs version Eric
2009-02-24  4:07 ` Eli Zaretskii
     [not found] ` <mailman.1610.1235448457.31690.help-gnu-emacs@gnu.org>
2009-02-24  4:21   ` Eric
2009-02-24  4:36     ` Barry Margolin
2009-02-24  5:19       ` Eric
2009-02-24 14:29     ` Jonathan Groll
     [not found]     ` <mailman.1644.1235485784.31690.help-gnu-emacs@gnu.org>
2009-02-24 15:23       ` Eric
2009-02-24  9:35 ` Leo
2009-02-24 17:58   ` Peter Dyballa
     [not found] ` <mailman.1636.1235468408.31690.help-gnu-emacs@gnu.org>
2009-02-24 17:40   ` Colin S. Miller
2009-02-24 18:37 ` Pascal J. Bourguignon
2009-02-24 22:02   ` Peter Dyballa
     [not found]   ` <mailman.1685.1235512964.31690.help-gnu-emacs@gnu.org>
2009-02-25  4:34     ` Pascal J. Bourguignon

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.