pglpm, to orgmode
@pglpm@emacs.ch avatar

Dear #orgmode #ess #rstats community:

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...

Cheers!

EDIT: I found this useful tip in an old org-mailing-list thread: https://list.orgmode.org/4CC40000.3090508@uni-koeln.de/T/#efb9759d0d3a8ab22e391a385608c046a13e90502

>>> 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>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • InstantRegret
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • JUstTest
  • tacticalgear
  • ethstaker
  • provamag3
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • modclub
  • megavids
  • normalnudes
  • Leos
  • lostlight
  • All magazines