summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-08-24 21:14:26 +0200
committerBastien Guerry <bzg@altern.org>2012-08-24 21:58:48 +0200
commit53334042b5492777d3680a858041d5c8c8c6f9b6 (patch)
treeaf78957ccb737f510f516c1dd72b301a87286c2b
parent961f994b14d5f118d2263aabb48eab5795d7dcb5 (diff)
downloadorg-mode-53334042b5492777d3680a858041d5c8c8c6f9b6.tar.gz
Fix bug in comment-dwin when at a keyword
* lisp/org.el (org-mode): Set back comment-start-skip so comment-dwin can tell a keyword from a comment. * testing/lisp/test-org.el: Add test.
-rw-r--r--lisp/org.el1
-rw-r--r--testing/lisp/test-org.el8
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el
index a6aef6e..7165937 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5091,6 +5091,7 @@ The following commands are available:
;; Comments
(org-set-local 'comment-use-syntax nil)
(org-set-local 'comment-start "# ")
+ (org-set-local 'comment-start-skip "^\\s-*#\\(?: \\|$\\)")
(org-set-local 'comment-insert-comment-function 'org-insert-comment)
(org-set-local 'comment-region-function 'org-comment-or-uncomment-region)
(org-set-local 'uncomment-region-function 'org-comment-or-uncomment-region)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index a289cbf..fdfd4ca 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -332,7 +332,13 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
(push-mark (point) t t)
(goto-char (point-max))
(call-interactively 'comment-dwim)
- (buffer-string))))))
+ (buffer-string)))))
+ ;; In front of a keyword without region, insert a new comment.
+ (should
+ (equal "# \n#+KEYWORD: value"
+ (org-test-with-temp-text "#+KEYWORD: value"
+ (progn (call-interactively 'comment-dwim)
+ (buffer-string))))))