Small optimization
* lisp/org.el (org-adaptive-fill-function): Do not compute fill prefix if point is at a heading or an inlinetask. Also change "? " into "?\s" for better code readability.
This commit is contained in:
parent
c9a5ba09f1
commit
39d0433637
13
lisp/org.el
13
lisp/org.el
|
@ -22727,14 +22727,13 @@ matches in paragraphs or comments, use it."
|
||||||
((looking-at message-cite-prefix-regexp)
|
((looking-at message-cite-prefix-regexp)
|
||||||
(throw 'exit (match-string-no-properties 0)))
|
(throw 'exit (match-string-no-properties 0)))
|
||||||
((looking-at org-outline-regexp)
|
((looking-at org-outline-regexp)
|
||||||
(throw 'exit (make-string (length (match-string 0)) ? ))))))
|
(throw 'exit (make-string (length (match-string 0)) ?\s))))))
|
||||||
(org-with-wide-buffer
|
(org-with-wide-buffer
|
||||||
|
(unless (org-at-heading-p)
|
||||||
(let* ((p (line-beginning-position))
|
(let* ((p (line-beginning-position))
|
||||||
(element (save-excursion
|
(element (save-excursion
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(or (ignore-errors (org-element-at-point))
|
(org-element-at-point)))
|
||||||
(user-error "An element cannot be parsed line %d"
|
|
||||||
(line-number-at-pos (point))))))
|
|
||||||
(type (org-element-type element))
|
(type (org-element-type element))
|
||||||
(post-affiliated (org-element-property :post-affiliated element)))
|
(post-affiliated (org-element-property :post-affiliated element)))
|
||||||
(unless (and post-affiliated (< p post-affiliated))
|
(unless (and post-affiliated (< p post-affiliated))
|
||||||
|
@ -22749,7 +22748,7 @@ matches in paragraphs or comments, use it."
|
||||||
(make-string (org-list-item-body-column
|
(make-string (org-list-item-body-column
|
||||||
(or post-affiliated
|
(or post-affiliated
|
||||||
(org-element-property :begin element)))
|
(org-element-property :begin element)))
|
||||||
? ))
|
?\s))
|
||||||
(paragraph
|
(paragraph
|
||||||
;; Fill prefix is usually the same as the current line,
|
;; Fill prefix is usually the same as the current line,
|
||||||
;; unless the paragraph is at the beginning of an item.
|
;; unless the paragraph is at the beginning of an item.
|
||||||
|
@ -22759,7 +22758,7 @@ matches in paragraphs or comments, use it."
|
||||||
(cond ((eq (org-element-type parent) 'item)
|
(cond ((eq (org-element-type parent) 'item)
|
||||||
(make-string (org-list-item-body-column
|
(make-string (org-list-item-body-column
|
||||||
(org-element-property :begin parent))
|
(org-element-property :begin parent))
|
||||||
? ))
|
?\s))
|
||||||
((and adaptive-fill-regexp
|
((and adaptive-fill-regexp
|
||||||
;; Locally disable
|
;; Locally disable
|
||||||
;; `adaptive-fill-function' to let
|
;; `adaptive-fill-function' to let
|
||||||
|
@ -22783,7 +22782,7 @@ matches in paragraphs or comments, use it."
|
||||||
(when (and (>= p cbeg) (< p cend))
|
(when (and (>= p cbeg) (< p cend))
|
||||||
(if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
|
(if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
|
||||||
(match-string 0)
|
(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
|
||||||
|
|
Loading…
Reference in New Issue