From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: colored code background in org 8.3 Date: Sat, 04 Jun 2016 00:12:56 +0200 Message-ID: <8760tpx6on.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8xLu-0000HS-Vg for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 18:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8xLp-0000Jz-PW for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 18:14:01 -0400 Received: from plane.gmane.org ([80.91.229.3]:44732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8xLp-0000Ia-I9 for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 18:13:57 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1b8xLQ-0007HQ-4e for emacs-orgmode@gnu.org; Sat, 04 Jun 2016 00:13:32 +0200 Received: from 83-91-99-158-dynamic.dk.customer.tdc.net ([83.91.99.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 04 Jun 2016 00:13:32 +0200 Received: from rasmus by 83-91-99-158-dynamic.dk.customer.tdc.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 04 Jun 2016 00:13:32 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain John Kitchin writes: > I am finally getting around to switching over to org 8.3... One thing I > miss already is the colored background in the code blocks. I recall that > was removed. Has anyone looked into a way to put it back? I use the attached patch for some "interactive slides" with babel. (require 'color) (set-face-attribute 'org-block nil :inherit 'fixed-pitch :background (color-darken-name (face-attribute 'default :background) 3)) You might also set :inherit of org-block-{begin,end}-line. Rasmus PS: My apology if I sent this twice now. -- Not everything that goes around comes back around, you know --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-src-src-blocks-also-inherit-org-block-face.patch >From 86244d84f8846489b893039749d724287c2c5dcd Mon Sep 17 00:00:00 2001 From: Rasmus Date: Fri, 3 Jun 2016 15:31:58 +0200 Subject: [PATCH] org-src: src-blocks also inherit org-block face * lisp/org-src.el (org-src-font-lock-fontify-block): Inherit org-block face. --- lisp/org-src.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index f3a0960..9668096 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -494,21 +494,27 @@ as `org-src-fontify-natively' is non-nil." (when (fboundp lang-mode) (let ((string (buffer-substring-no-properties start end)) (modified (buffer-modified-p)) - (org-buffer (current-buffer)) pos next) + (org-buffer (current-buffer))) (remove-text-properties start end '(face nil)) (with-current-buffer (get-buffer-create - (concat " org-src-fontification:" (symbol-name lang-mode))) - (delete-region (point-min) (point-max)) + (format " *org-src-fontification:%s*" lang-mode)) + (erase-buffer) (insert string " ") ;; so there's a final property change (unless (eq major-mode lang-mode) (funcall lang-mode)) (org-font-lock-ensure) - (setq pos (point-min)) - (while (setq next (next-single-property-change pos 'face)) - (put-text-property - (+ start (1- pos)) (1- (+ start next)) 'face - (get-text-property pos 'face) org-buffer) - (setq pos next))) + (let ((pos (point-min)) next) + (while (setq next (next-single-property-change pos 'face)) + (let ((new-face (get-text-property pos 'face))) + (put-text-property + (+ start (1- pos)) (1- (+ start next)) 'face + (list :inherit (append (and new-face (list new-face)) + (list 'org-block))) + org-buffer)) + (setq pos next)) + ;; Add the face to the remaining part of the font. + (put-text-property (1- (+ start pos)) end 'face + '(:inherit org-block) org-buffer))) (add-text-properties start end '(font-lock-fontified t fontified t font-lock-multiline t)) -- 2.8.3 --=-=-=--