summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-01-02 14:11:48 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-01-02 14:11:48 +0100
commit4313417515cc36552b05c3a91ef0b3a6bb3a18e0 (patch)
treed5908fc496fb1f182c5d57407de404645f344c02
parent3694450320f8da3c9d75229c05a348ec29c3a824 (diff)
parent6da1d9fc325deef1b6701151792e3c2c18fb157a (diff)
downloadorg-mode-4313417515cc36552b05c3a91ef0b3a6bb3a18e0.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-indent.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index dc05757..c753318 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -343,11 +343,12 @@ Flag will be non-nil if command is going to modify or delete an
headline."
(when org-indent-mode
(setq org-indent-modified-headline-flag
- (save-excursion
- (goto-char beg)
- (save-match-data
- (or (and (org-at-heading-p) (< beg (match-end 0)))
- (re-search-forward org-outline-regexp-bol end t)))))))
+ (org-with-wide-buffer
+ (goto-char beg)
+ (save-match-data
+ (or (and (org-at-heading-p) (< beg (match-end 0)))
+ (re-search-forward
+ (org-with-limited-levels org-outline-regexp-bol) end t)))))))
(defun org-indent-refresh-maybe (beg end _)
"Refresh indentation properties in an adequate portion of buffer.
@@ -359,19 +360,21 @@ This function is meant to be called by `after-change-functions'."
(save-match-data
;; If a headline was modified or inserted, set properties until
;; next headline.
- (if (or org-indent-modified-headline-flag
- (save-excursion
- (goto-char beg)
- (beginning-of-line)
- (re-search-forward org-outline-regexp-bol end t)))
- (let ((end (save-excursion
- (goto-char end)
- (org-with-limited-levels (outline-next-heading))
- (point))))
- (setq org-indent-modified-headline-flag nil)
- (org-indent-add-properties beg end))
- ;; Otherwise, only set properties on modified area.
- (org-indent-add-properties beg end)))))
+ (org-with-wide-buffer
+ (if (or org-indent-modified-headline-flag
+ (save-excursion
+ (goto-char beg)
+ (beginning-of-line)
+ (re-search-forward
+ (org-with-limited-levels org-outline-regexp-bol) end t)))
+ (let ((end (save-excursion
+ (goto-char end)
+ (org-with-limited-levels (outline-next-heading))
+ (point))))
+ (setq org-indent-modified-headline-flag nil)
+ (org-indent-add-properties beg end))
+ ;; Otherwise, only set properties on modified area.
+ (org-indent-add-properties beg end))))))
(provide 'org-indent)