[ESS] remote R execution via tramp hangs

Jannis bt_jannis at yahoo.de
Thu Sep 25 17:17:08 CEST 2014

Dear ESS users,

after updating to ubuntu 14.04 I have problems to remotely run R on 
another machine via ess and tramp. I start tramp via Ctr - x Ctr -f and 
then point emacs to a file on the remote machine (.i.e 
/machine_name/path_to_file/file_name.R). When I then hit Alt -x R (as I 
used to do before the update), emacs hangs after the message

"Tramp: Opening connection for machine_name using ssh...done"

and is not responsive anymore. The exact same mechanism worked before. I 
can also connect directly to the machine via ssa (i.e. via Alt -x  ssh) 
without any problems. Does anybody have an idea on how to narrow down on 
the cause of the error?


This is my .emacs file:

;;;;;;;;;;;;;;;;;;;;;;;;;;;; general and startup ;;;;;;;;;;;;;;;;;;;;;;;;;

;; Tell emacs where is your personal elisp lib dir
;; this is the dir you place all your extra packages
(add-to-list 'load-path "~/.emacs.d/")

;;disable startup messages
(setq inhibit-startup-message t)

;; want two windows at startup

;;fullscreen mode
(defun toggle-fullscreen ()
   (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                  '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
   (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                  '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  misc tools 

;; show tabs
(require 'tabbar)

;; ido stuff
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t)
(setq ido-create-new-buffer 'always)

;; open recent files
(require 'recentf)
(setq recentf-auto-cleanup 'never) ;; disable before we start recentf!
(recentf-mode 1)

;;regex tool
(load "regex-tool" t)

;; bind recent files
(global-set-key "\C-x\C-r" 'recentf-open-files)

;; clipboard
(setq x-select-enable-clipboard t)

;; global
(require 'smartparens-config)
(require 'smartparens-latex)
(smartparens-global-mode t)
(add-hook 'post-command-hook 'sp--post-command-hook-handler)

;; highlights matching pairs
(show-smartparens-global-mode t)

;;(add-hook 'inferior-ess-mode-hook (lambda () (smartparens-mode 1)))

;;(add-hook 'ess-R-post-run-hook 'smartparens-mode)
;; (add-hook 'ess-post-run-hook 'smartparens-mode)

;;(require 'smart-operator)
;;(add-hook 'ess-mode-hook 'smart-operator-mode)


(require 'fixme-mode)
(require 'fic-mode)
;(require 'fic-mode)
;(add-hook 'ess-mode-hook 'turn-on-fic-mode)
;(add-hook 'latex-mode-hook 'turn-on-fic-mode)
;(add-hook 'LaTeX-mode-hook 'turn-on-fic-mode)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  autosave ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'backup-each-save)
(add-hook 'after-save-hook 'backup-each-save)

;; Put autosave files (ie #foo#) and backup files (ie foo~) in ~/.emacs.d/.
   ;; 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.
  '(LaTeX-command "latex -synctex=1")
  '(auto-save-file-name-transforms (quote ((".*" 
"~/.emacs.d/autosaves/\\1" t))))
  '(backup-directory-alist (quote ((".*" . "~/.emacs.d/autosaves/"))))
  '(comint-move-point-for-output (quote others))
  '(csv-separators (quote ("" ",")))
  '(delete-old-versions t)
  '(kept-new-versions 100)
  '(kept-old-versions 100)
  '(make-directory "~/.emacs.d/autosaves/" t)
  '(version-control t))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ess stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; r profile
(setenv "R_PROFILE_USER" "/home/my_name/.R/.RProfile")

;; path of R program
(setq inferior-R-program-name "/usr/lib/R/bin/R")

;; define startup options
(setq inferior-R-args "--no-save --no-restore --silent")

;; ess stuff
(require 'ess-site)

;; turn off echoing of commands
(setq ess-eval-visibly-p nil)

;; save history to one specific file
(setq ess-history-directory "~/.R/")

;; Enable function argument hint for ESS
(require 'ess-eldoc)

;;start tracebug
(require 'ess-tracebug)
(add-hook 'ess-post-run-hook 'ess-tracebug t)

(ess-toggle-underscore nil)

;; Code folding in ess mode
(add-hook 'ess-mode-hook
         (local-set-key (kbd "C-c <right>") 'hs-show-block)
         (local-set-key (kbd "C-c <left>")  'hs-hide-block)
         (local-set-key (kbd "C-c <up>")    'hs-hide-all)
         (local-set-key (kbd "C-c <down>")  'hs-show-all)
         (hs-minor-mode t)))

(autoload 'ess-rdired "ess-rdired"
   "View *R* objects in a dired-like buffer." t)

;;speed up emacs by removing echoing
(setq ess-eval-visibly-p nil)

(define-key comint-mode-map [C-up] 
(define-key comint-mode-map [C-down] 'comint-next-matching-input-from-input)

;;'(ess-auto-newline t)

(add-hook  'inferior-ess-mode-hook
;         ess-S-mouse-me-menu-commands
;         turn-on-font-lock
          (smartparens-mode 1)))

; no wuatsion for startup directory
  (setq ess-ask-for-ess-directory nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ssh stuff 

;;set up ssh tunelling
(load "~/.emacs.d/ssh.el")
(setq ssh-program "ssh")

;; turn off shell command echo
(defun my-comint-init ()
   (setq comint-process-echoes t))
(add-hook 'comint-mode-hook 'my-comint-init)

;; allow interaction with screen
;; used to send screen keybindings to shell in emacs
(define-key shell-mode-map (kbd "C-l") (lambda (seq) (interactive "k") 
(process-send-string nil seq)))
(define-key inferior-ess-mode-map (kbd "C-l") (lambda (seq) (interactive 
"k") (process-send-string nil seq)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   Tex stuff 

(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)
(setq TeX-PDF-mode t)
(setq-default TeX-master nil)

;; (setq TeX-view-program-list '(("Okular" "okular --unique %u")))

;; (add-hook 'LaTeX-mode-hook '(lambda ()
;;                   (add-to-list 'TeX-expand-list
;;                        '("%u" Okular-make-url))))

;; (defun Okular-make-url () (concat
;;                "file://"
;;                (expand-file-name (funcall file (TeX-output-extension) t)
;;                          (file-name-directory (TeX-master-file)))
;;                "#src:"
;;                (TeX-current-line)
;;                (expand-file-name (TeX-master-directory))
;;                "./"
;;                (TeX-current-file-name-master-relative)))

;; Enable synctex correlation
(setq TeX-source-correlate-method 'synctex)
;; Enable synctex generation. Even though the command shows
;; as "latex" pdflatex is actually called


;; Use Okular as the pdf viewer. Build okular
;; command, so that Okular jumps to the current line
;; in the viewer.
(setq TeX-view-program-selection
  '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
  '(("PDF Viewer" "okular --unique %o#src:%n%b")))

(load "preview-latex.el" nil t t)

(setq ispell-program-name "aspell") ; could be ispell as well, depending 
on your preferences
(setq ispell-dictionary "english") ; this can obviously be set to any 
language your spell-checking program supports

(dolist (hook '(lisp-mode-hook
   (add-hook hook 'flyspell-prog-mode))

(require 'tex-site)
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase Mode" t)
;(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;(add-hook 'plain-tex-mode-hook 'turn-on-reftex) ; with Emacs latex mode

;; (add-hook 'reftex-load-hook 'imenu-add-menubar-index)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)

(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
;(add-hook 'latex-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default fill-column 80)

(dolist (hook '(LaTeX-mode-hook))
   (add-hook hook (lambda () (flyspell-mode 1))))
;(dolist (hook '(latex-mode-hook))
;  (add-hook hook (lambda () (flyspell-mode 1))))

(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t) ; Enable parse on save.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   layout stuff 

;; show changes since last save
(global-highlight-changes-mode t)
(global-set-key (kbd "<M-down>") 'highlight-changes-next-change)
(global-set-key (kbd "<M-up>") 'highlight-changes-previous-change)
(set-face-foreground 'highlight-changes nil)
(set-face-background 'highlight-changes "#6495ed")
(set-face-foreground 'highlight-changes-delete nil)
(set-face-background 'highlight-changes-delete "#ff8c00")
(global-set-key (kbd "<f6>") 'highlight-changes-visible-mode) ;; changes
(add-hook 'text-mode-hook
       (defun highlight-changes-remove-after-save ()
         "Remove previous changes after save."
         (make-local-variable 'after-save-hook)
         (add-hook 'after-save-hook
               (lambda ()
             (highlight-changes-remove-highlight (point-min) 

(add-hook 'ess-mode-hook
       (defun highlight-changes-remove-after-save ()
         "Remove previous changes after save."
         (make-local-variable 'after-save-hook)
         (add-hook 'after-save-hook
               (lambda ()
             (highlight-changes-remove-highlight (point-min) 

;; In every buffer, the line which contains the cursor will be fully
;; highlighted
(global-hl-line-mode 1)

;; ;; autocomplete stuff
;; (add-to-list 'load-path "~/.emacs.d/autocomplete/")
;; (require 'auto-complete-config)
;; (add-to-list 'ac-dictionary-directories 
;; (ac-config-default)
;; (define-key ac-completing-map "\r" nil)
;; (setq
;;  ;; ac-auto-show-menu 1
;;  ;; ac-candidate-limit nil
;;  ;; ac-delay 0.1
;;  ;; ac-disable-faces (quote (font-lock-comment-face font-lock-doc-face))
;;  ac-ignore-case 'smart
;;  ;;ac-menu-height 20
;;  ac-quick-help-delay 3
;;  ;; ac-quick-help-prefer-pos-tip t
;;  ;; ac-use-quick-help nil
;;  ac-fuzzy-enable t
;;  )
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")

;; align equal signs
;; Align with spaces only
(defadvice align-regexp (around align-regexp-with-spaces)
   "Never use tabs for alignment."
   (let ((indent-tabs-mode nil))
(ad-activate 'align-regexp)

;; activate parenthesis matching
(show-paren-mode t)

;; no line wrap
(setq default-truncate-lines t)

(require 'fill-column-indicator)
(add-hook 'ess-mode-hook 'fci-mode)

;;highlight FIXMES

(add-hook 'text-mode-hook
         (font-lock-add-keywords nil
                        1 font-lock-warning-face prepend)))))

(add-hook 'ess-mode-hook
         (font-lock-add-keywords nil
                        1 font-lock-warning-face prepend)))))

(add-hook 'LaTeX-mode-hook
                (lambda ()
                 (font-lock-add-keywords nil
                  '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 
font-lock-warning-face t)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; behaviur 

;; ===== Set standard indent to 2 rather that 4 ====
(setq standard-indent 2)

;; scroll only one line
(setq scroll-step 1)

;; ========== Support Wheel Mouse Scrolling ==========
(mouse-wheel-mode t)

(global-set-key (kbd "C-l") 'highlight-regexp)

(defun sort-words (reverse beg end))

(global-set-key "\C-x\C-b" 'buffer-menu)

(setq tramp-default-method "ssh")
;(getenv "R_PROFILE_USER")

   ;; 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.

More information about the ESS-help mailing list