From 41a409f79d07fe7a3e8c5f934b97e4a2884bf948 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 9 Oct 2022 11:42:59 +0800 Subject: [PATCH] org-src-font-lock-fontify-block: Do not fold links inside src blocks * lisp/org-src.el (org-src-font-lock-fontify-block): Overwrite link fontification after regexp-based `org-activate-links' fontifies links disregarding Org parser. Hidden parts of link-looking text are explicitly unfolded now. This commit relies on specific fontification order in `org-font-lock-keywords'. (org-fold-region): Declare function. Reported-by: Tim Loderhose Link: https://orgmode.org/list/XdWFnN3XCJ67x3SvoiVo_itGGYfboKmuWp7OxQxRZ_SGA5vgb72oWBoqTmOUUtiqUR890-kIXjI7uhlse-HFYqNVJTyVlc15zAzbP8qHVdo=@loderhose.com --- lisp/org-src.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/org-src.el b/lisp/org-src.el index 2d851611c..2c1dd98ea 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -43,6 +43,7 @@ (declare-function org--get-expected-indentation "org" (element contentsp)) (declare-function org-mode "org" ()) (declare-function org--get-expected-indentation "org" (element contentsp)) +(declare-function org-fold-region "org-fold" (from to flag &optional spec-or-alias)) (declare-function org-element-at-point "org-element" (&optional pom cached-only)) (declare-function org-element-class "org-element" (datum &optional parent)) (declare-function org-element-context "org-element" (&optional element)) @@ -698,6 +699,8 @@ as `org-src-fontify-natively' is non-nil." (when (or (facep src-face) (listp src-face)) (font-lock-append-text-property start end 'face src-face)) (font-lock-append-text-property start end 'face 'org-block)) + ;; Clear abbreviated link folding. + (org-fold-region start end nil 'org-link) (add-text-properties start end '(font-lock-fontified t fontified t font-lock-multiline t))