Remove reference to Message mode
* lisp/org.el (org-adaptive-fill-function): (org-fill-element): Remove reference to Message mode. These functions are Org mode specific.
This commit is contained in:
parent
eeb4c22090
commit
2b96b08eaf
119
lisp/org.el
119
lisp/org.el
|
@ -22047,68 +22047,58 @@ assumed to be significant there."
|
||||||
Return fill prefix, as a string, or nil if current line isn't
|
Return fill prefix, as a string, or nil if current line isn't
|
||||||
meant to be filled. For convenience, if `adaptive-fill-regexp'
|
meant to be filled. For convenience, if `adaptive-fill-regexp'
|
||||||
matches in paragraphs or comments, use it."
|
matches in paragraphs or comments, use it."
|
||||||
(catch 'exit
|
(org-with-wide-buffer
|
||||||
(when (derived-mode-p 'message-mode)
|
(unless (org-at-heading-p)
|
||||||
(save-excursion
|
(let* ((p (line-beginning-position))
|
||||||
(beginning-of-line)
|
(element (save-excursion
|
||||||
(cond ((not (message-in-body-p)) (throw 'exit nil))
|
(beginning-of-line)
|
||||||
((looking-at-p org-table-line-regexp) (throw 'exit nil))
|
(org-element-at-point)))
|
||||||
((looking-at message-cite-prefix-regexp)
|
(type (org-element-type element))
|
||||||
(throw 'exit (match-string-no-properties 0)))
|
(post-affiliated (org-element-property :post-affiliated element)))
|
||||||
((looking-at org-outline-regexp)
|
(unless (< p post-affiliated)
|
||||||
(throw 'exit (make-string (length (match-string 0)) ?\s))))))
|
(cl-case type
|
||||||
(org-with-wide-buffer
|
(comment
|
||||||
(unless (org-at-heading-p)
|
(save-excursion
|
||||||
(let* ((p (line-beginning-position))
|
(beginning-of-line)
|
||||||
(element (save-excursion
|
(looking-at "[ \t]*")
|
||||||
(beginning-of-line)
|
(concat (match-string 0) "# ")))
|
||||||
(org-element-at-point)))
|
(footnote-definition "")
|
||||||
(type (org-element-type element))
|
((item plain-list)
|
||||||
(post-affiliated (org-element-property :post-affiliated element)))
|
(make-string (org-list-item-body-column post-affiliated) ?\s))
|
||||||
(unless (< p post-affiliated)
|
(paragraph
|
||||||
(cl-case type
|
;; Fill prefix is usually the same as the current line,
|
||||||
(comment
|
;; unless the paragraph is at the beginning of an item.
|
||||||
|
(let ((parent (org-element-property :parent element)))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(looking-at "[ \t]*")
|
(cond ((eq (org-element-type parent) 'item)
|
||||||
(concat (match-string 0) "# ")))
|
(make-string (org-list-item-body-column
|
||||||
(footnote-definition "")
|
(org-element-property :begin parent))
|
||||||
((item plain-list)
|
?\s))
|
||||||
(make-string (org-list-item-body-column post-affiliated) ?\s))
|
((and adaptive-fill-regexp
|
||||||
(paragraph
|
;; Locally disable
|
||||||
;; Fill prefix is usually the same as the current line,
|
;; `adaptive-fill-function' to let
|
||||||
;; unless the paragraph is at the beginning of an item.
|
;; `fill-context-prefix' handle
|
||||||
(let ((parent (org-element-property :parent element)))
|
;; `adaptive-fill-regexp' variable.
|
||||||
(save-excursion
|
(let (adaptive-fill-function)
|
||||||
(beginning-of-line)
|
(fill-context-prefix
|
||||||
(cond ((eq (org-element-type parent) 'item)
|
post-affiliated
|
||||||
(make-string (org-list-item-body-column
|
(org-element-property :end element)))))
|
||||||
(org-element-property :begin parent))
|
((looking-at "[ \t]+") (match-string 0))
|
||||||
?\s))
|
(t "")))))
|
||||||
((and adaptive-fill-regexp
|
(comment-block
|
||||||
;; Locally disable
|
;; Only fill contents if P is within block boundaries.
|
||||||
;; `adaptive-fill-function' to let
|
(let* ((cbeg (save-excursion (goto-char post-affiliated)
|
||||||
;; `fill-context-prefix' handle
|
(forward-line)
|
||||||
;; `adaptive-fill-regexp' variable.
|
(point)))
|
||||||
(let (adaptive-fill-function)
|
(cend (save-excursion
|
||||||
(fill-context-prefix
|
(goto-char (org-element-property :end element))
|
||||||
post-affiliated
|
(skip-chars-backward " \r\t\n")
|
||||||
(org-element-property :end element)))))
|
(line-beginning-position))))
|
||||||
((looking-at "[ \t]+") (match-string 0))
|
(when (and (>= p cbeg) (< p cend))
|
||||||
(t "")))))
|
(if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
|
||||||
(comment-block
|
(match-string 0)
|
||||||
;; 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" ())
|
(declare-function message-goto-body "message" ())
|
||||||
(defvar message-cite-prefix-regexp) ; From message.el
|
(defvar message-cite-prefix-regexp) ; From message.el
|
||||||
|
@ -22153,15 +22143,6 @@ a footnote definition, try to fill the first paragraph within."
|
||||||
(org-element-property :contents-end element))))
|
(org-element-property :contents-end element))))
|
||||||
;; Do nothing if point is at an affiliated keyword.
|
;; Do nothing if point is at an affiliated keyword.
|
||||||
(if (< (line-end-position) beg) t
|
(if (< (line-end-position) beg) t
|
||||||
(when (derived-mode-p 'message-mode)
|
|
||||||
;; In `message-mode', do not fill following citation
|
|
||||||
;; in current paragraph nor text before message body.
|
|
||||||
(let ((body-start (save-excursion (message-goto-body))))
|
|
||||||
(when body-start (setq beg (max body-start beg))))
|
|
||||||
(when (save-excursion
|
|
||||||
(re-search-forward
|
|
||||||
(concat "^" message-cite-prefix-regexp) end t))
|
|
||||||
(setq end (match-beginning 0))))
|
|
||||||
;; Fill paragraph, taking line breaks into account.
|
;; Fill paragraph, taking line breaks into account.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
|
|
Loading…
Reference in New Issue