There is a way to link to a specific link of code in org babel src block. with org-store-link.

Here is an example:

 ;;; This is comment | line. |
 (describe-char | (point)) ; | comment |
 (message | "hello, world") |

NOTE: The vertical bar (|) is the point positions. I need a way to auto detect current position, whether it is in comment area. If yes, then don't add comment char. If no, then auto add comment char like at the third line.

An advice for elisp or some way else.

;;; auto prefix with comment char when create code ref in src block with
;;; `org-store-link'.
(advice-add 'org-store-link :before #'comment-dwim)
  • This advice seems can work in most cases, but currently not work in ob-clojure src block. weird. Apr 30 '17 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.