forked from mirrors/org-mode
Compare commits
5 Commits
28bfdb6b78
...
c67b29cadf
Author | SHA1 | Date |
---|---|---|
TEC | c67b29cadf | |
TEC | 27438eeb95 | |
TEC | d4df97457c | |
TEC | 2fdee57c40 | |
TEC | d0d4a0b44c |
|
@ -2,6 +2,7 @@
|
|||
|
||||
;; Copyright (C) 2022-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: TEC <contact@tecosaur.net> and Karthik Chikmagalur
|
||||
;; Keywords: tex, extensions, tools
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -809,9 +809,42 @@ as `org-src-fontify-natively' is non-nil."
|
|||
(1+ pt) (1- (point)) 'face 'org-inline-src-block)))
|
||||
(font-lock-append-text-property
|
||||
(1- (point)) (point) 'face '(org-inline-src-block shadow))
|
||||
(setq pt (point)))))
|
||||
(setq pt (point)))
|
||||
(when (and org-inline-src-prettify-results
|
||||
(re-search-forward "\\= {{{results(" limit t))
|
||||
(font-lock-append-text-property pt (1+ pt) 'face 'org-inline-src-block)
|
||||
(goto-char pt))))
|
||||
t)))
|
||||
|
||||
(defun org-fontify-inline-src-results (limit)
|
||||
"Apply prettify-symbols modifications to inline results blocks.
|
||||
Performed according to `org-inline-src-prettify-results'."
|
||||
(when (and org-inline-src-prettify-results
|
||||
(re-search-forward "{{{results(\\(.+?\\))}}}" limit t))
|
||||
(remove-list-of-text-properties (match-beginning 0) (point)
|
||||
'(composition
|
||||
prettify-symbols-start
|
||||
prettify-symbols-end))
|
||||
(font-lock-append-text-property (match-beginning 0) (match-end 0)
|
||||
'face 'org-block)
|
||||
(let ((start (match-beginning 0)) (end (match-beginning 1)))
|
||||
(with-silent-modifications
|
||||
(compose-region start end (if (eq org-inline-src-prettify-results t)
|
||||
"(" (car org-inline-src-prettify-results)))
|
||||
(add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
|
||||
(let ((start (match-end 1)) (end (point)))
|
||||
(with-silent-modifications
|
||||
(compose-region start end (if (eq org-inline-src-prettify-results t)
|
||||
")" (cdr org-inline-src-prettify-results)))
|
||||
(add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
|
||||
t))
|
||||
|
||||
(defun org-toggle-inline-results-display ()
|
||||
"Toggle the literal or contracted display of inline src blocks results."
|
||||
(interactive)
|
||||
(setq org-inline-src-prettify-results (not org-inline-src-prettify-results))
|
||||
(org-restart-font-lock))
|
||||
|
||||
|
||||
;;; Escape contents
|
||||
|
||||
|
|
20
lisp/org.el
20
lisp/org.el
|
@ -5213,6 +5213,15 @@ by a #."
|
|||
:version "24.1"
|
||||
:group 'org-appearance)
|
||||
|
||||
(defcustom org-inline-src-prettify-results t
|
||||
"Whether to use (ab)use prettify-symbols-mode on {{{results(...)}}}.
|
||||
Either t or a cons cell of strings which are used as substitutions
|
||||
for the start and end of inline results, respectively."
|
||||
:type '(choice boolean (cons string string))
|
||||
:package-version '(Org . "9.5")
|
||||
:group 'org-appearance
|
||||
:group 'org-babel)
|
||||
|
||||
(defun org-fontify-meta-lines-and-blocks (limit)
|
||||
(condition-case-unless-debug nil
|
||||
(org-fontify-meta-lines-and-blocks-1 limit)
|
||||
|
@ -19196,12 +19205,23 @@ a footnote definition, try to fill the first paragraph within."
|
|||
(save-excursion
|
||||
(goto-char beg)
|
||||
(let ((cuts (list beg)))
|
||||
;; Cut fill on line breaks.
|
||||
(while (re-search-forward "\\\\\\\\[ \t]*\n" end t)
|
||||
(when (org-element-type-p
|
||||
(save-excursion (backward-char)
|
||||
(org-element-context))
|
||||
'line-break)
|
||||
(push (point) cuts)))
|
||||
;; Cut fill on displayed equations.
|
||||
(while (re-search-forward "^[ \t]*\\\\\\[" end t)
|
||||
(let ((el (org-element-context)))
|
||||
(when (eq 'latex-fragment (org-element-type el))
|
||||
(setf cuts (append
|
||||
(list (org-element-property :end el)
|
||||
(- (org-element-property :end el) 2)
|
||||
(+ (org-element-property :begin el) 2)
|
||||
(org-element-property :begin el))
|
||||
cuts)))))
|
||||
(dolist (c (delq end cuts))
|
||||
(fill-region-as-paragraph c end justify)
|
||||
(setq end c))))
|
||||
|
|
Loading…
Reference in New Issue