[ESS] problems with emacclient
Kasper Daniel Hansen
khansen at stat.Berkeley.EDU
Sat Nov 5 03:34:34 CET 2005
On Nov 4, 2005, at 11:19 AM, Martin Maechler wrote:
>>>>>> "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))))
I have now tested this and it works. In addition Seth's suggestion
was spot on. For the non-MacOS users (in case this pops up again on
the list): OS X ships with its own version of Emacs. Most users
install a newer more Mac-integrated Emacs. In my case, having
options(editor = "emacsclient")
in R meant that R picked up the "shipped" version of Emacs, not the
one I wanted. I needed to put
options(editor = "/Applications/Emacs.app/Contents/MacOS/bin/
emacsclient")
for it to work (you might have to change the path depending on which
type of Mac-like Emacs you are using, I am using the "Carbon Emacs")
Kasper
> Martin
>
More information about the ESS-help
mailing list