in my .emacs
file I have:
;; 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)
extracted directly from here ESS autocomplete. Everything related to ESS is:
;;=============================
;;R
;;==============================
;;Enable R
(add-to-list 'load-path "~/ess-15.03-1/lisp/")
(load "ess-site")
(setq ess-eval-visibly 'nil)
(setq ess-ask-for-ess-directory 'nil)
(add-hook 'ess-R-post-run-hook 'ess-execute-screen-options)
(define-key inferior-ess-mode-map "\C-cw" 'ess-execute-screen-options)
(eval-after-load "comint"
'(progn
(define-key comint-mode-map [up]
'comint-previous-matching-input-from-input)
(define-key comint-mode-map [down]
'comint-next-matching-input-from-input)
;; also recommended for ESS use --
(setq comint-scroll-to-bottom-on-output 'others)
(setq comint-scroll-show-maximum-output t)
;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above promp
(setq comint-scroll-to-bottom-on-input 'this)))
Auto-completion of the braces (or auto-closing them) will work with everything: .py
files, .txt
files, even when I am in the R console launched with ESS (M-x R
). However, it will not complete the curly braces when the file is and R
file (e.g. foo.R
). All other skeleton-pair
options work everywhere, the only one that does not is the curly braces.
I read here that some other people has problems with curly braces related with the definition of the ess-electric-brace
at ess-mode.el
. However, their problems are different than mine. It seems that they cannot close the braces. In my case, is simply that it will not auto-complete them, so I am not sure the solution will be the same.
I see that in ess-mode.el
there is a line:
(define-key map "{" 'ess-electric-brace)
and there is not such a thing for (
or [
so I guess is related to that, but do not know how to change it.
Any suggestions?