summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-10-29 00:00:32 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-10-29 00:00:32 +0200
commite8b4eeb4828d21ba5495b5898d6ca4d565fe1560 (patch)
treec571e3b1529387695f6f9f14f44cfc8743045cba
parent4f9ec1adeb980a309aa9b6a643cff8fcfbf0f275 (diff)
downloadorg-mode-e8b4eeb4828d21ba5495b5898d6ca4d565fe1560.tar.gz
Fix `org-return' on non-keyword
* lisp/org.el (org-return): Recognize non-keywords and split text accordingly. * testing/lisp/test-org.el (test-org/return): Add test. Reported-by: Samuel Wales <samologist@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/109929>
-rw-r--r--lisp/org.el8
-rw-r--r--testing/lisp/test-org.el5
2 files changed, 8 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 0108c68..2feb163 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21369,7 +21369,8 @@ object (e.g., within a comment). In these case, you need to use
;; Insert newline in heading, but preserve tags.
((and (not (bolp))
(save-excursion (beginning-of-line)
- (looking-at org-complex-heading-regexp)))
+ (let ((case-fold-search nil))
+ (looking-at org-complex-heading-regexp))))
;; At headline. Split line. However, if point is on keyword,
;; priority cookie or tags, do not break any of them: add
;; a newline after the headline instead.
@@ -21377,10 +21378,7 @@ object (e.g., within a comment). In these case, you need to use
(save-excursion (goto-char (match-beginning 5))
(current-column))))
(string
- (when (and (match-end 4)
- (>= (point)
- (or (match-end 3) (match-end 2) (1+ (match-end 1))))
- (<= (point) (match-end 4)))
+ (when (and (match-end 4) (org-point-in-group (point) 4))
(delete-and-extract-region (point) (match-end 4)))))
;; Adjust tag alignment.
(cond
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index f8fa8b8..081a6c4 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1092,6 +1092,11 @@
(org-test-with-temp-text "* TODO<point> [#B] H :tag:"
(org-return)
(buffer-string))))
+ (should ;TODO are case-sensitive
+ (equal "* \nTodo"
+ (org-test-with-temp-text "* <point>Todo"
+ (org-return)
+ (buffer-string))))
;; At headline text, break headline text but preserve tags.
(should
(equal "* TODO [#B] foo :tag:\nbar"