New answers tagged

0

Lisp code is evaluated by Org babel inside a save-window-excursion, so when you do switch-to-buffer in your code, you do switch to the buffer momentarily, but as soon as the evaluation is over, you are back in the Org mode buffer in order to format and print the result of the evaluation. The doc string of save-window-excursion says: Execute BODY, then ...


2

It depends on what you want to do with the tables of course, but assuming that you want to produce generic Org mode tables that can be exported in the standard way, you will have to make the python block produce the structure that Org Babel expects in order to produce the generic Org mode table. That structure is a list of lists: first a list for the headers,...


0

Found this thread whilst trying to work out how to do exactly this and have another solution that leverages the to_html() method. #+BEGIN_SRC python :exports results :results html import pandas as pd import numpy as np n = 1000 low = 0 high = 100 df = pd.DataFrame({'x': np.random.random_integers(low, high, size=n), 'y': np.random....


1

You could add the non-breaking space as a new font-lock keyword to python-mode: ;; I'm defining a new face, though any face with underline should work (defface my-nobreak-space '((t :inherit default :underline t)) "My non-breaking space face.") (font-lock-add-keywords 'python-mode '(("\u00a0" . 'my-nobreak-space))) (add-hook 'org-...


1

Use the header argument :results silent to suppress the #+RETULTS: output of a single source block. With the header argument, the results are shown in the message buffer instead. Minimal working example: #+BEGIN_SRC emacs-lisp :results silent "This string goes to the message buffer instead of popping up below the source block." #+END_SRC How you ...


1

You can define header vars in various ways, e.g. globally: #+PROPERTY: header-args :var COMPILE_FLAGS="-std=c99 -Wall -Werror -pedantic" #+begin_src shell echo "${COMPILE_FLAGS}" #+end_src or in a property drawer in a specific section: * foo :PROPERTIES: :header-args: :var COMPILE_FLAGS="-std=c99 -Wall -Werror -pedantic" :END: ...


0

For those having this problem and using Oh My Zsh for your config, you might try changing your Oh My Zsh theme. I had this same problem and was able to fix it by changing the theme from "robbyrussell" (the default) to the "bira" theme. I suspect the problem has something to do with the special characters used in the prompt for the theme.


2

If you want to configure it in .org format instead of Lisp, so that you can keep your property declarations the between files as in a specific file, then you can use the #+SETUPFILE setting: The setup file or a URL pointing to such file is for additional in-buffer settings. Org loads this file and parses it for any settings in it only when Org opens the ...


2

Have a look at Adding keymaps to src blocks by John Kitchin. It does more than you want. You can edit src blocks as you would normally edit code of that type. There is a link to a file in org-mode that you can download and evaluate to make this available for you. You will need to adapt the recipes he gives for your needs. The major problem is defining the ...


Top 50 recent answers are included