45

Yes, you certainly can, you can use org-babel-load-file to do this. In your init.el, put the following: (require 'org) (org-babel-load-file (expand-file-name "settings.org" user-emacs-directory)) (I'm using ~/.emacs.d/settings.org but that is personal preference). In the settings.org file you can arrange it however you would like, ...


22

If all you want is selective showing of sections and navigation between headings, you don't need Org mode. All you need is Outline mode. Outline mode is basically the header level and section visibility management of Org mode. In fact, Org mode was originally the author's extensions to Outline mode, and grew, and grew, and grew… Even today, org-mode is ...


14

Literate programming takes you the most way there, org-mode supports it via org-babel. Two possible solutions are explained on @malabarba's blog: The simplest way is loading org-mode, then using its untangling feature to load a literate Emacs configuration: (require 'org) (org-babel-load-file (expand-file-name "emacs-init.org" user-...


6

Yes, it's org-babel-detangle. org-babel-detangle is an interactive compiled Lisp function in ob-tangle.el. (org-babel-detangle &optional SOURCE-CODE-FILE) Propagate changes in source file back original to Org file. This requires that code blocks were tangled with link comments which enable the original code blocks to be found. You ...


5

If you want to add to the value of an existing property, append a ‘+’ to the property name. (info "(org) Property syntax") That means your property drawer should be :PROPERTIES: :header-args: :dir ./folder :header-args+: :results output :header-args+: :var NAME='Alex' :END:


5

One more vote for outline-mode. For example for organaizing .emacs I use the following syntax: ;;; HEADING: the important parts are ;;; and :\n (add-hook 'emacs-lisp-mode-hook (lambda () (make-local-variable 'outline-regexp) (setq outline-regexp "^;;; ") (make-local-variable 'outline-heading-end-regexp) ...


5

For literate programming, revise the existing tangle block and rely on your version control system to maintain the history. The examples you're referring to sound more like engineering notebooks / journals where the author is keeping a record of activities performed. While I highly recommend keeping an engineering notebook, keeping a lot of dead code ...


5

You're very close! Two changes: For the R code, you'll need a few more headers: #+BEGIN_SRC R :results output graphics :file test.png library("ggplot2") ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + geom_point() #+END_SRC (Note that the headers change slightly depending on whether you want to use base R, as in your example, ...


5

You can bookmark any file, or any part of a code/text file. You can even bookmark a region (and have the region activated when you jump to the bookmark). A bookmark can have an annotation, and that annotation can be simple text or a separate Org file. Bookmarks are saved in a separate file from the places they bookmark. (And you can have multiple bookmark ...


4

From (org) Structure of code blocks: Live code blocks can also be specified inline using src_<language>{<body>} or src_<language>[<header arguments>]{<body>} So you should be able to use src_perl{set $random_var=1;} instead of the full block.


4

You can try the command list-org-src from the following elisp code. It is tested with emacs 25.3.1 and org-mode 9.1.6. Install the source in your init file (after (package-initialize)). Open your org file and type M-x list-org-src RET. That creates an org-src buffer with a tabulated list of the source code block entries. Each entry has the following ...


4

Use Literate DevOps Method I recommend using the literate devops method via org-mode, that @phils suggested in the comments, because of the ease of use and adaptable workflow. Example Workflow Create or open an org-mode file to store an manage your notes and annotations. e.g. C-x C-f ex1-annotations.org Add a new shell SRC code block using built-in easy ...


4

There is a :main header argument defined in ob-C. :main no avoids the wrapping.


3

The key was to use the :noweb options. One of them, strip-export, let's you add a snippet to the code when tangling but hiding it in the document. Other option is tangle, which is similar but exports to the pdf a reference like <<imports>>. This is the org file that creates the desired behaivour: * Generic section #+BEGIN_SRC python :noweb ...


3

On the following SO answer you will see how to do it, example projects using one single org file or many, what's the benefit of using Cask and links to documentation. https://stackoverflow.com/questions/25430029/whats-the-best-way-to-package-my-emacs-installation-packages-and-config-so-tha/25430745#25430745 I turned my config to org a few months ago, and I ...


3

Your initial steps are a good starting point. You can implement #2 using Babel Templates and sessions. Having all the source blocks run in one sessions means you can easily split them into multiple chunks with the same result. Just make sure when you split it, it is not inside a loop. That would be OK for when you tangle, but it wouldn't let you execute the ...


3

You can use poporg for this. People mostly use it to edit comments in Org mode, but you can use whatever mode you want by setting poporg-edit-hook. (remove-hook 'poporg-edit-hook 'org-mode) (add-hook 'poporg-edit-hook 'markdown-mode)


3

Please try a src block variable like: :var fileName=(buffer-file-name) and then you have the current file name accessible in python in the variable named fileName You might set a property line in the begining of your file #+PROPERTY: header-args:python :var fileName=( buffer-file-name) and you have the variable in ever python src block. Don't forget to ...


3

You can use an :around advice for org-html-src-block to wrap the code block generated by org-html-src-block with your own html block, e.g.: <div style="background-color:lightgray">. But there is a little subtlety. The argument src-block of org-html-src-block is not really the parse tree of the original buffer. In the process of copying, parsing and ...


3

You already have necessary code to enable go support for org-babel in your init file, it's just commented out. All it takes to enable it is to uncomment them. Change the following part (which is right at the end of your init file): ; i want use ob-go , above code just compile the code ;(require 'ob-go) ;(org-babel-do-load-languages ;'org-babel-load-...


2

I found the solution to your problem. Your file should look like this #+name: conceptmap #+begin_src org :exports none (ONE) {TWO} (THREE) (FOUR) {FIVE} (SIX) #+end_src #+begin_src emacs-lisp :noweb yes (downcase " <<conceptmap2>> " ) #+end_src Pay close attention to the ", as your original "input" would be parsed directly and ...


2

A standard feature of babel blocks is each block is executed in a new interpreter. Often this is good as changes in one block doesn't mess up others. I have two ideas for you... In this particular case, you could break up the first block in two, so that the first block called the c function and spit out its results in a table that has the name, <...


2

You have #+end_src emacs-lisp. This confuses org-babel. Use just #+end_src. Use the easy template system to insert structural elements and avoid such issues. Source blocks are <s <TAB>.


2

Short Answer - Update the original code block and tangle again. Adding the same :tangle header to separate code blocks will concatenate the code when tangling the entire buffer with C-c C-v t but will only tangle the current code block into the file if C-u C-c C-v t is used. This behavior can be confusing when tangling. In your use case, you created a ...


2

Try this The reason why the error happens is because you haven't defined y in the x=y arguments. If you update code as follows noweb will work #+NAME: cubed-plus-cubed #+BEGIN_SRC python :noweb eval return <<cubed(x=3)>> + <<cubed(x=3)>> #+END_SRC #+RESULTS: cubed-plus-cubed : 54 However I suspect this is not what you wanted ...


2

Here's what Nick Dokos (who has helped me often) over at the org-mode mail list says: ...tangling does not run code blocks: it just writes them out to (one or many) different file(s). org-babel-load-file calls org-babel-tangle which is an autoloaded function, so when it is called, emacs arranges to load the file that defines it (i.e. ob-tange.el[...


2

For navigation and symbol definition see https://github.com/jkitchin/scimax/blob/master/scimax-literate-programming.el You can generate a TAGS file with M-x scimax-lp-generate-tags. After this, I can navigate to function definitions with M-. and M-,. You need to refresh the TAGS file with that function as things move around and get added, but maybe that ...


2

There is also org-tanglesync, which has a much simpler method of syncing than org-babel-detangle Essentially if a block is tangled to an external file, then every time that block is edited the external file is checked also, and if a diff is detected, the user is prompted to either reject or pull the external changes into the org src block. This also has ...


2

Define a new function in elisp using Org Element API to that returns :title property of headline element. For this answer, I wrote a headline-title function that returns the :title of the nearest headline above the SRC block. (defun headline-title() (let* ((x (save-mark-and-excursion (org-up-heading-safe) (org-element-property :...


2

Apparently this can be fixed by using :noweb-ref instead: * FOO #+BEGIN_SRC emacs-lisp :noweb-ref require (require 'foo) #+END_SRC #+BEGIN_SRC emacs-lisp :noweb-ref execute (foo-setup) #+END_SRC * BAR #+BEGIN_SRC emacs-lisp :noweb-ref require (require 'bar) #+END_SRC #+BEGIN_SRC emacs-lisp :noweb-ref execute (bar-setup) #+END_SRC


Only top voted, non community-wiki answers of a minimum length are eligible