diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-10-15 12:31:25 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-10-15 12:31:25 +0200 |
commit | 21c6148bbe60c278abfb0f035c15c030ac0582c6 (patch) | |
tree | 6e41fbe37c444089556769a81cf7d55f15afa1e6 | |
parent | 8d2f0a441174c703ed0ed570e2f0eaf0da5d6aeb (diff) | |
download | org-mode-21c6148bbe60c278abfb0f035c15c030ac0582c6.tar.gz |
Handle comments in source blocks with `comment-line'
* lisp/org.el (org-comment-or-uncomment-region): Caller is not
necessarily `comment-dwim'. Also handle `comment-line'.
Reported-by: Xebar Saram <zeltakc@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109809>
-rw-r--r-- | lisp/org.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 732f7e0..1f0680a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -23526,7 +23526,13 @@ strictly within a source block, use appropriate comment syntax." (skip-chars-backward " \r\t\n") (line-beginning-position)) end))) - (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim)) + ;; Translate region boundaries for the Org buffer to the source + ;; buffer. + (let ((offset (- end beg))) + (save-excursion + (goto-char beg) + (org-babel-do-in-edit-buffer + (comment-or-uncomment-region (point) (+ offset (point)))))) (save-restriction ;; Restrict region (narrow-to-region (save-excursion (goto-char beg) |