[ESS] problems with emacclient

Martin Maechler maechler at stat.math.ethz.ch
Fri Nov 4 20:19:41 CET 2005


>>>>> "Brendan" == Brendan Halpin <brendan.halpin at ul.ie>
>>>>>     on 04 Nov 2005 10:10:04 +0000 writes:

    >> On Nov 3, 2005, at 2:03 PM, Rodney Sparapani wrote:
    >> > There is alot of code that depends on whether you are running GNU  
    >> > Emacs
    >> > or XEmacs.  So, most people have a site defined way of doing that  
    >> > like:
    >> > (setq xemacs-p nil) ; for GNU Emacs
    >> > (setq xemacs-p t)   ; for XEmacs
    >> >
    >> > So actually, the code is incomplete.  It needs to be something like:
    >> >
    >> >> (add-hook
    >> >>   'inferior-ess-mode-hook
    >> >>   '(lambda()
    >> >>     (if (xemacs-p) (gnuserv-start)
    >> >> 	(server-start nil))))

no!  (xemacs-p) would be a function call!


    Brendan> To make it stand-alone, the snippet could reduce to 

    Brendan> (if (fboundp 'gnuserv-start)
    Brendan> (gnuserv-start)
    Brendan> (server-start nil))

    Brendan> i.e. if the Xemacs version of the function is bound (exists) call
    Brendan> that, otherwise call the GNU Emacs version.

not really;  the whole point of my snippet was to start the
server only when 'ess-mode' is activated and not every time
(X)emacs is started.

But then, yes, I'm really sorry for using our local xemacs-p
variable.
"The" correct way {namely, both readable and portable}
is what we use in ESS in many places :

      (featurep 'xemacs)

Hence [together with Rodney's enhancement], the thing to add to
your ~/.emacs would be

(add-hook
  'inferior-ess-mode-hook
  '(lambda()
    (if (featurep 'xemacs)
        (gnuserv-start)
       ;; else: GNU emacs
       (server-start nil))))

Martin




More information about the ESS-help mailing list