diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2011-04-28 22:08:15 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2011-04-28 22:08:15 +0200 |
commit | 69811ff44cb4350278fab9a683f14393e3cc22c9 (patch) | |
tree | faf0219a6288e21a8287e593ab51a42ca5eecbf7 | |
parent | b00948328d6450c57440739c61956238a5b90992 (diff) | |
download | org-mode-69811ff44cb4350278fab9a683f14393e3cc22c9.tar.gz |
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.
-rw-r--r-- | lisp/org.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/org.el b/lisp/org.el index e17c90f..61668ce 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5159,7 +5159,7 @@ will be prompted for." (beg1 (line-beginning-position 2)) (dc1 (downcase (match-string 2))) (dc3 (downcase (match-string 3))) - end end1 quoting block-type) + end end1 quoting block-type ovl) (cond ((member dc1 '("html:" "ascii:" "latex:" "docbook:")) ;; a single line of backend-specific content @@ -5193,8 +5193,15 @@ will be prompted for." (cond ((and lang org-src-fontify-natively) (org-src-font-lock-fontify-block lang block-start block-end) - (overlay-put (make-overlay beg1 block-end) - 'face 'org-block-background)) + ;; 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 (quoting (add-text-properties beg1 (+ end1 1) '(face org-block))) ; end of source block |