[ESS] Emacs initialisation file doesn't work on a new computer.

Vincent Goulet vincent.goulet at dgfc.ulaval.ca
Tue Jun 19 05:39:11 CEST 2012


Hi Chris,

I'm not by any means a lisp expert. However, comparing your lines involving ess-mode-map to those in my own .emacs file, I noticed that one main difference is that mine are all within a definition for ess-mode-hook. Indeed, replacing your lines

(define-key ess-mode-map [delete] 'delete-char)
(define-key inferior-ess-mode-map [delete] 'delete-char)

with

(add-hook 'ess-mode-hook
          (lambda ()
            (define-key ess-mode-map [delete] 'delete-char)
            (define-key inferior-ess-mode-map [delete] 'delete-char)))

solves the issue. I guess it'd be the same for lines involving comint-mode-map, although I didn't test.

ESS developers may comment as to why a hook (apparently) is necessary to redefine ess-mode-map and if something changed with recent ESS versions.

HTH

v.

Vincent Goulet
Directeur général adjoint
Direction générale de la formation continue - DGFC

Le 2012-06-12 à 04:46, Chris Howden a écrit :

> Thanks for the response Vincent,
>
> My entire init file is below. It’s a bit of a hack of various peoples init files including yours, plus some useful stuff I've picked up along the way. (It’s a hack since I don’t really understand this language, but I’d really like to try and understand it a bit better. I was wondering if anyone could point me in the right direction of a good book / online resource / etc. Am I correct in thinking it’s LISP?)
>
> I keep getting the following error "> Symbol's value as variable is void: ess-mode-map" for different 'handles'? (not sure if I'm using the correct terminology there)
>
> When I comment one out EMACS then finds another it doesn't like and I get a similar error message for it
>
> My entire init file is below and I've put in red bold each section I get the above error message. The lines of code I’m having trouble with are:
> (define-key ess-mode-map [delete] 'delete-char)
> (define-key inferior-ess-mode-map [delete] 'delete-char)
> (define-key comint-mode-map [C-up] 'comint-previous-matching-input-from-input)
> (define-key comint-mode-map [C-down] 'comint-next-matching-input-from-input)
> (define-key ess-mode-map (kbd "C-d") 'comment-region)
> (define-key ess-mode-map (kbd "C-S-d") 'uncomment-region)
>
>
> Interestingly once I comment out the above EMACS starts with no problems BUT code unrelated to the above no longer works e.g. Felipe Csaszars Code to make shift+return start an R inferior frame, evaluate region or line.
>
> MY INIT FILE
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; VERSION HISTORY
> ; 1 ~ has the following emacs files:
> ;       Chris Howdens emacs file
> ;       Paul E. Johnson emacs file
> ;       Vincent Goulets  emacs file
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Chris Howdens emacs file
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; custom-set-variables was added by Custom.
> ;; If you edit it by hand, you could mess it up, so be careful.
> ;; Your init file should contain only one such instance.
> ;; If there is more than one, they won't work right.
> (custom-set-variables
>
> ; turns on CUA mode so ESS cuts and pastes using the same bindings as Windows
> '(cua-mode t nil (cua-base))
>
> ; turns on parenthesis matching mode, so matching parentheses are highlighted in different colours
> '(show-paren-mode t))
>
>
> ;; custom-set-faces was added by Custom.
> ;; If you edit it by hand, you could mess it up, so be careful.
> ;; Your init file should contain only one such instance.
> ;; If there is more than one, they won't work right.
> (custom-set-faces
> )
>
> ;; these insure the R process window always shows the last executed code. If not used the R process won't scroll with the new content
> ;; and we won't see the last lines in the R process buffer. Which is not effecient since we want to see the result of the last lines of code we've run.
> (setq comint-scroll-to-bottom-on-input t)
> (setq comint-scroll-to-bottom-on-output t)
> (setq comint-move-point-for-output t)
> (setq comint-scroll-show-maximum-output t) ; Bill Venables said this was the key
>
>
> ; Set default font size to 12 point
> ; The value is in 1/10pt, so 100 will give you 10pt, etc.
> (set-face-attribute 'default nil :height 120)
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; MAKE ESS WORK LIKE WINDOWS
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Delete selection when pressing [delete] key
> ;; code from https://stat.ethz.ch/pipermail/r-help/2003-April/031710.html
> (define-key ess-mode-map [delete] 'delete-char)
> (define-key inferior-ess-mode-map [delete] 'delete-char)
>
>
> ;; There is code above in the (custom-set-variables) command that makes ESS cut and paste using the same bindings as windows
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; GET R HELP TO WORK CORRECTLY
> ;;
> ;; TO DO
> ;; 1) '??' doesn't work correctly. There is code below that claims to fix this however it breaks alot of the other functionality I want.
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;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)
>
>
> ;; Get r help to open in HTML and to work correctly
> (setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
>
>
> ;; Not sure what this does
> ;; html helper mode from http://www.farne.uklinux.net/emacs-primer.html
> ;(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
> ;(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
> ;(setq html-helper-do-write-file-hooks t)
>
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; code from http://stackoverflow.com/questions/2901198/useful-keyboard-shortcuts-and-tips-for-ess-r
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;C-tab to switch between the R command line and the file
> (global-set-key [C-tab] 'other-window)
>
>
> ;; Control and up/down arrow keys to search history with matching what you've already typed
> (define-key comint-mode-map [C-up] 'comint-previous-matching-input-from-input)
> (define-key comint-mode-map [C-down] 'comint-next-matching-input-from-input)
>
>
> ;; Comment or decomment region
> (defun uncomment-region (beg end)
>   "Like `comment-region' invoked with a C-u prefix arg."
>   (interactive "r")
>   (comment-region beg end -1))
>
> (define-key ess-mode-map (kbd "C-d") 'comment-region)
> (define-key ess-mode-map (kbd "C-S-d") 'uncomment-region)
>
>
> ;; Search with C-f / C-F (control-maj-F for backware search)
>    (global-set-key "\C-f" 'isearch-forward)
>    (global-set-key (kbd "C-S-f") 'isearch-backward)
>    (define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)
>    (define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
>
>
> ;; Save with C-s / C-S
>   (global-set-key (kbd "C-s") 'save-buffer)
>   (global-set-key (kbd "C-S-s") 'write-file)
>   ;; need to redefine them for isearch mode (don't know why)
>   (define-key isearch-mode-map (kbd "C-s") 'save-buffer)
>   (define-key isearch-mode-map (kbd "C-S-s") 'write-file)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Automatically close brackets and parentheses
> ;;
> ;;  Code by FelipeCsaszar from
> ;;  emacswikki page http://www.emacswiki.org/emacs/ESSShiftEnter
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; enable skeleton-pair insert globally
>    (setq skeleton-pair t)
>
> ;;(setq skeleton-pair-on-word t)
>    (global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
>    (global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
>    (global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
>    (global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
> ;   (global-set-key (kbd "\'") 'skeleton-pair-insert-maybe)
>    (global-set-key (kbd "\`") 'skeleton-pair-insert-maybe)
> ;   (global-set-key (kbd "<") 'skeleton-pair-insert-maybe)
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; if R if not running, it starts automatically and opens an inferior frame
> ;; if the region is active, evaluates the region otherwise, it runs the current line.
> ;; This is quite useful, saving keystrokes, especially starting R.
> ;;
> ;;  Code by FelipeCsaszar from
> ;;  emacswikki page http://www.emacswiki.org/emacs/ESSShiftEnter
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>   (setq ess-ask-for-ess-directory nil)
>   (setq ess-local-process-name "R")
>   (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-start-R ()
>     (interactive)
>     (if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
>       (progn
>                (delete-other-windows)
>                (setq w1 (selected-window))
>                (setq w1name (buffer-name))
>                (setq w2 (split-window w1))
>                (R)
>                (set-window-buffer w2 "*R*")
>                (set-window-buffer w1 w1name))))
>   (defun my-ess-eval ()
>     (interactive)
>     (my-ess-start-R)
>     (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)))
>   (add-hook 'inferior-ess-mode-hook
>                    '(lambda()
>                       (local-set-key [C-up] 'comint-previous-input)
>                       (local-set-key [C-down] 'comint-next-input)))
>   (require 'ess-site)
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; I have defined a function, ess-R-object-tooltip, that when
> ;; invoked, will return a tooltip with some information about
> ;; the object at point.  The information returned is
> ;; determined by which R function is called.  This is controlled
> ;; by an alist, called ess-R-object-tooltip-alist.  The default is
> ;; given below.  The keys are the classes of R object that will
> ;; use the associated function.  For example, when the function
> ;; is called while point is on a factor object, a table of that
> ;; factor will be shown in the tooltip.  The objects must of course
> ;; exist in the associated inferior R process for this to work.
> ;; The special key "other" in the alist defines which function
> ;; to call when the class is not mached in the alist.  By default,
> ;; the str function is called, which is actually a fairly useful
> ;; default for data.frame and function objects.
> ;;
> ;; The last line of this file shows my default keybinding.
> ;; I simply save this file in a directory in my load-path
> ;; and then place (require 'ess-R-object-tooltip) in my .emacs
> ;;
> ;; Code from http://blogisticreflections.wordpress.com/2009/10/01/r-object-tooltips-in-ess/
> ;; ess-R-object-tooltip.el
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; the alist
> (setq ess-R-object-tooltip-alist
>       '((numeric    . "summary")
>         (factor     . "table")
>         (integer    . "summary")
>         (lm         . "summary")
>         (other      . "str")))
>
> (defun ess-R-object-tooltip ()
>   "Get info for object at point, and display it in a tooltip."
>   (interactive)
>   (let ((objname (current-word))
>         (curbuf (current-buffer))
>         (tmpbuf (get-buffer-create "**ess-R-object-tooltip**")))
>     (if objname
>         (progn
>           (ess-command (concat "class(" objname ")\n")  tmpbuf )
>           (set-buffer tmpbuf)
>           (let ((bs (buffer-string)))
>             (if (not(string-match "\(object .* not found\)\|unexpected" bs))
>                 (let* ((objcls (buffer-substring
>                                 (+ 2 (string-match "\".*\"" bs))
>                                 (- (point-max) 2)))
>                        (myfun (cdr(assoc-string objcls
>                                                 ess-R-object-tooltip-alist))))
>                   (progn
>                     (if (eq myfun nil)
>                         (setq myfun
>                               (cdr(assoc-string "other"
>                                                 ess-R-object-tooltip-alist))))
>                     (ess-command (concat myfun "(" objname ")\n") tmpbuf)
>                     (let ((bs (buffer-string)))
>                       (progn
>                         (set-buffer curbuf)
>                         (tooltip-show-at-point bs 0 30)))))))))
>     (kill-buffer tmpbuf)))
>
>
> ;; my default key map
> (define-key ess-mode-map "\C-c\C-g" 'ess-R-object-tooltip)
>
> (provide 'ess-R-object-tooltip)
>
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;             Paul E. Johnson emacs file
> ;;             Code from MS Windows Users: Get Started with Emacs, ESS, and R website
> ;;      http://www.emacswiki.org/cgi-bin/wiki/EmacsSpeaksStatistics#toc7
> ;;
> ;; Emacs startup file for the Debian GNU/Linux ess package
> ;;
> ;; Originally contributed by Nils Naumann <naumann at unileoben.ac.at>
> ;; Modified by Dirk Eddelbuettel <edd at debian.org>
> ;; Adapted for dh-make by Jim Van Zandt <jrv at vanzandt.mv.com>
> ;;
> ;; Set up emacs-ess for Emacs with other things we like at KU.
> ;;
> ;; This file is automatically loaded by emacs's site-start.el
> ;; when you start a new emacs session.
> ;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;(setq use-file-dialog nil)
>
> (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)
>
>
> (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)
>
>
> ;;http://www.emacswiki.org/cgi-bin/wiki/EmacsSpeaksStatistics
> ;;(defun my-ess-start-R ()
> ;;  (interactive)
> ;;  (if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
> ;;      (progn
> ;;        (delete-other-windows)
> ;;        (setq w1 (selected-window))
> ;;        (setq w1name (buffer-name))
> ;;        (setq w2 (split-window w1))
> ;;        (R)
> ;;        (set-window-buffer w2 "*R*")
> ;;        (set-window-buffer w1 w1name))))
>
> (defun my-ess-eval ()
>   (interactive)
> ;;  (my-ess-start-R)
>   (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.
> ;;
> ;; While there is the variable inhibit-splash-screen, that only lets
> ;; you inhibit it *always*, which I don't really want to do in site
> ;; configuration. This patch causes it to still be shown when no
> ;; buffers were specified on the command-line, like emacs used to do,
> ;; before RMS forced it to be made annoying.
> ;;
> ;; 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))
>
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;; Vincent Goulets .emacs file 19-10-2010
> ;;;
> ;;; Fichier d'initialisation de GNU Emacs de Vincent Goulet
> ;;; (Version Windows simplifée)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;; ============
> ;;;  LaTeX-mode
> ;;; ============
> (setq-default TeX-auto-parse-length 200)
> (setq-default TeX-master nil)
> (setq LaTeX-default-options "12pt")
>
> (add-hook 'LaTeX-mode-hook 'my-latex-mode)
>
> (defun my-latex-mode ()
>   (latex-math-mode)
>   (turn-on-reftex)
>   (setq ispell-extra-args '("-t")))
>
>
> ;;; =====
> ;;;  ESS
> ;;; =====
> (require 'ess-site)
>
> (add-hook 'ess-mode-hook 'my-ess-options)
> (add-hook 'inferior-ess-mode-hook 'my-iess-keybindings)
>
> (defun my-ess-options ()
>   (ess-set-style 'C++)
>   (column-number-mode t)
>   (define-key ess-mode-map [(meta backspace)] 'backward-kill-word)
>   (define-key ess-mode-map [(control ?c) (?;)] 'comment-region)
>   (define-key ess-mode-map [(control ?c) (?:)] 'uncomment-region))
>
> (defun my-iess-keybindings ()
>   (define-key inferior-ess-mode-map [(control ?a)] 'comint-bol)
>   (define-key inferior-ess-mode-map [home] 'comint-bol))
>
>
> ;;; ==========
> ;;;  cc-mode
> ;;; ==========
> (add-hook 'c-mode-common-hook 'my-cc-mode)
>
> (defun my-cc-mode ()
>   (font-lock-mode)
>   (font-lock-fontify-buffer)
>   (auto-fill-mode)
>   (c-toggle-auto-state)
>   (c-toggle-hungry-state)
>   (c-set-style "bsd")
>   (setq c-basic-offset 4))
>
>
> ;;; ===========
> ;;;  text-mode
> ;;; ===========
> (add-hook 'text-mode-hook 'turn-on-auto-fill)
>
>
> ;;; ========
> ;;;  Ispell
> ;;; ========
> ;(require 'ispell)
> (setq ispell-dictionary "francais")
>
>
>
> ;;; ==========================================================
> ;;;  Nouvelles fonctions non rattachées à un mode particulier
> ;;; ==========================================================
>
> ;; =================================
> ;; Fonction pour dupliquer une ligne
> ;; =================================
> ; (defun dup-line ()
> ;   "Duplicates the line on which point lies."
> ;  (interactive)
> ;  (save-excursion
> ;    (beginning-of-line)
> ;    (let ((begin (point)))
> ;      (forward-line)
> ;      (copy-region-as-kill begin (point))
> ;      (yank)
> ;      (forward-line -1)
> ;      (back-to-indentation))))
>
> ;;; ===============
> ;;;  Look and feel
> ;;; ===============
> (blink-cursor-mode nil)                  ; curseur ne clignote pas
> (setq-default cursor-type 'bar)          ; curseur étroit
> (set-face-background 'cursor "#CC0000")  ; curseur rouge foncé
> ;(tool-bar-mode nil)                                       ; cacher les horribles icônes
>
> (global-font-lock-mode t)                ; colorisation du texte
> (transient-mark-mode t)                  ; mode de sélection "normal"
> (delete-selection-mode t)                ; entrée efface texte sélectionné
> (setq-default mouse-yank-at-point t)     ; coller avec la souris
> (show-paren-mode t)                      ; coupler les parenthèses
> (setq-default case-fold-search t)        ; recherche sans égard à la casse
>
> (setq default-major-mode 'text-mode)     ; mode par défaut
>
>
> ;;; ==================================
> ;;;  Polices de caractère et couleurs
> ;;; ==================================
> (set-face-font 'default "-outline-Consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-1")
> (set-face-font 'bold "-outline-Consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-1")
> (set-face-font 'italic "-outline-Consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-1")
> (set-face-font 'bold-italic "-outline-Consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-1")
> (set-face-background 'mode-line "#EFEEE2")
> (set-face-background 'region "lightskyblue1")
> (set-face-foreground 'font-lock-function-name-face "Blue3")
> (set-face-foreground 'font-lock-keyword-face "Orange")
>
>
> ;;; ==================
> ;;;  Auto-compression
> ;;; ==================
> (auto-compression-mode nil)
> (auto-compression-mode t)
>
>
> ;;; ================
> ;;;  Iswitch buffer
> ;;; ================
> (iswitchb-mode t)
>
>
> ;;; ==============================
> ;;;  Nouveaux keybindings globaux
> ;;; ==============================
> (global-set-key [(meta ?z)] 'dup-line)
> (global-set-key [f5] 'goto-line)
> (global-set-key [f8] 'auto-fill-mode)
> (global-set-key [f12] 'other-window)
> (global-set-key [(meta delete)] 'kill-word)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; CODE I LIKE TO USE, BUT CAN'T FOR SOME REASON
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; ESS freezes when a command that takes alot of time to exucte is run. This fixes that
> ;; HOWEVER IT ALSO PREVENTS MY ENTER+SHIFT COMMAND FROM WORKING, WHICH IS MORE IMPROTANT TO ME.....SO I'LL COMMENT IT OUT UNTIL I CAN MAKE IT WORK WITH THAT CODE
> ;; IT ALSO FORCES THE DEFAULT FONT TO BE COURIER NEW
> ;;
> ;; Email from Vitalie Spinu in ess-help at r-project.org 11-8-2011, in ess help folder
> ;;
> ;; If you type Sys.sleep(5) at R prompt emacs will froze for 5 second. It happens with any command which takes time to execute.
> ;; The problem stems from the fact that comint is waiting to delete the double input (comint-process-echoes is set to 't' in *R* buffers, see the doc).
> ;; What happens is:  'inferior-R-input-sender' calls 'ess-eval-linewise' which inserts the user input and double it (since it's already in the buffer). Then comint is waiting to delete the doubled input.
> ;; The kludge is easy to correct, just call 'process-send-string' instead of 'ess-eval-linewise'.  This will free emacs immediately.
> ;; I incorporated these changes in ess-tracebug (http://code.google.com/p/ess-tracebug/). You can toggle it on and off with M-x ess-tracebug and see the difference.
> ;; The patch bellow also corrects this kludge.
> ;   (if (or (string= ess-language "S"))
> ;       (cond
> ;        ((string= ess-dialect "R")
> ;-            (setq comint-input-sender 'inferior-R-input-sender))
> ;+            (setq comint-input-sender 'inferior-R-input-sender)
> ;+        (setq comint-process-echoes nil))
> ;        ( (member ess-dialect '("S3" "S4" "S+3" "S+4" "S+5" "S+6" "S"))
> ;              (setq comint-input-sender 'inferior-ess-input-sender))))
>
>
>
> ;; '??' DOESN'T WORK IN ESS, THIS FIXES THAT
> ;; HOWEVER IT ALSO PREVENTS MY ENTER+SHIFT COMMAND FROM WORKING, WHICH IS MORE IMPROTANT TO ME.....SO I'LL COMMENT IT OUT UNTIL I CAN MAKE IT WORK WITH THAT CODE
> ;; IT ALSO FORCES THE DEFAULT FONT TO BE COURIER NEW
>
> ;; FIXME: Note that  '??' nicely works in *R*, but
> ;;               'type ? topic' doesn't use ess-help {but display in *R*}
> ; (defconst inferior-R-1-input-help (format "^ *help *(%s)" ess-help-arg-regexp)) -(defconst inferior-R-2-input-help (format "^ *\\? *%s" ess-help-arg-regexp))
> ;+(defconst inferior-R-2-input-help "^ *\\(\\?\\{1,2\\}\\)
> ;*['\"]?\\([^,=)'\"]*\\)['\"]?")
> ; (defconst inferior-R-page              (format "^ *page *(%s)" ess-help-arg-regexp))
> ;
> ; (defun inferior-R-input-sender (proc string) @@ -1756,7 +1757,8 @@
> ;                            (string-match inferior-R-2-input-help string)))
> ;           (page-string           (string-match inferior-R-page             string)))
> ;       (if (or help-string page-string)
> ;-          (let* ((string2 (match-string 2 string)))
> ;+          (let ((string1 (match-string 1 string))
> ;+                (string2 (match-string 2 string)))
> ;             ;;(ess-write-to-dribble-buffer (format " new string='%s'\n" string2))
> ;             (beginning-of-line)
> ;             (if (looking-at inferior-ess-primary-prompt) @@ -1765,10 +1767,12 @@
> ;                   (insert-before-markers string)) ;; emacs 21.0.105 and older
> ;               (delete-backward-char 1)) ;; emacs 21.0.106 and newer
> ;             (if help-string ; more frequently
> ;-                           (progn
> ;-                             (ess-display-help-on-object
> ;-                              (if (string= string2 "") "help" string2))
> ;-                             (ess-eval-linewise "\n"))
> ;+                (let ((inferior-ess-help-command
> ;+                       (if (string= string1 "?")
> ;inferior-ess-help-command "help.search(\"%s\")\n")))
> ;+                  (progn
> ;+                    (ess-display-help-on-object
> ;+                     (if (string= string2 "") "help" string2))
> ;+                    (ess-eval-linewise "\n")))
> ;
> ;                    ;; else  page-string
> ;                    (let ((str2-buf (concat string2 ".rt"))) @@ -1778,7 +1782,8 @@
> ;                             (switch-to-buffer-other-window str2-buf)
> ;                             (R-transcript-mode))))
> ;         ;; else:        normal command
> ;-        (inferior-ess-input-sender proc string)))))
> ;+        (process-send-string proc (concat string "\n"))
> ;+        ))))
>
> Chris Howden B.Sc. (Hons) GStat.
> Founding Partner
> Evidence Based Strategic Development, IP Commercialisation and Innovation, Data Analysis, Modelling and Training
> (mobile) 0410 689 945
> (fax) +612 4782 9023
> chris at trickysolutions.com.au
>
>
>
>
> Disclaimer: The information in this email and any attachments to it are confidential and may contain legally privileged information. If you are not the named or intended recipient, please delete this communication and contact us immediately. Please note you are not authorised to copy, use or disclose this communication or any attachments without our consent. Although this email has been checked by anti-virus software, there is a risk that email messages may be corrupted or infected by viruses or other interferences. No responsibility is accepted for such interference. Unless expressly stated, the views of the writer are not those of the company. Tricky Solutions always does our best to provide accurate forecasts and analyses based on the data supplied, however it is possible that some important predictors were not included in the data sent to us. Information provided by us should not be solely relied upon when making decisions and clients should use their own judgement.
>
>
> -----Original Message-----
> From: Vincent Goulet [mailto:vincent.goulet at dgfc.ulaval.ca]
> Sent: Tuesday, 12 June 2012 2:39 AM
> To: Chris Howden
> Cc: ess-help at r-project.org
> Subject: Re: [ESS] Emacs initialisation file doesn't work on a new computer.
>
> Hi Chris,
>
> I think we'll need some more details to pinpoint the problem like, for example, the complete chunk of code causing the error. And what are the "more similar errors" (and the code causing them)?
>
> v.
>
> Vincent Goulet
> Directeur général adjoint
> Direction générale de la formation continue - DGFC
>
> Le 2012-06-11 à 6:04, Chris Howden a écrit :
>
> > Hi,
> >
> > I've just got a new desktop 'super computer' (at least it is compared
> > to the laptop I've been using) so I've excitedly loaded up R and
> > Vincent Goulet's excellent EMACS download. Copied across my init file.
> > And tried to start EMACS for some fun comparing how much quicker it is.
> >
> > Unfortunately I'm getting some error messages and then it doesn't use
> > my init file. The first one I get is:
> > " Warning (initialization): An error occurred while loading
> > `c:/Users/Chris Howden/.emacs':
> >
> > Symbol's value as variable is void: ess-mode-map
> >
> > To ensure normal operation, you should investigate and remove the
> > cause of the error in your initialization file.  Start Emacs with the
> > `--debug-init' option to view a complete error backtrace."
> >
> >
> > So I commented it out, but then I get more similar errors.
> >
> > Now the strange thing is this same init file works just fine on my old
> > laptop. The only difference between the 2 is that the laptop runs
> > 32bit
> > Window7 and GNU 23.3.1, and the new computer a 64bit W7 and GNU 23.4.1.
> >
> > Does anyone have any ideas on what's going on?
> >
> > And if not what I might do to figure out whats going on?
> >
> > Thanks for your help.
> >
> >
> >
> >
> >
> >
> >
> >
> > I was wondering if anyone has any suggestions on how to get a new
> > build of EMACS to use could point me in the right  some
> >
> >
> >
> > Chris Howden B.Sc. (Hons) GStat.
> > Founding Partner
> > Evidence Based Strategic Development, IP Commercialisation and
> > Innovation, Data Analysis, Modelling and Training
> > (mobile) 0410 689 945
> > (fax) +612 4782 9023
> > chris at trickysolutions.com.au
> >
> >
> >
> >
> > Disclaimer: The information in this email and any attachments to it
> > are confidential and may contain legally privileged information. If
> > you are not the named or intended recipient, please delete this
> > communication and contact us immediately. Please note you are not
> > authorised to copy, use or disclose this communication or any attachments without our consent.
> > Although this email has been checked by anti-virus software, there is
> > a risk that email messages may be corrupted or infected by viruses or
> > other interferences. No responsibility is accepted for such
> > interference. Unless expressly stated, the views of the writer are not those of the company.
> > Tricky Solutions always does our best to provide accurate forecasts
> > and analyses based on the data supplied, however it is possible that
> > some important predictors were not included in the data sent to us.
> > Information provided by us should not be solely relied upon when
> > making decisions and clients should use their own judgement.
> >
> > ______________________________________________
> > ESS-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list