瀏覽代碼

Merge branch 'maint'

Nicolas Goaziou 7 年之前
父節點
當前提交
fa56da61a7
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 3 1
      lisp/org.el
  2. 7 3
      testing/lisp/test-org.el

+ 3 - 1
lisp/org.el

@@ -23609,7 +23609,9 @@ depending on context."
 					(skip-chars-forward " \r\t\n"))))
 	    (narrow-to-region (org-element-property :contents-begin element)
 			      contents-end))
-	  (call-interactively #'forward-sentence))))))
+	  ;; End of heading is considered as the end of a sentence.
+	  (let ((sentence-end (concat (sentence-end) "\\|^\\*+ .*$")))
+	    (call-interactively #'forward-sentence)))))))
 
 (define-key org-mode-map "\M-a" 'org-backward-sentence)
 (define-key org-mode-map "\M-e" 'org-forward-sentence)

+ 7 - 3
testing/lisp/test-org.el

@@ -3414,8 +3414,8 @@ SCHEDULED: <2017-05-06 Sat>
    (org-test-with-temp-text "Paragraph 1.<point>\n\nParagraph 2."
      (org-forward-sentence)
      (eobp)))
-  ;; On a headline, stop at the end of the line, unless point is
-  ;; already there.
+  ;; Headlines are considered to be sentences by themselves, even if
+  ;; they do not end with a full stop.
   (should
    (equal
     "* Headline"
@@ -3425,7 +3425,11 @@ SCHEDULED: <2017-05-06 Sat>
   (should
    (org-test-with-temp-text "* Headline<point>\nSentence."
      (org-forward-sentence)
-     (eobp))))
+     (eobp)))
+  (should
+   (org-test-with-temp-text "Sentence.<point>\n\n* Headline\n\nSentence 2."
+     (org-forward-sentence)
+     (and (org-at-heading-p) (eolp)))))
 
 (ert-deftest test-org/backward-sentence ()
   "Test `org-backward-sentence' specifications."