Re: [O] colored code background in org 8.3
Hi, Nicolas Goaziouwrites: >> I use the attached patch for some "interactive slides" with babel. > > It looks good, thank you. No worries, I needed it for my "slides", as I was told that src-blocks needed to stand more out. >> +;; Add the face to the remaining part of the font. > > Don't you mean "the remaining part of the text."? Yeah, most likely... Rasmus -- When in doubt, do it!
Re: [O] colored code background in org 8.3
Hello, Rasmuswrites: > I use the attached patch for some "interactive slides" with babel. It looks good, thank you. > + ;; Add the face to the remaining part of the font. Don't you mean "the remaining part of the text."? Regards, -- Nicolas Goaziou
Re: [O] colored code background in org 8.3
:: Rasmus writes: Rasmus> Sebastien Vaubanwrites: >> Hello all, >> >> Rasmus writes: >>> 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. >> >> Could it be put into the official code base, for all users to enjoy >> colored backgrounds without having to patch their Org by hand? Rasmus> Sure, eventually. Let me know if you have tested the patch and Rasmus> it works for you. Rasmus> I don’t know much about faces, but it should work across all Rasmus> relevant versions of Emacs. Rasmus> Aside: Speaking of prettifying src blocks, with Rasmus> prettify-symbols-mode I managed to make src-blocks look like Rasmus> this when the cursor is somewhere else Rasmus> λ LANGUAGE ☰ Rasmus> and like this otherwise Rasmus> #+begin_src LANGUAGE :keyword₁ value₁ ⋯ :keywordₙ valueₙ How do you do this? Thanks, Sam -- Samuel W. Flint 4096R/266596F4 (9477 D23E 389E 40C5 2F10 DE19 68E5 318E 2665 96F4) (λs.s s) λs.s s signature.asc Description: PGP signature
Re: [O] colored code background in org 8.3
Sebastien Vaubanwrites: > Hello all, > > Rasmus writes: >> 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. > > Could it be put into the official code base, for all users to enjoy > colored backgrounds without having to patch their Org by hand? Sure, eventually. Let me know if you have tested the patch and it works for you. I don’t know much about faces, but it should work across all relevant versions of Emacs. Aside: Speaking of prettifying src blocks, with prettify-symbols-mode I managed to make src-blocks look like this when the cursor is somewhere else λ LANGUAGE ☰ and like this otherwise #+begin_src LANGUAGE :keyword₁ value₁ ⋯ :keywordₙ valueₙ Rasmus -- Vote for proprietary math!
Re: [O] colored code background in org 8.3
Hello all, Rasmuswrites: > 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. Could it be put into the official code base, for all users to enjoy colored backgrounds without having to patch their Org by hand? Best regards, Seb -- Sebastien Vauban
Re: [O] colored code background in org 8.3
Thanks, this worked perfectly! Rasmus writes: > John Kitchinwrites: > >> 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. -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] colored code background in org 8.3
John Kitchinwrites: > 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 >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
[O] colored code background in org 8.3
Hi all, 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? -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu