I've started taking advantage of Emac's org-mode with R code snippets. So nifty!
One thing I miss from ESS-mode is the underscore key "_" that produces the assignment operator "<-". Do you know any way of having this functionality within R code blocks in an org document?
A search on stackexchange and the web didn't return very much, or only answers from 10 years ago...
>>> or some keybindings (e.g. for "<-") inside<br></br>>>> an R source code block.<br></br><br></br>This one can be done with<br></br><br></br> (defun dan/org-underscore-command ()<br></br> (interactive)<br></br> (or (org-babel-do-key-sequence-in-edit-buffer "_")<br></br> (org-self-insert-command 1)))<br></br><br></br> (define-key org-mode-map "_" 'dan/org-underscore-command)<br></br><br></br>And another one that you may like is for commenting code:<br></br><br></br> (defun dan/org-comment-dwim (&optional arg)<br></br> (interactive "P")<br></br> (or (org-babel-do-key-sequence-in-edit-buffer "M-;")<br></br> (comment-dwim arg)))<br></br><br></br> (define-key org-mode-map "M-;" 'dan/org-comment-dwim)<br></br><br></br>