Why doesn't this org-mode header-arg get applied? - emacs

When I try to run this:
** Header name
:PROPERTIES:
:header-args: :noweb yes
:END:
#+NAME: prop_test
#+begin_src sh
echo "...and it worked!"
#+end_src
#+begin_src sh
echo "Beginning expansion..."
<<prop_test>>
#+end_src
I get the error sh: 2: Syntax error: end of file unexpected.
If I add :noweb yes to the code header, it executes as expected. I thought the :header-args: property was supposed to do that automatically, but apparently it isn't. I've tried removing the whitespace separating the snippets and (unsurprisingly) it doesn't make a difference. I've tried specifying that the property is for sh (:header-args:sh:) but that doesn't do it either. Why doesn't the header-arg get applied?

I'm not sure why the code in the question doesn't work, since it's what's in the org-mode manual. What does work is the following, which I got from a different org-mode manual:
* Header name
:PROPERTIES:
:noweb: yes
:END:

The syntax was changed with Org 8.0. The syntax in your answer is for <8.0. You are probably using your distro's Org which is still 7.something. You can set Orgmode.org as a source for package.el or el-get to stay with the latest org.
For the record, the code in your question yields:
1.1 Header name
───────────────
┌────
│ echo "...and it worked!"
└────
┌────
│ echo "Beginning expansion..."
│ echo "...and it worked!"
└────

Related

emacs verilog moide:full command that include verilog-library-directories

I use the Verilog mode from emacs.
My question is:
What is full syntax of command that includes verilog-library-directories ?
emacs --batch f.sv -q --eval='(setq-default verilog-typedef-regexp
".*_t$")' -f verilog-batch-auto
For including verilog libraries I use the following comment at the end of the file:
// verilog-library-flags:("-y ../rtl")
I think then you can reuse this syntax for command line.

dot2tex in org-mode and latex commandline arguments

I used to make tree diagrams with dot in orgmode.
#+BEGIN_SRC dot :file hallo1_1_1.png
digraph hallo1_1_1 {
A [shape = "circle",style=filled, fillcolor=yellow]
}
#+END_SRC
Now, to pass latex commands (\def\mycommand{args})to my diagrams I would like to use dot2tex.
(the usepackages are in ~/.emacs)
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{graphicx}
\\usepackage{longtable}
\\usepackage{listings}
\\usepackage{xcolor}
\\usepackage{float}
\\usepackage{soul}
\\usepackage{amssymb}
\\usepackage{hyperref}
\\usepackage{sectsty}
\\usepackage{tabularx}
\\usepackage{pbox}
\\usepackage{tikz}
\\usepackage{stackengine}
\\usepackage{verbatim}
\\usepackage{changepage}
\\usepackage{dot2texi}
\\usepackage[pdf]{graphviz}
\\usetikzlibrary{shapes,arrows}
After using in my test.org:
#+headers: :cmdline latex -shell-escape
#+BEGIN_SRC latex
\digraph[scale=0.5]{MyGraph}{rankdir=LR; a->b; b->c}
#+END_SRC
I got the warning:
The file MyGraph.pdf hasn’t been created from MyGraph.dot yet.
Run ‘dot -Tpdf -o MyGraph.pdf MyGraph.dot’ to create it.
Or invoke LATEX with the -shell-escape option to have this done
automatically.
Is it possible to add the commandline arguments in the file correctly?
I would like the commandline arguments in the file for workflow reasons.
Thank you.

Org Mode tangle comment

with this line in a file i'm tangling:
#+BEGIN_SRC shell :tangle ./tangle/aux.0 :comments link :paddling no
on tangling, this prompt appears:
"No comment syntax is define. Use: [ ]"
What needs to be set, or text entered in the source file to avoid the prompt?
I've tried:
# <<example>>
or
#
on the first line.
or ... comment-syntax #
after the ":comments link"
and searched the help for examples.
I'm reading the Org Manual, and emacs help, and not finding any specific instructions.
I believe your problem is because emacs cannot determine/recognise the correct mode for the exported source. As it does not recognise the mode, it cannot determine the correct comment character.
According the the org manual, the correct identifier for shell blocks is sh not shell. Try changing your line to
#+BEGIN_SRC sh :tangle ./tangle/aux.0 :comments link :paddling no

Current buffer name as argument to org babel source block

How do I pass the current file with its path to one of my source block in org-babel? For example:
#+name: cflow
#+header: var file=<what to put here?>
#+begin_src sh :exports none
# output posix format
# -i <symbol> include name start with <symbol> file
# brief input
cflow --format=posix -i _ --brief
#+end_src
I want the command to execute at the current directory of my buffer.
This will do it:
var file=(buffer-file-name)

Organizing my papers in org-mode

I've just started using org-mode, and so far find it quite useful. I have a very large collection of technical papers in a directory tree, and I'd like to go through them and index them through org-mode. What I'd like is to have a way of going through them and look at the unannotated ones, and annotate them one by one. I imagine doing this by first making up a file of links like [[xxx.pdf][not done yet]], and then being presented with the not done ones, glancing at them and deciding how what annotations to put in. In addition I'd like to add tags. What I'd really like is to be able to make up new tags on the fly. Has anyone done anything like this in org-mode?
Victor
If you have your papers organized like this,
% ls -1 ~/References/functional-programming
The Lambda Calculus.pdf
Recursive Functions of Symbolic Expressions and Their.pdf
you can run a quick script to build an org-file. Save the following as make-org and run it from your directory of papers (sh make-org > papers.org).
#! /bin/sh
#
# make-org -- generates an org-mode file from a directory of PDFs
#
# AUTHOR:
# Jon-Michael Deldin
# USAGE:
# cd ~/path/to/papers && make-org > papers.org
#
echo "#+TITLE: Research Papers"
echo "#+STARTUP: align hidestars indent lognotedone"
echo
for f in *.pdf; do
name=${f%.*} # strip extension
path=$(echo $f | sed 's/ /%20/') # encode spaces as %20
echo "* TODO $name :unread:"
echo
echo "[[file:$path][$name]]"
echo
done
Open papers.org in Emacs, run C-u C-c C-q to realign the tags. Your file should now look like this:
In addition I'd like to add tags. What I'd really like is to be able to make up new tags on the fly.
Once you have a headline (thing with * at the beginning, you can hit C-c C-c and add any tag you want.
You may find this detailed write-up of using org-mode and RefTeX or this alternate approach useful, especially if you use LaTeX.
Heres is the modified version that works on a directory.
#! /bin/sh
#
# make-org -- generates an org-mode file from a directory of PDFs
#
# AUTHOR:
# Jon-Michael Deldin
# USAGE:
# cd ~/path/to/papers && make-org > papers.org
#
echo "#+TITLE: Research Papers"
echo "#+STARTUP: align hidestars indent lognotedone"
echo
for f in $(find . -name '*.pdf'); do
name=${f%.*} # strip extension
path=$(echo $f | sed 's/ /%20/') # encode spaces as %20
echo "* TODO $name :unread:"
echo
echo "[[file:$path][$name]]"
echo
done