Function: org-appear--hide-invisible

org-appear--hide-invisible is a natively compiled function defined in org-appear.el.

Signature

(org-appear--hide-invisible ELEM)

Documentation

Silently add invisible property to invisible parts of element ELEM.

Source Code

;; Defined in /nix/store/ysqmilmh80y85ik1crg29w7g7i73wjk9-emacs-packages-deps/share/emacs/site-lisp/elpa/org-appear-20260716.2120/org-appear.el
(defun org-appear--hide-invisible (elem)
  "Silently add invisible property to invisible parts of element ELEM."
  (let* ((elem-at-point (org-appear--parse-elem elem))
	 (elem-type (car elem))
	 (start (plist-get elem-at-point :start))
	 (end (plist-get elem-at-point :end))
	 (visible-start (plist-get elem-at-point :visible-start))
	 (visible-end (plist-get elem-at-point :visible-end)))
    (when elem-at-point
      (when (and (eq org-appear-autolinks 'just-brackets)
		 (eq elem-type 'link))
	(setq start (1- visible-start))
	(setq end (1+ visible-end)))
      (with-silent-modifications
	(cond ((eq elem-type 'entity)
	       (compose-region start end (org-element-property :utf-8 elem))
	       (font-lock-flush start end))
	      ((memq elem-type '(keyword latex-fragment latex-environment))
	       (font-lock-flush start end))
	      ((and (featurep 'org-fold)
		    (eq elem-type 'link)
		    (eq org-fold-core-style 'text-properties))
	       (put-text-property start
				  visible-start
				  (org-fold-core--property-symbol-get-create 'org-link)
				  'org-link)
	       (put-text-property visible-end
				  end
				  (org-fold-core--property-symbol-get-create 'org-link)
				  'org-link))
	      (t
	       (put-text-property start visible-start 'invisible 'org-link)
	       (put-text-property visible-end end 'invisible 'org-link)
	       (font-lock-flush start end))))
      ;; Call `font-lock-ensure' after flushing to prevent `jit-lock-mode'
      ;; from refontifying the next element entered
      (font-lock-ensure start end))))