On 2016-03-19 at 13:20, Eric S Fraga <e.fr...@ucl.ac.uk> wrote:
> On Saturday, 19 Mar 2016 at 12:44, John Kitchin wrote:
>> I noticed that you try to uncomment a region in a src block a # gets
>> inserted!
>>
>> #+BEGIN_SRC emacs-lisp
>> ; test
>> #+END_SRC
>>
>>
>> If you select ; test and run uncomment-region you get this:
>>
>> #+BEGIN_SRC emacs-lisp
>> # ; test
>> #+END_SRC
>>
>> It also does that in Python. Any ideas why?
>
> Because you're in org mode, not emacs-lisp or python?  If you want to
> comment/uncomment codes within a src block, my guess is you would need
> to open up the blocks (C-c ') and then comment/uncomment...

https://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00318.html

#+BEGIN_SRC emacs-lisp :results none
    ;; allow comment region in the code edit buffer (according to language)
    (defun my-org-comment-dwim (&optional arg)
      (interactive "P")
      (or (org-babel-do-key-sequence-in-edit-buffer (kbd "M-;"))
          (comment-dwim arg)))

    ;; make `C-c C-v C-x M-;' more convenient
    (define-key org-mode-map
      (kbd "M-;") 'my-org-comment-dwim)
#+END_SRC

  -k.

Reply via email to