automagic splus-version {was ess-mode 5.1.18; Splus 6.0}

Jeff Mincy jeff at delphioutpost.com
Fri Aug 10 15:43:26 CEST 2001


   From: Martin Maechler <maechler at stat.math.ethz.ch>
   Date: Fri, 10 Aug 2001 14:50:00 +0200
   
   >>>>> "Jeff" == Jeff Mincy <jeff at delphioutpost.com> writes:
   
    Jeff>   3) should the ess Splus version be automatically selected, eg
    Jeff>   something like:
   
    Jeff> (defvar splus-version
    Jeff>  (let ((version (and (executable-find "Splus")
    Jeff>                      (exec-to-string "Splus VERSION"))))
    Jeff>    (if (and version (string-match 
    Jeff>         "S-PLUS Version \\([0-9]+\\)\\.\\([0-9]+\\) Release \\([0-9]+\\)"
    Jeff>                      version))
    Jeff>        (list (subseq version (match-beginning 1) (match-end 1))
    Jeff>              (subseq version (match-beginning 2) (match-end 2))
    Jeff>              (subseq version (match-beginning 3) (match-end 3))))))
    Jeff> 
    Jeff> (cond ((and splus-version (equal (car splus-version) "6"))
    Jeff>        (fset 'S 'S+6) ...)
    Jeff>       ((and splus-version (equal (car splus-version) "5"))
    Jeff>        (fset 'S 'S+5) ...)
    Jeff>       (t (fset 'S 'S+3) ...))
   
   As I thought this was a very good idea, I started looking at it, 
   and realized that unfortunately
   
       (exec-to-string ....)
   
   is not existing in GNU Emacs (20.7).  So (since Jeff is using that) it's
   Xemacs only. 
   
   Any GNU emacs replacement for that?
   Thanks in advance!

shell-command-to-string seems to work in both
  (shell-command-to-string "Splus VERSION")



The other issue is that the user's system may have multiple versions
of Splus installed under different names.  So, you should probably
go through a list of possible 'splus' names - for example:

(list 
 inferior-S+6-program-name
 inferior-S+5-program-name
 inferior-S+4-program-name
 inferior-S+3-program-name
 "Splus")

And use the first one that exists on the system instead of just Splus above.

-jeff
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the ESS-help mailing list