Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
5e7ffbe1d4
|
@ -140,7 +140,7 @@
|
||||||
;; Horizontal rules.
|
;; Horizontal rules.
|
||||||
"-\\{5,\\}[ \t]*$" "\\|"
|
"-\\{5,\\}[ \t]*$" "\\|"
|
||||||
;; LaTeX environments.
|
;; LaTeX environments.
|
||||||
"\\\\\\(begin\\|end\\)" "\\|"
|
"\\\\begin{\\([A-Za-z0-9]+\\*?\\)}" "\\|"
|
||||||
;; Planning and Clock lines.
|
;; Planning and Clock lines.
|
||||||
(regexp-opt (list org-scheduled-string
|
(regexp-opt (list org-scheduled-string
|
||||||
org-deadline-string
|
org-deadline-string
|
||||||
|
@ -1700,7 +1700,7 @@ Assume point is at the beginning of the latex environment."
|
||||||
(code-begin (point))
|
(code-begin (point))
|
||||||
(keywords (org-element--collect-affiliated-keywords))
|
(keywords (org-element--collect-affiliated-keywords))
|
||||||
(begin (car keywords))
|
(begin (car keywords))
|
||||||
(env (progn (looking-at "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}")
|
(env (progn (looking-at "^[ \t]*\\\\begin{\\([A-Za-z0-9]+\\*?\\)}")
|
||||||
(regexp-quote (match-string 1))))
|
(regexp-quote (match-string 1))))
|
||||||
(code-end
|
(code-end
|
||||||
(progn (re-search-forward (format "^[ \t]*\\\\end{%s}" env) limit t)
|
(progn (re-search-forward (format "^[ \t]*\\\\end{%s}" env) limit t)
|
||||||
|
@ -1773,6 +1773,15 @@ Assume point is at the beginning of the paragraph."
|
||||||
(concat "^[ \t]*#\\+END_"
|
(concat "^[ \t]*#\\+END_"
|
||||||
(match-string 1))
|
(match-string 1))
|
||||||
limit t))))
|
limit t))))
|
||||||
|
;; Skip incomplete latex environments.
|
||||||
|
((save-excursion
|
||||||
|
(beginning-of-line)
|
||||||
|
(looking-at "^[ \t]*\\\\begin{\\([A-Za-z0-9]+\\*?\\)}"))
|
||||||
|
(not (save-excursion
|
||||||
|
(re-search-forward
|
||||||
|
(format "^[ \t]*\\\\end{%s}"
|
||||||
|
(match-string 1))
|
||||||
|
limit t))))
|
||||||
;; Skip ill-formed keywords.
|
;; Skip ill-formed keywords.
|
||||||
((not (save-excursion
|
((not (save-excursion
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
|
@ -2346,7 +2355,8 @@ LIMIT bounds the search.
|
||||||
Return value is a cons cell whose CAR is `entity' or
|
Return value is a cons cell whose CAR is `entity' or
|
||||||
`latex-fragment' and CDR is beginning position."
|
`latex-fragment' and CDR is beginning position."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((matchers (plist-get org-format-latex-options :matchers))
|
(let ((matchers
|
||||||
|
(remove "begin" (plist-get org-format-latex-options :matchers)))
|
||||||
;; ENTITY-RE matches both LaTeX commands and Org entities.
|
;; ENTITY-RE matches both LaTeX commands and Org entities.
|
||||||
(entity-re
|
(entity-re
|
||||||
"\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]]\\)"))
|
"\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]]\\)"))
|
||||||
|
|
46
lisp/org.el
46
lisp/org.el
|
@ -21000,16 +21000,17 @@ hierarchy of headlines by UP levels before marking the subtree."
|
||||||
'fill-nobreak-predicate
|
'fill-nobreak-predicate
|
||||||
(org-uniquify
|
(org-uniquify
|
||||||
(append fill-nobreak-predicate
|
(append fill-nobreak-predicate
|
||||||
'(org-fill-item-nobreak-p org-fill-line-break-nobreak-p)))))
|
'(org-fill-paragraph-separate-nobreak-p
|
||||||
|
org-fill-line-break-nobreak-p)))))
|
||||||
(org-set-local 'normal-auto-fill-function 'org-auto-fill-function)
|
(org-set-local 'normal-auto-fill-function 'org-auto-fill-function)
|
||||||
(org-set-local 'align-mode-rules-list
|
(org-set-local 'align-mode-rules-list
|
||||||
'((org-in-buffer-settings
|
'((org-in-buffer-settings
|
||||||
(regexp . "^#\\+[A-Z_]+:\\(\\s-*\\)\\S-+")
|
(regexp . "^#\\+[A-Z_]+:\\(\\s-*\\)\\S-+")
|
||||||
(modes . '(org-mode))))))
|
(modes . '(org-mode))))))
|
||||||
|
|
||||||
(defun org-fill-item-nobreak-p ()
|
(defun org-fill-paragraph-separate-nobreak-p ()
|
||||||
"Non-nil when a line break at point would insert a new item."
|
"Non-nil when a line break at point would insert a new item."
|
||||||
(and (looking-at (org-item-re)) (org-list-in-valid-context-p)))
|
(looking-at (substring org-element-paragraph-separate 1)))
|
||||||
|
|
||||||
(defun org-fill-line-break-nobreak-p ()
|
(defun org-fill-line-break-nobreak-p ()
|
||||||
"Non-nil when a line break at point would create an Org line break."
|
"Non-nil when a line break at point would create an Org line break."
|
||||||
|
@ -21054,7 +21055,7 @@ meant to be filled."
|
||||||
? ))
|
? ))
|
||||||
((looking-at "\\s-+") (match-string 0))
|
((looking-at "\\s-+") (match-string 0))
|
||||||
(t ""))))
|
(t ""))))
|
||||||
((comment-block verse-block)
|
(comment-block
|
||||||
;; Only fill contents if P is within block boundaries.
|
;; Only fill contents if P is within block boundaries.
|
||||||
(let* ((cbeg (save-excursion (goto-char post-affiliated)
|
(let* ((cbeg (save-excursion (goto-char post-affiliated)
|
||||||
(forward-line)
|
(forward-line)
|
||||||
|
@ -21073,8 +21074,8 @@ meant to be filled."
|
||||||
"Fill element at point, when applicable.
|
"Fill element at point, when applicable.
|
||||||
|
|
||||||
This function only applies to comment blocks, comments, example
|
This function only applies to comment blocks, comments, example
|
||||||
blocks, paragraphs and verse blocks. Also, as a special case,
|
blocks and paragraphs. Also, as a special case, re-align table
|
||||||
re-align table when point is at one.
|
when point is at one.
|
||||||
|
|
||||||
If JUSTIFY is non-nil (interactively, with prefix argument),
|
If JUSTIFY is non-nil (interactively, with prefix argument),
|
||||||
justify as well. If `sentence-end-double-space' is non-nil, then
|
justify as well. If `sentence-end-double-space' is non-nil, then
|
||||||
|
@ -21113,41 +21114,24 @@ a footnote definition, try to fill the first paragraph within."
|
||||||
(org-table-align))
|
(org-table-align))
|
||||||
t)
|
t)
|
||||||
;; Elements that may contain `line-break' type objects.
|
;; Elements that may contain `line-break' type objects.
|
||||||
((paragraph verse-block)
|
(paragraph
|
||||||
(let ((beg (max (point-min)
|
(let ((beg (max (point-min)
|
||||||
(org-element-property :contents-begin element)))
|
(org-element-property :contents-begin element)))
|
||||||
(end (min (point-max)
|
(end (min (point-max)
|
||||||
(org-element-property :contents-end element)))
|
(org-element-property :contents-end element)))
|
||||||
(type (org-element-type 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.
|
||||||
;; verse block markers.
|
(if (< (point) beg) t
|
||||||
(if (or (< (point) beg)
|
(when (derived-mode-p 'message-mode)
|
||||||
(and (eq type 'verse-block) (>= (point) end)))
|
;; In `message-mode', do not fill following
|
||||||
t
|
;; citation in current paragraph nor text before
|
||||||
;; In verse blocks and `message-mode', boundaries of
|
;; message body.
|
||||||
;; region to fill have to be tweaked.
|
|
||||||
(cond
|
|
||||||
;; At a verse block, fill current "paragraph", that
|
|
||||||
;; is part of text separated by blank lines.
|
|
||||||
((eq type 'verse-block)
|
|
||||||
(save-excursion
|
|
||||||
(when (looking-at "[ \t]*$")
|
|
||||||
(skip-chars-backward " \r\t\n" beg))
|
|
||||||
(when (re-search-backward "^[ \t]*$" beg t)
|
|
||||||
(forward-line)
|
|
||||||
(setq beg (point))))
|
|
||||||
(when (save-excursion (re-search-forward "^[ \t]*$" end t))
|
|
||||||
(setq end (match-beginning 0))))
|
|
||||||
;; In `message-mode', do not fill following citation
|
|
||||||
;; in current paragraph nor text before message
|
|
||||||
;; body.
|
|
||||||
((derived-mode-p 'message-mode)
|
|
||||||
(let ((body-start (save-excursion (message-goto-body))))
|
(let ((body-start (save-excursion (message-goto-body))))
|
||||||
(when body-start (setq beg (max body-start beg))))
|
(when body-start (setq beg (max body-start beg))))
|
||||||
(when (save-excursion
|
(when (save-excursion
|
||||||
(re-search-forward
|
(re-search-forward
|
||||||
(concat "^" message-cite-prefix-regexp) end t))
|
(concat "^" message-cite-prefix-regexp) end t))
|
||||||
(setq end (match-beginning 0)))))
|
(setq end (match-beginning 0))))
|
||||||
;; Fill paragraph, taking line breaks into consideration.
|
;; Fill paragraph, taking line breaks into consideration.
|
||||||
;; For that, slice the paragraph using line breaks as
|
;; For that, slice the paragraph using line breaks as
|
||||||
;; separators, and fill the parts in reverse order to
|
;; separators, and fill the parts in reverse order to
|
||||||
|
|
|
@ -182,15 +182,6 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
|
||||||
(let ((fill-column 20))
|
(let ((fill-column 20))
|
||||||
(org-fill-paragraph)
|
(org-fill-paragraph)
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
;; At a verse block, fill paragraph at point, also preserving line
|
|
||||||
;; breaks. Though, do nothing when point is at the block
|
|
||||||
;; boundaries.
|
|
||||||
(org-test-with-temp-text "#+BEGIN_VERSE\nSome \\\\\nlong\ntext\n#+END_VERSE"
|
|
||||||
(forward-line)
|
|
||||||
(let ((fill-column 20))
|
|
||||||
(org-fill-paragraph)
|
|
||||||
(should (equal (buffer-string)
|
|
||||||
"#+BEGIN_VERSE\nSome \\\\\nlong text\n#+END_VERSE"))))
|
|
||||||
(org-test-with-temp-text "#+BEGIN_VERSE\nSome \\\\\nlong\ntext\n#+END_VERSE"
|
(org-test-with-temp-text "#+BEGIN_VERSE\nSome \\\\\nlong\ntext\n#+END_VERSE"
|
||||||
(let ((fill-column 20))
|
(let ((fill-column 20))
|
||||||
(org-fill-paragraph)
|
(org-fill-paragraph)
|
||||||
|
@ -244,10 +235,10 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
(org-auto-fill-function)
|
(org-auto-fill-function)
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
;; Verse and comment block: auto fill contents.
|
;; Comment block: auto fill contents.
|
||||||
(should
|
(should
|
||||||
(equal "#+BEGIN_VERSE\n12345\n7890\n#+END_VERSE"
|
(equal "#+BEGIN_COMMENT\n12345\n7890\n#+END_COMMENT"
|
||||||
(org-test-with-temp-text "#+BEGIN_VERSE\n12345 7890\n#+END_VERSE"
|
(org-test-with-temp-text "#+BEGIN_COMMENT\n12345 7890\n#+END_COMMENT"
|
||||||
(let ((fill-column 5))
|
(let ((fill-column 5))
|
||||||
(forward-line)
|
(forward-line)
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
|
|
Loading…
Reference in New Issue