smart-comment icon indicating copy to clipboard operation
smart-comment copied to clipboard

org-mode support?

Open zeltak opened this issue 9 years ago • 6 comments

Hi

thx for this cool package!

Was wondering if you would consider support for smart commenting in org-mode code blocks (comment all block, comment line etc(?

thx again!

Z

zeltak avatar Mar 23 '16 17:03 zeltak

Hello.

You're very welcome :smile: I am not sure if I completely understand. smart-comment should support org-mode. It will insert # as a comment character which is what org-mode uses.

If you want the correct commenting for code in a code block I think you will have to use C-c ' (org-edit-special). This will edit the code block in the correct major mode.

If there is a better way let me know!

paldepind avatar Mar 23 '16 18:03 paldepind

Thx for the quick reply :)

sorry for not explaining correctly. im more interested in commenting inside org-mode code blocks. it does work perfectly in the normal org buffer. for example if i create a orgmode lisp code block like this

#+BEGIN_SRC emacs-lisp :results none
bind ("M-;" . smart-comment)
(add-to-list 'load-path "~/emacs.d")
(require 'smart-comment)
(global-set-key (kbd "M-;") 'smart-comment)
#+END_SRC

and i stand on the first line (bind) and issue smart comment it dosent comment the line but adds the comment at the end of the line for some reason (bug?).

also would be great to add an option with a modifier to comment whole block (is that possible?)

finally not related to org, would be cool to add an option to duplicate line and comment above line

thx so much again for this very nifty tool :)

best

Z

zeltak avatar Mar 24 '16 08:03 zeltak

@zeltak If you don't already have it, you might find expand-region handy. I have it bound to M-2, so it's right above M-w, which is handy for copying. Also I can put the cursor on the begin_src line, hit M-2 a couple of times, then M-; to comment the block.

alphapapa avatar Apr 09 '16 04:04 alphapapa

thx alphapapa

yeah i have been using it but thats a good tip, and generally your packages kick ass ;-)

best

Z

zeltak avatar Apr 09 '16 05:04 zeltak

@alphapapa I agree. expand-region has er/mark-org-code-block. I think using that is best.

paldepind avatar Apr 09 '16 06:04 paldepind

@paldepind I didn't realize it had that function. Always something new to learn about Emacs stuff. :)

alphapapa avatar Apr 11 '16 07:04 alphapapa