From 32103b2ddc5476934272b8fa9821f200fcf32dcb Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Tue, 2 May 2017 15:18:23 +0100 Subject: [PATCH] added ess layer variable ess-disable-underscore-assign --- layers/+lang/ess/README.org | 23 ++++++++++++----------- layers/+lang/ess/config.el | 3 +++ layers/+lang/ess/packages.el | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/layers/+lang/ess/README.org b/layers/+lang/ess/README.org index 91555210c..e4d9add1e 100644 --- a/layers/+lang/ess/README.org +++ b/layers/+lang/ess/README.org @@ -51,19 +51,20 @@ Helpers for inspecting objects at point are available in R buffers only. | ~SPC m h t~ | view table using [ess-R-data-view][ess-R-data-view] | * Options -=ess-smart-equals= is disabled by default. In order to enable it, set in your -=~/.spacemacs= + +To turn off the automatic replacement of underscores by =<-=, +set in your =~/.spacemacs=: + +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-configuration-layers '((ess :variables + ess-disable-underscore-assign t))) +#+END_SRC + +Alternatively you may enable =ess-smart-equals=, which also disables +replacement of underscores by =<-=, and additionally replace the equals sign with +=<-= when appropriate: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layers '((ess :variables ess-enable-smart-equals t))) #+END_SRC - -To turn off the automatic replacement of underscores by =<-=, add the following -hook: - -#+begin_src emacs-lisp - (add-hook 'ess-mode-hook - (lambda () - (ess-toggle-underscore nil))) -#+end_src diff --git a/layers/+lang/ess/config.el b/layers/+lang/ess/config.el index 5d33842c7..04902ec93 100644 --- a/layers/+lang/ess/config.el +++ b/layers/+lang/ess/config.el @@ -13,3 +13,6 @@ (defvar ess-enable-smart-equals nil "If non-nil smart-equal support is enabled") + +(defvar ess-disable-underscore-assign nil + "If non-nil, disables underscore _ being a shortcut for assignment <-") diff --git a/layers/+lang/ess/packages.el b/layers/+lang/ess/packages.el index bea486cc4..9486ced9a 100644 --- a/layers/+lang/ess/packages.el +++ b/layers/+lang/ess/packages.el @@ -71,6 +71,8 @@ ess-expression-offset 2 ess-nuke-trailing-whitespace-p t ess-default-style 'DEFAULT) + (if ess-disable-underscore-assign + (ess-toggle-underscore nil)) (spacemacs/set-leader-keys-for-major-mode 'ess-julia-mode "'" 'julia