@@ -5942,7 +5942,9 @@ If you have any idea what's going on or how to fix this /please/ get in touch.
5942
5942
5943
5943
#+begin_src emacs-lisp
5944
5944
(defvar org-prettify-inline-results t
5945
- "Whether to use (ab)use prettify-symbols-mode on {{{results(...)}}}.")
5945
+ "Whether to use (ab)use prettify-symbols-mode on {{{results(...)}}}.
5946
+ Either t or a cons cell of strings which are used as substitutions
5947
+ for the start and end of inline results, respectively.")
5946
5948
5947
5949
(defvar org-fontify-inline-src-blocks-max-length 200
5948
5950
"Maximum content length of an inline src block that will be fontified.")
@@ -5957,8 +5959,9 @@ If you have any idea what's going on or how to fix this /please/ get in touch.
5957
5959
5958
5960
(defun org-fontify-inline-src-blocks-1 (limit)
5959
5961
"Fontify inline src_LANG blocks, from `point' up to LIMIT."
5960
- (let ((case-fold-search t))
5961
- (when (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t) ; stolen from `org-element-inline-src-block-parser'
5962
+ (let ((case-fold-search t)
5963
+ (initial-point (point)))
5964
+ (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t) ; stolen from `org-element-inline-src-block-parser'
5962
5965
(let ((beg (match-beginning 0))
5963
5966
pt
5964
5967
(lang-beg (match-beginning 1))
@@ -5989,20 +5992,25 @@ If you have any idea what's going on or how to fix this /please/ get in touch.
5989
5992
(when (and org-prettify-inline-results (re-search-forward "\\= {{{results(" limit t))
5990
5993
(font-lock-append-text-property pt (1+ pt) 'face 'org-block)
5991
5994
(goto-char pt))))
5992
- (when (and org-prettify-inline-results (re-search-forward "{{{results(\\(.+?\\))}}}" limit t))
5993
- (remove-list-of-text-properties (match-beginning 0) (point)
5994
- '(composition
5995
- prettify-symbols-start
5996
- prettify-symbols-end))
5997
- (font-lock-append-text-property (match-beginning 0) (match-end 0) 'face 'org-block)
5998
- (let ((start (match-beginning 0)) (end (match-beginning 1)))
5999
- (with-silent-modifications
6000
- (compose-region start end "⟨")
6001
- (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
6002
- (let ((start (match-end 1)) (end (point)))
6003
- (with-silent-modifications
6004
- (compose-region start end "⟩")
6005
- (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end)))))))
5995
+ (when org-prettify-inline-results
5996
+ (goto-char initial-point)
5997
+ (org-fontify-inline-src-results limit))))
5998
+
5999
+ (defun org-fontify-inline-src-results (limit)
6000
+ (while (re-search-forward "{{{results(\\(.+?\\))}}}" limit t)
6001
+ (remove-list-of-text-properties (match-beginning 0) (point)
6002
+ '(composition
6003
+ prettify-symbols-start
6004
+ prettify-symbols-end))
6005
+ (font-lock-append-text-property (match-beginning 0) (match-end 0) 'face 'org-block)
6006
+ (let ((start (match-beginning 0)) (end (match-beginning 1)))
6007
+ (with-silent-modifications
6008
+ (compose-region start end (if (eq org-prettify-inline-results t) "⟨" (car org-prettify-inline-results)))
6009
+ (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
6010
+ (let ((start (match-end 1)) (end (point)))
6011
+ (with-silent-modifications
6012
+ (compose-region start end (if (eq org-prettify-inline-results t) "⟩" (cdr org-prettify-inline-results)))
6013
+ (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))))
6006
6014
6007
6015
(defun org-fontify-inline-src-blocks-enable ()
6008
6016
"Add inline src fontification to font-lock in Org.
0 commit comments