Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Bastien Guerry 2012-07-31 16:14:33 +02:00
commit 5b9cbe9291
2 changed files with 15 additions and 3 deletions

View File

@ -20896,14 +20896,17 @@ width for filling."
;; Elements that may contain `line-break' type objects. ;; Elements that may contain `line-break' type objects.
((paragraph verse-block) ((paragraph verse-block)
(let ((beg (org-element-property :contents-begin element)) (let ((beg (org-element-property :contents-begin element))
(end (org-element-property :contents-end element))) (end (org-element-property :contents-end element))
(type (org-element-type element)))
;; Do nothing if point is at an affiliated keyword or at ;; Do nothing if point is at an affiliated keyword or at
;; verse block markers. ;; verse block markers.
(if (or (< (point) beg) (>= (point) end)) t (if (or (< (point) beg)
(and (eq type 'verse-block) (>= (point) end)))
t
;; At a verse block, first narrow to current "paragraph" ;; At a verse block, first narrow to current "paragraph"
;; and set current element to that paragraph. ;; and set current element to that paragraph.
(save-restriction (save-restriction
(when (eq (org-element-type element) 'verse-block) (when (eq type 'verse-block)
(narrow-to-region beg end) (narrow-to-region beg end)
(save-excursion (save-excursion
(end-of-line) (end-of-line)

View File

@ -143,6 +143,15 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
(let ((fill-column 20)) (let ((fill-column 20))
(org-fill-paragraph) (org-fill-paragraph)
(should (equal (buffer-string) "some \\\\\nlong text")))) (should (equal (buffer-string) "some \\\\\nlong text"))))
;; Special case: fill correctly a paragraph when point is at its
;; very end.
(should
(equal "A B"
(org-test-with-temp-text "A\nB"
(let ((fill-column 20))
(goto-char (point-max))
(org-fill-paragraph)
(buffer-string)))))
;; At a verse block, fill paragraph at point, also preserving line ;; At a verse block, fill paragraph at point, also preserving line
;; breaks. Though, do nothing when point is at the block ;; breaks. Though, do nothing when point is at the block
;; boundaries. ;; boundaries.