diff options
-rw-r--r-- | init.org | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -324,7 +324,11 @@ from [[https://pank.eu/blog/pretty-babel-src-blocks.html][the blog of Rasmus Pan (setq prettify-symbols--keywords (prettify-symbols--make-keywords)) (font-lock-add-keywords nil prettify-symbols--keywords) (while (re-search-forward re nil t) - (font-lock-flush (line-beginning-position) (line-end-position)))))) + (font-lock-flush (line-beginning-position) (line-end-position))) + ;; Toggle prettify-symbols-mode to restore composition of + ;; regions on which the "composition" text-property was deleted. + (prettify-symbols-mode -1) + (prettify-symbols-mode +1)))) (defun rasmus/org-prettify-src () "Hide src options via `prettify-symbols-mode'. @@ -336,17 +340,17 @@ may not be efficient." (beginning-of-line) (looking-at my/org-src-begin-regexp)))) ;; Test if we moved out of a block. - (when (or (and rasmus/org-at-src-begin - (not at-src-block)) - ;; File was just opened. - (eq rasmus/org-at-src-begin -1)) - (rasmus/org-prettify-src--update)) - ;; Remove composition if at line; doesn't work properly. - ;; (when at-src-block - ;; (with-silent-modifications - ;; (remove-text-properties (match-end 0) - ;; (1+ (line-end-position)) - ;; '(composition)))) + (cond ((or (and rasmus/org-at-src-begin + (not at-src-block)) + ;; File was just opened. + (eq rasmus/org-at-src-begin -1)) + (rasmus/org-prettify-src--update)) + ;; Remove composition if at line + (at-src-block + (with-silent-modifications + (remove-text-properties (match-end 0) + (1+ (line-end-position)) + '(composition))))) (setq rasmus/org-at-src-begin at-src-block))) (defun rasmus/org-prettify-symbols () |