[ESS] Little troubles with Emacs for Windows and ESS

Paul Johnson pauljohn32 at gmail.com
Sat Feb 6 14:02:20 CET 2010


On Tue, Jan 26, 2010 at 9:00 PM, Vincent Goulet
<Vincent.Goulet at act.ulaval.ca> wrote:
> Le ven. 22 janv. à 19:11, Paul Johnson a écrit :
>
>> I'm running Vincent Goulet's Emacs enhances, which now has Emacs 23.1
>> and ESS 5.7.1.  Today I've installed that with R on several windows
>> systems, some XP, some Vista, some Win7.
>>
>> On all of these systems, I have had the problem that, if you change
>> the default install path for R from C:\Program Files to some place
>> else (I prefer C:\ProgramFiles), then Emacs-ESS can't find Rterm.exe
>
> ESS tries to find all versions of R on your system (in "usual" places) at Emacs startup; see the *Messages* buffer. Your location is probably not "standard" enough (or too sub-standard).
>
>> and you have to edit the ess-site.el file (and delete ess-site.elc).
>
> Please don't fiddle with ESS files! This is provided for in my distribution. In the message box after installation, you get the following:
>
> * If R is not installed in the usual (default) location, it may be
>  necessary to edit the paths in the site configuration file for ESS to
>  find the R executable. This should also be true for any S-Plus
>  installation. The site configuration file is accessed easily using the
>  shortcut in the GNU Emacs program group of the Start menu.
>
> and
>
> The information above is available in file Updates-en.txt in the Emacs
> installation folder.
>
> In site-start.el (the "site configuration file"), you'll find this block of text:
>
> ;; Path to R executable. Uncomment and edit as needed if R is
> ;; installed in such an unusual place that ESS can't find it. (And
> ;; then keep updating with each R update!)
> ;(setq-default inferior-R-program-name
> ;              "c:/program files/r/r-2.7.1/bin/rterm.exe")
>
> (Hum, I should update the release number!) Edit at will.
>
> HTH   Vincent
>

Thanks, but I don't understand specifically what I'm supposed to tell
users they ought to do.  You say "please don't edit ESS files" but
then you seem to say I need to edit Ess files to make it find rterm.
The path where I install R is the usual, except no spaces in directory
names. I don't think that's too unusual.  I'm just going by the
INSTALL instructions in the ESS distribution itself, which has always
recommended we revise ess-site.el to make customizations.

Anyway, I have found one very helpful configuration change for Emacs
on Windows. I would suggest you put this in your modified Emacs for
Windows as a default, at least until the GTK file chooser problem is
solved.

Adding this as a startup default:

(setq use-file-dialog nil)

Helps with several related problems that arise on Windows Vista and 7.
 Users can't answer requests from the file or directory chooser.

The problem appears in these ways:

1 Hit the blue R button.  User is not allowed to select a start
directory for R.  The menu panel directory chooser is unresponsive.
User can type in a name, but the "OK" button does not work.

2 In Emacs File menu, choose "New File" and file chooser will not
allow user to enter a file name

The recommended line causes Emacs to revert to its traditional
behavior of interacting with the user through the small bar at the
bottom of the Emacs window.

For completeness, I do make a number of other startup settings that
make Emacs more understandable to people around here.  Most of these
users have no interest in Emacs itself, they just want to write R
code, and this seems to help.  These changes, for the most part, help
new Emacs adopters get past some of the most unusual characteristics
of Emacs (the legacy from the pre X11 days).

(require 'pc-select)
(pc-selection-mode)
(custom-set-variables
 '(cua-mode t nil (cua-base))
 '(show-paren-mode t)
 '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
 '(transient-mark-mode t))

;;;
(setq inferior-ess-own-frame t)
(setq inferior-ess-same-window nil)
;;;
;;;;;create a new frame for each help instance
;;;
(setq ess-help-own-frame t)
;;;;;If you want all help
;;;;; buffers to go into one frame do:
;;;
(setq ess-help-own-frame 'one)

(setq ess-ask-for-ess-directory nil)
(setq ess-local-process-name "R")

(setq split-window-preferred-function nil)



 (setq ansi-color-for-comint-mode 'filter)
  (setq comint-prompt-read-only t)
  (setq comint-scroll-to-bottom-on-input t)
  (setq comint-scroll-to-bottom-on-output t)
  (setq comint-move-point-for-output t)


(defun my-ess-eval ()
  (interactive)
  (if (and transient-mark-mode mark-active)
        (call-interactively 'ess-eval-region)
    (call-interactively 'ess-eval-line-and-step)))

(add-hook 'ess-mode-hook
          '(lambda()
             (local-set-key [(shift return)] 'my-ess-eval)))


;; http://fuhm.livejournal.com/
;; This hack removes the really annoying splash screen that emacs22
;; now displays by default, even when you're trying to edit a buffer.

;; This works because this function is called whenever a filename is
;; specified on the command line, which is almost exactly when I want
;; to inhibit the splashscreen. (it also catches a couple other cases
;; like -script, -load, and -L, but that doesn't really matter).
;; --jknight

(defadvice command-line-normalize-file-name
      (before kill-stupid-startup-screen activate)
  (setq inhibit-startup-screen t))




-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas



More information about the ESS-help mailing list