|
@@ -651,9 +651,43 @@ as `org-src-fontify-natively' is non-nil."
|
|
|
(dolist (prop (append '(font-lock-face face) font-lock-extra-managed-props))
|
|
|
(let ((new-prop (get-text-property pos prop)))
|
|
|
(when new-prop
|
|
|
- (put-text-property
|
|
|
- (+ start (1- pos)) (1- (+ start next)) prop new-prop
|
|
|
- org-buffer))))
|
|
|
+ (if (not (eq prop 'invisible))
|
|
|
+ (put-text-property
|
|
|
+ (+ start (1- pos)) (1- (+ start next)) prop new-prop
|
|
|
+ org-buffer)
|
|
|
+ ;; Special case. `invisible' text property may
|
|
|
+ ;; clash with Org folding. Do not assign
|
|
|
+ ;; `invisible' text property directly. Use
|
|
|
+ ;; property alias instead.
|
|
|
+ (let ((invisibility-spec
|
|
|
+ (or
|
|
|
+ ;; ATOM spec.
|
|
|
+ (and (memq new-prop buffer-invisibility-spec)
|
|
|
+ new-prop)
|
|
|
+ ;; (ATOM . ELLIPSIS) spec.
|
|
|
+ (assq new-prop buffer-invisibility-spec))))
|
|
|
+ (with-current-buffer org-buffer
|
|
|
+ ;; Add new property alias.
|
|
|
+ (unless (memq 'org-src-invisible
|
|
|
+ (cdr (assq 'invisible char-property-alias-alist)))
|
|
|
+ (setq-local
|
|
|
+ char-property-alias-alist
|
|
|
+ (cons (cons 'invisible
|
|
|
+ (nconc (cdr (assq 'invisible char-property-alias-alist))
|
|
|
+ '(org-src-invisible)))
|
|
|
+ (remove (assq 'invisible char-property-alias-alist)
|
|
|
+ char-property-alias-alist))))
|
|
|
+ ;; Carry over the invisibility spec, unless
|
|
|
+ ;; already present. Note that there might
|
|
|
+ ;; be conflicting invisibility specs from
|
|
|
+ ;; different major modes. We cannot do much
|
|
|
+ ;; about this then.
|
|
|
+ (when invisibility-spec
|
|
|
+ (add-to-invisibility-spec invisibility-spec))
|
|
|
+ (put-text-property
|
|
|
+ (+ start (1- pos)) (1- (+ start next))
|
|
|
+ 'org-src-invisible new-prop
|
|
|
+ org-buffer)))))))
|
|
|
(setq pos next)))
|
|
|
(set-buffer-modified-p nil))
|
|
|
;; Add Org faces.
|