diff options
Diffstat (limited to 'lisp/org/org-indent.el')
-rw-r--r-- | lisp/org/org-indent.el | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 71d6658a56f..97cf8786566 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -183,11 +183,15 @@ during idle time." org-hide-leading-stars) (setq-local org-hide-leading-stars t)) (org-indent--compute-prefixes) - (add-hook 'filter-buffer-substring-functions - (lambda (fun start end delete) - (org-indent-remove-properties-from-string - (funcall fun start end delete))) - nil t) + (if (boundp 'filter-buffer-substring-functions) + (add-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete))) + nil t) + ;; Emacs >= 24.4. + (add-function :filter-return (local 'filter-buffer-substring-function) + #'org-indent-remove-properties-from-string)) (add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local) (add-hook 'before-change-functions 'org-indent-notify-modified-headline nil 'local) @@ -211,10 +215,13 @@ during idle time." (when (boundp 'org-hide-leading-stars-before-indent-mode) (setq-local org-hide-leading-stars org-hide-leading-stars-before-indent-mode)) - (remove-hook 'filter-buffer-substring-functions - (lambda (fun start end delete) - (org-indent-remove-properties-from-string - (funcall fun start end delete)))) + (if (boundp 'filter-buffer-substring-functions) + (remove-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete)))) + (remove-function (local 'filter-buffer-substring-function) + #'org-indent-remove-properties-from-string)) (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local) (remove-hook 'before-change-functions 'org-indent-notify-modified-headline 'local) @@ -325,7 +332,7 @@ stopped." (let* ((case-fold-search t) (limited-re (org-get-limited-outline-regexp)) (level (or (org-current-level) 0)) - (time-limit (and delay (time-add (current-time) delay)))) + (time-limit (and delay (time-add nil delay)))) ;; For each line, set `line-prefix' and `wrap-prefix' ;; properties depending on the type of line (headline, inline ;; task, item or other). @@ -338,7 +345,7 @@ stopped." ;; In asynchronous mode, take a break of ;; `org-indent-agent-resume-delay' every DELAY to avoid ;; blocking any other idle timer or process output. - ((and delay (time-less-p time-limit (current-time))) + ((and delay (time-less-p time-limit nil)) (setq org-indent-agent-resume-timer (run-with-idle-timer (time-add (current-idle-time) org-indent-agent-resume-delay) |