summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-04-06 22:10:45 -0400
committerKyle Meyer <kyle@kyleam.com>2015-04-06 22:12:53 -0400
commit3a25a46254d7bea2c40f1f63b9cc873c934bc160 (patch)
tree4f6a9817a6af80509c6cd48101886f2aa5310482
parent396f7b1213ce6ca9db00e4b3624460f289471a86 (diff)
downloademacs.d-3a25a46254d7bea2c40f1f63b9cc873c934bc160.tar.gz
Add smart key for dplyr pipe
-rw-r--r--lisp/init-ess.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/init-ess.el b/lisp/init-ess.el
index e2edaf9..fb6376a 100644
--- a/lisp/init-ess.el
+++ b/lisp/init-ess.el
@@ -21,4 +21,21 @@
(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode))
+(defvar km/ess-dplry-pipe-key "|")
+
+(defun km/ess-insert-dplyr-pipe ()
+ "Insert `km/ess-dplry-pipe' using `ess-smart-S-assign'.
+Based on instructions in `ess-smart-S-assign-key', I didn't think
+this would work, but it seems to so far."
+ (interactive)
+ (let ((ess-S-assign " %>% ")
+ (ess-smart-S-assign-key km/ess-dplry-pipe-key))
+ (call-interactively #'ess-smart-S-assign)))
+
+(after 'ess-mode
+ (define-key ess-mode-map "|" 'km/ess-insert-dplyr-pipe))
+
+(after 'ess-inf
+ (define-key inferior-ess-mode-map "|" 'km/ess-insert-dplyr-pipe))
+
(provide 'init-ess)