org-indent: Fix refresh when using `org-toggle-heading'

* lisp/org-indent.el (org-indent-notify-modified-headline):
(org-indent-refresh-maybe): Ignore narrowing.  Also ignore inlinetasks.

Reported-by: Ingo Lohmar <i.lohmar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103919>
This commit is contained in:
Nicolas Goaziou 2016-01-02 14:10:49 +01:00
parent 0c14fa6499
commit 6da1d9fc32

View file

@ -342,11 +342,12 @@ Flag will be non-nil if command is going to modify or delete an
headline." headline."
(when org-indent-mode (when org-indent-mode
(setq org-indent-modified-headline-flag (setq org-indent-modified-headline-flag
(save-excursion (org-with-wide-buffer
(goto-char beg) (goto-char beg)
(save-match-data (save-match-data
(or (and (org-at-heading-p) (< beg (match-end 0))) (or (and (org-at-heading-p) (< beg (match-end 0)))
(re-search-forward org-outline-regexp-bol end t))))))) (re-search-forward
(org-with-limited-levels org-outline-regexp-bol) end t)))))))
(defun org-indent-refresh-maybe (beg end dummy) (defun org-indent-refresh-maybe (beg end dummy)
"Refresh indentation properties in an adequate portion of buffer. "Refresh indentation properties in an adequate portion of buffer.
@ -358,19 +359,21 @@ This function is meant to be called by `after-change-functions'."
(save-match-data (save-match-data
;; If a headline was modified or inserted, set properties until ;; If a headline was modified or inserted, set properties until
;; next headline. ;; next headline.
(if (or org-indent-modified-headline-flag (org-with-wide-buffer
(save-excursion (if (or org-indent-modified-headline-flag
(goto-char beg) (save-excursion
(beginning-of-line) (goto-char beg)
(re-search-forward org-outline-regexp-bol end t))) (beginning-of-line)
(let ((end (save-excursion (re-search-forward
(goto-char end) (org-with-limited-levels org-outline-regexp-bol) end t)))
(org-with-limited-levels (outline-next-heading)) (let ((end (save-excursion
(point)))) (goto-char end)
(setq org-indent-modified-headline-flag nil) (org-with-limited-levels (outline-next-heading))
(org-indent-add-properties beg end)) (point))))
;; Otherwise, only set properties on modified area. (setq org-indent-modified-headline-flag nil)
(org-indent-add-properties beg end))))) (org-indent-add-properties beg end))
;; Otherwise, only set properties on modified area.
(org-indent-add-properties beg end))))))
(provide 'org-indent) (provide 'org-indent)