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.
This commit is contained in:
Nicolas Goaziou 2012-08-24 21:14:26 +02:00 committed by Bastien Guerry
parent 961f994b14
commit 53334042b5
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -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))))))