Merge branch 'maint'

Conflicts:
	lisp/org-element.el
This commit is contained in:
Nicolas Goaziou 2012-10-06 01:21:27 +02:00
commit 2c78ca4a56
2 changed files with 56 additions and 29 deletions

View File

@ -509,7 +509,8 @@ Assume point is at the beginning of the block."
(forward-line) (forward-line)
(point))) (point)))
(end (save-excursion (skip-chars-forward " \r\t\n" limit) (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 (list 'center-block
(nconc (nconc
(list :begin begin (list :begin begin
@ -560,7 +561,8 @@ Assume point is at beginning of drawer."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'drawer
(nconc (nconc
(list :begin begin (list :begin begin
@ -617,7 +619,8 @@ Assume point is at beginning of dynamic block."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'dynamic-block
(nconc (nconc
(list :begin begin (list :begin begin
@ -674,7 +677,8 @@ Assume point is at the beginning of the footnote definition."
(contents-end (and contents-begin ending)) (contents-end (and contents-begin ending))
(end (progn (goto-char ending) (end (progn (goto-char ending)
(skip-chars-forward " \r\t\n" limit) (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 (list 'footnote-definition
(nconc (nconc
(list :label label (list :label label
@ -925,7 +929,8 @@ Assume point is at beginning of the inline task."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (inlinetask
(list 'inlinetask (list 'inlinetask
(nconc (nconc
@ -1131,7 +1136,8 @@ Assume point is at the beginning of the list."
(unless (bolp) (forward-line)) (unless (bolp) (forward-line))
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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. ;; Return value.
(list 'plain-list (list 'plain-list
(nconc (nconc
@ -1187,7 +1193,8 @@ Assume point is at the beginning of the property drawer."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'property-drawer
(nconc (nconc
(list :begin begin (list :begin begin
@ -1237,7 +1244,8 @@ Assume point is at the beginning of the block."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'quote-block
(nconc (nconc
(list :begin begin (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) (pos-before-blank (progn (goto-char block-end-line)
(forward-line) (forward-line)
(point))) (point)))
(end (progn (org-skip-whitespace) (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 'special-block (list 'special-block
(nconc (nconc
(list :type type (list :type type
@ -1376,7 +1385,8 @@ keywords."
(begin (car affiliated)) (begin (car affiliated))
(pos-before-blank (progn (forward-line) (point))) (pos-before-blank (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'babel-call
(nconc (nconc
(list :begin begin (list :begin begin
@ -1421,7 +1431,8 @@ as keywords."
(status (if time 'closed 'running)) (status (if time 'closed 'running))
(post-blank (let ((before-blank (progn (forward-line) (point)))) (post-blank (let ((before-blank (progn (forward-line) (point))))
(skip-chars-forward " \r\t\n" limit) (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)))) (count-lines before-blank (point))))
(end (point))) (end (point)))
(list 'clock (list 'clock
@ -1481,7 +1492,8 @@ Assume point is at comment beginning."
(point))) (point)))
(end (progn (goto-char com-end) (end (progn (goto-char com-end)
(skip-chars-forward " \r\t\n" limit) (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 (list 'comment
(nconc (nconc
(list :begin begin (list :begin begin
@ -1525,7 +1537,8 @@ Assume point is at comment block beginning."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (value (buffer-substring-no-properties
contents-begin contents-end))) contents-begin contents-end)))
(list 'comment-block (list 'comment-block
@ -1598,7 +1611,8 @@ containing `:begin', `:end', `:number-lines', `:preserve-indent',
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'example-block
(nconc (nconc
(list :begin begin (list :begin begin
@ -1657,7 +1671,8 @@ Assume point is at export-block beginning."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (value (buffer-substring-no-properties contents-begin
contents-end))) contents-end)))
(list 'export-block (list 'export-block
@ -1709,7 +1724,8 @@ Assume point is at the beginning of the fixed-width area."
(forward-line)) (forward-line))
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'fixed-width
(nconc (nconc
(list :begin begin (list :begin begin
@ -1741,7 +1757,8 @@ containing `:begin', `:end' and `:post-blank' keywords."
(let ((begin (car affiliated)) (let ((begin (car affiliated))
(post-hr (progn (forward-line) (point))) (post-hr (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'horizontal-rule
(nconc (nconc
(list :begin begin (list :begin begin
@ -1777,7 +1794,8 @@ keywords."
(match-end 0) (point-at-eol)))) (match-end 0) (point-at-eol))))
(pos-before-blank (progn (forward-line) (point))) (pos-before-blank (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'keyword
(nconc (nconc
(list :key key (list :key key
@ -1823,7 +1841,8 @@ Assume point is at the beginning of the latex environment."
(point))) (point)))
(value (buffer-substring-no-properties code-begin code-end)) (value (buffer-substring-no-properties code-begin code-end))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'latex-environment
(nconc (nconc
(list :begin begin (list :begin begin
@ -1953,7 +1972,8 @@ Assume point is at the beginning of the paragraph."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'paragraph
(nconc (nconc
(list :begin begin (list :begin begin
@ -1984,7 +2004,8 @@ and `:post-blank' keywords."
(begin (point)) (begin (point))
(post-blank (let ((before-blank (progn (forward-line) (point)))) (post-blank (let ((before-blank (progn (forward-line) (point))))
(skip-chars-forward " \r\t\n" limit) (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)))) (count-lines before-blank (point))))
(end (point)) (end (point))
closed deadline scheduled) closed deadline scheduled)
@ -2121,7 +2142,8 @@ Assume point is at the beginning of the block."
(point))) (point)))
;; Get position after ending blank lines. ;; Get position after ending blank lines.
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'src-block
(nconc (nconc
(list :language language (list :language language
@ -2149,7 +2171,6 @@ CONTENTS is nil."
(params (org-element-property :parameters src-block)) (params (org-element-property :parameters src-block))
(value (let ((val (org-element-property :value src-block))) (value (let ((val (org-element-property :value src-block)))
(cond (cond
(org-src-preserve-indentation val) (org-src-preserve-indentation val)
((zerop org-edit-src-content-indentation) ((zerop org-edit-src-content-indentation)
(org-remove-indentation val)) (org-remove-indentation val))
@ -2186,9 +2207,11 @@ Assume point is at the beginning of the table."
(let* ((case-fold-search t) (let* ((case-fold-search t)
(table-begin (point)) (table-begin (point))
(type (if (org-at-table.el-p) 'table.el 'org)) (type (if (org-at-table.el-p) 'table.el 'org))
(keywords (org-element--collect-affiliated-keywords))
(begin (car affiliated)) (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) (tblfm (let (acc)
(while (looking-at "[ \t]*#\\+TBLFM: +\\(.*\\)[ \t]*$") (while (looking-at "[ \t]*#\\+TBLFM: +\\(.*\\)[ \t]*$")
(push (org-match-string-no-properties 1) acc) (push (org-match-string-no-properties 1) acc)
@ -2196,7 +2219,8 @@ Assume point is at the beginning of the table."
acc)) acc))
(pos-before-blank (point)) (pos-before-blank (point))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'table
(nconc (nconc
(list :begin begin (list :begin begin
@ -2295,7 +2319,8 @@ Assume point is at beginning of the block."
(forward-line) (forward-line)
(point))) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (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 (list 'verse-block
(nconc (nconc
(list :begin begin (list :begin begin

View File

@ -1613,7 +1613,9 @@ Outside list"
(length (org-element-property (length (org-element-property
:tblfm :tblfm
(org-element-map (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 ;;;; Table Cell