summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-01-05 17:29:06 +0100
committerBastien Guerry <bzg@altern.org>2013-01-05 17:29:06 +0100
commit8d7990acfa00af585d7957a00b2327da9b707411 (patch)
treee8746d442d4bc1d64a6a943280faa6541b07f4fc
parent5c2dd988a502f71a35b8bdcd77e03883fffc47a4 (diff)
parentcad0b388ddc1b1c2360329d08ea13b8c9decbdff (diff)
downloadorg-mode-8d7990acfa00af585d7957a00b2327da9b707411.tar.gz
Merge branch 'maint'
Conflicts: lisp/org.el
-rw-r--r--lisp/org.el89
1 files changed, 48 insertions, 41 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 2ecf4ea..78429a7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21524,47 +21524,54 @@ function installs the following ones: \"property\",
"Compute a fill prefix for the current line.
Return fill prefix, as a string, or nil if current line isn't
meant to be filled."
- (org-with-wide-buffer
- (unless (and (derived-mode-p 'message-mode) (not (message-in-body-p)))
- ;; FIXME: This is really the job of orgstruct++-mode
- (let* ((p (line-beginning-position))
- (element (save-excursion (beginning-of-line)
- (org-element-at-point)))
- (type (org-element-type element))
- (post-affiliated (org-element-property :post-affiliated element)))
- (unless (and post-affiliated (< p post-affiliated))
- (case type
- (comment (looking-at "[ \t]*# ?") (match-string 0))
- (footnote-definition "")
- ((item plain-list)
- (make-string (org-list-item-body-column
- (or post-affiliated
- (org-element-property :begin element)))
- ? ))
- (paragraph
- ;; Fill prefix is usually the same as the current line,
- ;; except if the paragraph is at the beginning of an item.
- (let ((parent (org-element-property :parent element)))
- (cond ((eq (org-element-type parent) 'item)
- (make-string (org-list-item-body-column
- (org-element-property :begin parent))
- ? ))
- ((save-excursion (beginning-of-line) (looking-at "[ \t]+"))
- (match-string 0))
- (t ""))))
- (comment-block
- ;; Only fill contents if P is within block boundaries.
- (let* ((cbeg (save-excursion (goto-char post-affiliated)
- (forward-line)
- (point)))
- (cend (save-excursion
- (goto-char (org-element-property :end element))
- (skip-chars-backward " \r\t\n")
- (line-beginning-position))))
- (when (and (>= p cbeg) (< p cend))
- (if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
- (match-string 0)
- ""))))))))))
+ (let (prefix)
+ (when (and (derived-mode-p 'message-mode) (message-in-body-p))
+ (save-excursion
+ (beginning-of-line)
+ (cond ((looking-at message-cite-prefix-regexp)
+ (setq prefix (match-string-no-properties 0)))
+ ((looking-at org-outline-regexp)
+ (setq prefix "")))))
+ (or prefix
+ (org-with-wide-buffer
+ (let* ((p (line-beginning-position))
+ (element (save-excursion (beginning-of-line)
+ (org-element-at-point)))
+ (type (org-element-type element))
+ (post-affiliated (org-element-property :post-affiliated element)))
+ (unless (and post-affiliated (< p post-affiliated))
+ (case type
+ (comment (looking-at "[ \t]*# ?") (match-string 0))
+ (footnote-definition "")
+ ((item plain-list)
+ (make-string (org-list-item-body-column
+ (or post-affiliated
+ (org-element-property :begin element)))
+ ? ))
+ (paragraph
+ ;; Fill prefix is usually the same as the current line,
+ ;; except if the paragraph is at the beginning of an item.
+ (let ((parent (org-element-property :parent element)))
+ (cond ((eq (org-element-type parent) 'item)
+ (make-string (org-list-item-body-column
+ (org-element-property :begin parent))
+ ? ))
+ ((save-excursion (beginning-of-line) (looking-at "[ \t]+"))
+ (match-string 0))
+ (t ""))))
+ (comment-block
+ ;; Only fill contents if P is within block boundaries.
+ (let* ((cbeg (save-excursion (goto-char post-affiliated)
+ (forward-line)
+ (point)))
+ (cend (save-excursion
+ (goto-char (org-element-property :end element))
+ (skip-chars-backward " \r\t\n")
+ (line-beginning-position))))
+ (when (and (>= p cbeg) (< p cend))
+ (if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
+ (match-string 0)
+ "")))))))))))
(declare-function message-goto-body "message" ())
(defvar message-cite-prefix-regexp) ; From message.el