Skip to content

Commit

Permalink
Custom cycle for ESS smart equals.
Browse files Browse the repository at this point in the history
  • Loading branch information
basille committed Feb 7, 2022
1 parent d841090 commit 29ea6eb
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions init.org
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ string for comments with only one pound for compatibility with
RStudio:

#+BEGIN_SRC emacs-lisp
(setq ess-default-style 'OWN)
(setq ess-style 'OWN)
(custom-set-variables
'(ess-own-style-list
(quote
Expand Down Expand Up @@ -1716,13 +1716,36 @@ ESS should not use IDO for completion; use company instead:
(setq ess-use-ido nil)
#+END_SRC

ESS smart equals to cycle smartly through operators with ~=~:
ESS smart equals to cycle smartly through operators with ~=~ (and includes the
new pipe =|>= instead of magrittr's pipe =%>%=):

#+BEGIN_SRC emacs-lisp
(custom-set-variables
'(ess-smart-equals-contexts
'((t
(comment)
(string)
;; (arglist "=" "==" "!=" "<=" ">=" "<-" "<<-" "%>%")
(arglist "=" "==" "!=" "<=" ">=" "<-" "<<-" "|>")
(index "==" "!=" "%in%" "<" "<=" ">" ">=" "=")
(conditional "==" "!=" "<" "<=" ">" ">=" "%in%")
;; (base "<-" "<<-" "=" "==" "!=" "<=" ">=" "->" "->>" ":=")
(base "<-" "<<-" "=" "==" "!=" "<=" ">=" "->" ":=")
(% "%*%" "%%" "%/%" "%in%" "%>%" "%<>%" "%o%" "%x%")
;; (not-% "<-" "<<-" "=" "->" "->>" "==" "!=" "<" "<=" ">" ">=" "+" "-" "*" "**" "/" "^" "&" "&&" "|" "||")
(not-% "<-" "<<-" "|>" "=" "->" "->>" "==" "!=" "<" "<=" ">" ">=" "+" "-" "*" "**" "/" "^" "&" "&&" "|" "||")
;; (all "<-" "<<-" "=" "->" "->>" "==" "!=" "<" "<=" ">" ">=" "%*%" "%%" "%/%" "%in%" "%x%" "%o%" "%<>%" "%>%" "+" "-" "*" "**" "/" "^" "&" "&&" "|" "||")
(all "<-" "<<-" "=" "|>" "->" "->>" "==" "!=" "<" "<=" ">" ">=" "%*%" "%%" "%/%" "%in%" "%x%" "%o%" "%<>%" "%>%" "+" "-" "*" "**" "/" "^" "&" "&&" "|" "||")
;; (t "<-" "<<-" "->" "->>" "%<>%"))
(t "<-" "|>" "->" "%<>%" "<<-"))
(ess-roxy-mode
(comment "<-" "=" "==" "<<-" "->" "->>" "%<>%")))))

(with-eval-after-load 'ess-r-mode
(require 'ess-smart-equals)
(setq ess-smart-equals-extra-ops '(brace paren percent))
(ess-smart-equals-activate))

#+END_SRC

~C-=~ to insert =<-= and then cycle between =<-=, =|>= and =->=:
Expand Down

0 comments on commit 29ea6eb

Please sign in to comment.