Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-09-12 09:02:43 +02:00
commit c59cb987eb
2 changed files with 33 additions and 16 deletions

View File

@ -23601,23 +23601,28 @@ depending on context."
This will call `forward-sentence' or `org-table-end-of-field',
depending on context."
(interactive)
(let* ((element (org-element-at-point))
(contents-end (org-element-property :contents-end element))
(table (org-element-lineage element '(table) t)))
(if (and table
(>= (point) (org-element-property :contents-begin table))
(< (point) contents-end))
(call-interactively #'org-table-end-of-field)
(if (and (org-at-heading-p)
(save-restriction (skip-chars-forward " \t") (not (eolp))))
(save-restriction
(when (and contents-end
(> (point-max) contents-end)
;; Skip blank lines between elements.
(< (org-element-property :end element)
(save-excursion (goto-char contents-end)
(skip-chars-forward " \r\t\n"))))
(narrow-to-region (org-element-property :contents-begin element)
contents-end))
(call-interactively #'forward-sentence)))))
(narrow-to-region (line-beginning-position) (line-end-position))
(call-interactively #'forward-sentence))
(let* ((element (org-element-at-point))
(contents-end (org-element-property :contents-end element))
(table (org-element-lineage element '(table) t)))
(if (and table
(>= (point) (org-element-property :contents-begin table))
(< (point) contents-end))
(call-interactively #'org-table-end-of-field)
(save-restriction
(when (and contents-end
(> (point-max) contents-end)
;; Skip blank lines between elements.
(< (org-element-property :end element)
(save-excursion (goto-char contents-end)
(skip-chars-forward " \r\t\n"))))
(narrow-to-region (org-element-property :contents-begin element)
contents-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)

View File

@ -3412,6 +3412,18 @@ SCHEDULED: <2017-05-06 Sat>
;; on blank lines in-between.
(should
(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.
(should
(equal
"* Headline"
(org-test-with-temp-text "* <point>Headline\nSentence."
(org-forward-sentence)
(buffer-substring-no-properties (line-beginning-position) (point)))))
(should
(org-test-with-temp-text "* Headline<point>\nSentence."
(org-forward-sentence)
(eobp))))