Fix multiple overlays bug in src blocks

* lisp/org.el (org-fontify-meta-lines-and-blocks): Fix bug which
resulted in the creation of multiple overlays in src blocks.
This commit is contained in:
Carsten Dominik 2011-04-28 22:08:15 +02:00
parent b00948328d
commit 69811ff44c
1 changed files with 10 additions and 3 deletions

View File

@ -5159,7 +5159,7 @@ will be prompted for."
(beg1 (line-beginning-position 2)) (beg1 (line-beginning-position 2))
(dc1 (downcase (match-string 2))) (dc1 (downcase (match-string 2)))
(dc3 (downcase (match-string 3))) (dc3 (downcase (match-string 3)))
end end1 quoting block-type) end end1 quoting block-type ovl)
(cond (cond
((member dc1 '("html:" "ascii:" "latex:" "docbook:")) ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
;; a single line of backend-specific content ;; a single line of backend-specific content
@ -5193,8 +5193,15 @@ will be prompted for."
(cond (cond
((and lang org-src-fontify-natively) ((and lang org-src-fontify-natively)
(org-src-font-lock-fontify-block lang block-start block-end) (org-src-font-lock-fontify-block lang block-start block-end)
(overlay-put (make-overlay beg1 block-end) ;; remove old background overlays
'face 'org-block-background)) (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
(quoting (quoting
(add-text-properties beg1 (+ end1 1) '(face org-block))) (add-text-properties beg1 (+ end1 1) '(face org-block)))
; end of source block ; end of source block