35 |
;; The display string of content which should display part of itself |
;; The display string of content which should display part of itself |
36 |
;; is made by copying the text from the buffer together with its text |
;; is made by copying the text from the buffer together with its text |
37 |
;; properties. If fontification has not happened when this is done |
;; properties. If fontification has not happened when this is done |
38 |
;; (e.g. because of lazy font locking) the intended fontification will |
;; (e.g. because of lazy or just-in-time font locking) the intended |
39 |
;; not show up. Maybe this could be improved by using some sort of |
;; fontification will not show up. Maybe this could be improved by |
40 |
;; "lazy folding" or refreshing the window upon scrolling. As a |
;; using some sort of "lazy folding" or refreshing the window upon |
41 |
;; workaround you can leave Emacs idle a few seconds and wait for |
;; scrolling. As a workaround fontification of the whole buffer |
42 |
;; stealth font locking to finish before you fold the buffer. |
;; currently is forced before folding it. |
43 |
|
|
44 |
;;; Code: |
;;; Code: |
45 |
|
|
126 |
:type 'integer |
:type 'integer |
127 |
:group 'TeX-fold) |
:group 'TeX-fold) |
128 |
|
|
129 |
|
(defcustom TeX-fold-force-fontify t |
130 |
|
"Force the buffer to be fully fontified by folding it." |
131 |
|
:group 'TeX-fold |
132 |
|
:type 'boolean) |
133 |
|
|
134 |
(defface TeX-fold-folded-face |
(defface TeX-fold-folded-face |
135 |
'((((class color) (background light)) |
'((((class color) (background light)) |
136 |
(:foreground "SlateBlue")) |
(:foreground "SlateBlue")) |
203 |
and environments in `TeX-fold-env-spec-list'." |
and environments in `TeX-fold-env-spec-list'." |
204 |
(interactive) |
(interactive) |
205 |
(TeX-fold-clearout-region (point-min) (point-max)) |
(TeX-fold-clearout-region (point-min) (point-max)) |
206 |
|
(when (and TeX-fold-force-fontify |
207 |
|
(boundp 'jit-lock-mode) |
208 |
|
jit-lock-mode |
209 |
|
(fboundp 'jit-lock-fontify-now)) |
210 |
|
;; We force fontification here only because it should rarely be |
211 |
|
;; needed for the other folding commands. |
212 |
|
(jit-lock-fontify-now)) |
213 |
(TeX-fold-region (point-min) (point-max))) |
(TeX-fold-region (point-min) (point-max))) |
214 |
|
|
215 |
(defun TeX-fold-paragraph () |
(defun TeX-fold-paragraph () |
310 |
item-end)) |
item-end)) |
311 |
"[Error: No content found]") |
"[Error: No content found]") |
312 |
display-string-spec)) |
display-string-spec)) |
313 |
|
;; (apply #'propertize |
314 |
|
;; display-string-spec |
315 |
|
;; (text-properties-at |
316 |
|
;; (point))))) |
317 |
(ov (TeX-fold-make-overlay item-start item-end type |
(ov (TeX-fold-make-overlay item-start item-end type |
318 |
display-string-spec |
display-string-spec |
319 |
display-string))) |
display-string))) |
422 |
item-end)) |
item-end)) |
423 |
"[Error: No content found]") |
"[Error: No content found]") |
424 |
display-string-spec)) |
display-string-spec)) |
425 |
|
;; (apply #'propertize display-string-spec |
426 |
|
;; (text-properties-at (point))))) |
427 |
(ov (TeX-fold-make-overlay item-start item-end type |
(ov (TeX-fold-make-overlay item-start item-end type |
428 |
display-string-spec |
display-string-spec |
429 |
display-string))) |
display-string))) |