Continue fixing refs
[worg.git] / org-contrib / babel / examples / fontify-src-code-blocks.org
blob3e5b18d16b74f2039673e0c2e083709e7bdc892c
1 #+TITLE:     Pretty fontification of source code blocks\r
2 #+AUTHOR:    Sebastien Vauban\r
3 #+EMAIL:     sva@mygooglest.com\r
4 #+DATE:      2012-01-25\r
5 #+DESCRIPTION:\r
6 #+KEYWORDS:\r
7 #+LANGUAGE:  en_US\r
8 \r
9 * Description\r
11 This article is some "theming guide" about customizing the look and feel of an\r
12 Org-Babel buffer inside Emacs. We'll show you how you can improve the\r
13 appearance of source code blocks.\r
15 Note that coloring the background of code blocks with native\r
16 fontification no longer works as of [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f8b42e8][commit f8b42e8]].\r
18 * Screenshot\r
20 Screenshot for the [[https://github.com/fniessen/color-theme-leuven][Leuven]] theme (light theme, i.e. with a white background):\r
22 [[file:../images/fontified-src-code-blocks.png]]\r
24 To configure "native fontification" (as in the above screenshot), set the\r
25 following in your =.emacs= file:\r
27 #+begin_src emacs-lisp\r
28 ;; fontify code in code blocks\r
29 (setq org-src-fontify-natively t)\r
30 #+end_src\r
32 * Configuration File\r
34 - To get the above full contributed theme, please visit [[file:../../../org-color-themes.org][Installing Org Color\r
35   themes]] and copy the file [[https://github.com/fniessen/color-theme-leuven/blob/master/color-theme-leuven.el][color-theme-leuven.el]] in your =load-path=.\r
37 - If you want to keep your existing Emacs color theme, and you only want to\r
38   customize the "delimiter lines" of the code blocks, either:\r
40   + Add the following lines to your current color theme:\r
42     #+begin_src emacs-lisp\r
43     (org-block-begin-line\r
44      ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))\r
45     (org-block-background\r
46      ((t (:background "#FFFFEA"))))\r
47     (org-block-end-line\r
48      ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))\r
49     #+end_src\r
51   + Define these faces, in your =.emacs= file, /before/ requiring Org (if you\r
52     don't have your own color theme):\r
54     #+begin_src emacs-lisp\r
55     (defface org-block-begin-line\r
56       '((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))\r
57       "Face used for the line delimiting the begin of source blocks.")\r
59     (defface org-block-background\r
60       '((t (:background "#FFFFEA")))\r
61       "Face used for the source block background.")\r
63     (defface org-block-end-line\r
64       '((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))\r
65       "Face used for the line delimiting the end of source blocks.")\r
66     #+end_src\r
68 * Further extensions\r
70 When we will have some spare time, our intention is to get the reserved\r
71 keywords of Org-Babel (such as =:var= and =:exports=) somehow highlighted.\r
72 Stay tuned -- or give some help!\r