summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-10-05 23:21:27 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2012-10-05 23:21:27 (GMT)
commit2c78ca4a563fbc1b62413bfab2626ca9e2a86d5d (patch)
treeeda00930880db20eb18a34de4c869a518be0e1b0
parent78d2bd7edcc28e2f5bd5bcde5f8d47ab09f2f0ed (diff)
parentad99ea914711d75eca03e7fdf3383f275d2ffa3b (diff)
downloadorg-mode-2c78ca4a563fbc1b62413bfab2626ca9e2a86d5d.zip
org-mode-2c78ca4a563fbc1b62413bfab2626ca9e2a86d5d.tar.gz
Merge branch 'maint'
Conflicts: lisp/org-element.el
-rw-r--r--lisp/org-element.el81
-rw-r--r--testing/lisp/test-org-element.el4
2 files changed, 56 insertions, 29 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 7f17579..da17de6 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -509,7 +509,8 @@ Assume point is at the beginning of the block."
(forward-line)
(point)))
(end (save-excursion (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'center-block
(nconc
(list :begin begin
@@ -560,7 +561,8 @@ Assume point is at beginning of drawer."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'drawer
(nconc
(list :begin begin
@@ -617,7 +619,8 @@ Assume point is at beginning of dynamic block."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'dynamic-block
(nconc
(list :begin begin
@@ -674,7 +677,8 @@ Assume point is at the beginning of the footnote definition."
(contents-end (and contents-begin ending))
(end (progn (goto-char ending)
(skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'footnote-definition
(nconc
(list :label label
@@ -925,7 +929,8 @@ Assume point is at beginning of the inline task."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position))))
(inlinetask
(list 'inlinetask
(nconc
@@ -1131,7 +1136,8 @@ Assume point is at the beginning of the list."
(unless (bolp) (forward-line))
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
;; Return value.
(list 'plain-list
(nconc
@@ -1187,7 +1193,8 @@ Assume point is at the beginning of the property drawer."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'property-drawer
(nconc
(list :begin begin
@@ -1237,7 +1244,8 @@ Assume point is at the beginning of the block."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'quote-block
(nconc
(list :begin begin
@@ -1321,8 +1329,9 @@ Assume point is at the beginning of the block."
(pos-before-blank (progn (goto-char block-end-line)
(forward-line)
(point)))
- (end (progn (org-skip-whitespace)
- (if (eobp) (point) (point-at-bol)))))
+ (end (progn (skip-chars-forward " \r\t\n" limit)
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'special-block
(nconc
(list :type type
@@ -1376,7 +1385,8 @@ keywords."
(begin (car affiliated))
(pos-before-blank (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'babel-call
(nconc
(list :begin begin
@@ -1421,7 +1431,8 @@ as keywords."
(status (if time 'closed 'running))
(post-blank (let ((before-blank (progn (forward-line) (point))))
(skip-chars-forward " \r\t\n" limit)
- (unless (eobp) (beginning-of-line))
+ (skip-chars-backward " \t")
+ (unless (bolp) (end-of-line))
(count-lines before-blank (point))))
(end (point)))
(list 'clock
@@ -1481,7 +1492,8 @@ Assume point is at comment beginning."
(point)))
(end (progn (goto-char com-end)
(skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'comment
(nconc
(list :begin begin
@@ -1525,7 +1537,8 @@ Assume point is at comment block beginning."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position))))
(value (buffer-substring-no-properties
contents-begin contents-end)))
(list 'comment-block
@@ -1598,7 +1611,8 @@ containing `:begin', `:end', `:number-lines', `:preserve-indent',
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'example-block
(nconc
(list :begin begin
@@ -1657,7 +1671,8 @@ Assume point is at export-block beginning."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position))))
(value (buffer-substring-no-properties contents-begin
contents-end)))
(list 'export-block
@@ -1709,7 +1724,8 @@ Assume point is at the beginning of the fixed-width area."
(forward-line))
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'fixed-width
(nconc
(list :begin begin
@@ -1741,7 +1757,8 @@ containing `:begin', `:end' and `:post-blank' keywords."
(let ((begin (car affiliated))
(post-hr (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'horizontal-rule
(nconc
(list :begin begin
@@ -1777,7 +1794,8 @@ keywords."
(match-end 0) (point-at-eol))))
(pos-before-blank (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'keyword
(nconc
(list :key key
@@ -1823,7 +1841,8 @@ Assume point is at the beginning of the latex environment."
(point)))
(value (buffer-substring-no-properties code-begin code-end))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'latex-environment
(nconc
(list :begin begin
@@ -1953,7 +1972,8 @@ Assume point is at the beginning of the paragraph."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'paragraph
(nconc
(list :begin begin
@@ -1984,7 +2004,8 @@ and `:post-blank' keywords."
(begin (point))
(post-blank (let ((before-blank (progn (forward-line) (point))))
(skip-chars-forward " \r\t\n" limit)
- (unless (eobp) (beginning-of-line))
+ (skip-chars-backward " \t")
+ (unless (bolp) (end-of-line))
(count-lines before-blank (point))))
(end (point))
closed deadline scheduled)
@@ -2121,7 +2142,8 @@ Assume point is at the beginning of the block."
(point)))
;; Get position after ending blank lines.
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'src-block
(nconc
(list :language language
@@ -2149,7 +2171,6 @@ CONTENTS is nil."
(params (org-element-property :parameters src-block))
(value (let ((val (org-element-property :value src-block)))
(cond
-
(org-src-preserve-indentation val)
((zerop org-edit-src-content-indentation)
(org-remove-indentation val))
@@ -2186,9 +2207,11 @@ Assume point is at the beginning of the table."
(let* ((case-fold-search t)
(table-begin (point))
(type (if (org-at-table.el-p) 'table.el 'org))
- (keywords (org-element--collect-affiliated-keywords))
(begin (car affiliated))
- (table-end (goto-char (marker-position (org-table-end t))))
+ (table-end
+ (if (re-search-forward org-table-any-border-regexp limit 'm)
+ (goto-char (match-beginning 0))
+ (point)))
(tblfm (let (acc)
(while (looking-at "[ \t]*#\\+TBLFM: +\\(.*\\)[ \t]*$")
(push (org-match-string-no-properties 1) acc)
@@ -2196,7 +2219,8 @@ Assume point is at the beginning of the table."
acc))
(pos-before-blank (point))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'table
(nconc
(list :begin begin
@@ -2295,7 +2319,8 @@ Assume point is at beginning of the block."
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
- (if (eobp) (point) (point-at-bol)))))
+ (skip-chars-backward " \t")
+ (if (bolp) (point) (line-end-position)))))
(list 'verse-block
(nconc
(list :begin begin
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index e0f6636..b3b7e4c 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1613,7 +1613,9 @@ Outside list"
(length (org-element-property
:tblfm
(org-element-map
- (org-element-parse-buffer) 'table 'identity nil t)))))))
+ (org-element-parse-buffer) 'table 'identity nil t))))))
+ ;; Do not error when parsing a table with trailing white spaces.
+ (should (org-test-with-temp-text "| a |\n " (org-element-parse-buffer))))
;;;; Table Cell