summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2014-07-28 18:54:00 +0200
committerBastien Guerry <bzg@altern.org>2014-07-28 18:54:00 +0200
commitf8b42e8ebeeecdef59a8a7cbc4324264a5162197 (patch)
tree677e75d40eb46fa35b3743d37da17961044bbca9
parent98295a8a25a0eac70ad365ec2c20051fa2964e0a (diff)
downloadorg-mode-f8b42e8.tar.gz
Don't use an overlay for src blocks backgrounds
* org-faces.el (org-block-background): Delete. * org.el (org-fontify-meta-lines-and-blocks-1): Don't use an overlay for the block background. (org-in-src-block-p): Check against the `src-block' text property, not against an overlay. The overlay was introduced here: http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=27d98d879 and fixed here http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=69811ff44 But (1) it makes fontification slowler, (2) it makes `org-in-src-block-p' slower and it prevents correct ps-printing of Org buffers. If we want to use a different background color, we need another solution than using overlays.
-rw-r--r--lisp/org-faces.el3
-rw-r--r--lisp/org.el14
2 files changed, 2 insertions, 15 deletions
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index e693dab..83453e8 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -537,9 +537,6 @@ follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword."
:group 'org-faces
:version "22.1")
-(defface org-block-background '((t ()))
- "Face used for the source block background.")
-
(org-copy-face 'org-meta-line 'org-block-begin-line
"Face used for the line delimiting the begin of source blocks.")
diff --git a/lisp/org.el b/lisp/org.el
index a153151..7e30061 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5930,15 +5930,7 @@ by a #."
(cond
((and lang (not (string= lang "")) org-src-fontify-natively)
(org-src-font-lock-fontify-block lang block-start block-end)
- ;; remove old background overlays
- (mapc (lambda (ov)
- (if (eq (overlay-get ov 'face) 'org-block-background)
- (delete-overlay ov)))
- (overlays-at (/ (+ beg1 block-end) 2)))
- ;; add a background overlay
- (setq ovl (make-overlay beg1 block-end))
- (overlay-put ovl 'face 'org-block-background)
- (overlay-put ovl 'evaporate t)) ; make it go away when empty
+ (add-text-properties beg1 block-end '(src-block t)))
(quoting
(add-text-properties beg1 (min (point-max) (1+ end1))
'(face org-block))) ; end of source block
@@ -21828,9 +21820,7 @@ and end of string."
When INSIDE is non-nil, don't consider we are within a src block
when point is at #+BEGIN_SRC or #+END_SRC."
(let ((case-fold-search t) ov)
- (or (and (setq ov (overlays-at (point)))
- (memq 'org-block-background
- (overlay-properties (car ov))))
+ (or (and (eq (get-char-property (point) 'src-block) t))
(and (not inside)
(save-match-data
(save-excursion