From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: colored code background in org 8.3
Date: Sat, 04 Jun 2016 00:12:56 +0200 [thread overview]
Message-ID: <8760tpx6on.fsf@gmx.us> (raw)
In-Reply-To: m2h9ddrwcz.fsf@andrew.cmu.edu
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
John Kitchin <jkitchin@andrew.cmu.edu> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-src-src-blocks-also-inherit-org-block-face.patch --]
[-- Type: text/x-diff, Size: 2078 bytes --]
From 86244d84f8846489b893039749d724287c2c5dcd Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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
next prev parent reply other threads:[~2016-06-03 22:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 11:18 colored code background in org 8.3 John Kitchin
2016-06-03 22:12 ` Rasmus [this message]
2016-06-05 12:46 ` John Kitchin
2016-06-07 11:33 ` Sebastien Vauban
2016-06-07 15:07 ` Rasmus
2016-06-07 16:02 ` Samuel W. Flint
2016-06-09 11:43 ` Nicolas Goaziou
2016-06-09 13:45 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8760tpx6on.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).