[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] :noweb-ref property inheritance failure?

From: D Bro
Subject: [O] :noweb-ref property inheritance failure?
Date: Tue, 18 Apr 2017 18:44:41 -0500

Both 26.0 and 25.1 on OS X 10.12 via homebrew, using the Spacemacs configuration.

I recently tried the weaving technique from http://orgmode.org/manual/noweb_002dref.html#noweb_002dref :

* Create 
#+NAME: TestDemo2
#+BEGIN_SRC java :classname TestDemo2 :noweb yes :tangle yes

#+BEGIN_SRC elisp
(format "%s" (org-babel-expand-src-block testdemo2))

**Let's see what our code-weaving produces
:header-args: :noweb-ref testdemo2

*** this is how we will assemble our code:
  #+BEGIN_SRC java
    public class Yo {
      public static void main (Args[]) {

*** body
  #+BEGIN_SRC java
     return "The test worked!";
*** foot
  #+BEGIN_SRC java
    // <<test-foot>>
*** weave together
- which will weave together the above blocks to produce this:

  #+BEGIN_SRC shell :results org :exports none
  cat TestDemo2.java

I have tried both   (setq org-use-property-inheritance (quote (noweb-ref))) and   (setq org-use-property-inheritance t), both at org-mode load and from within the org file in question.  Also, note that I am using the 9.0 syntax, which I believe Spacemacs loads as part of its org-mode layer.

The result is always an empty TestDemo2.java file.  What’s interesting is that if I run org-babel-expand-src-block I see this:

public class Yo {
  public static void main (Args[]) {
return "The test worked!";
cat TestDemo2.java

If I add :noweb-ref to each block, it works.

- OS: darwin
- Emacs: 25.1.1
- Spacemacs: 0.200.9
- Spacemacs branch: develop (rev. 4b92183c)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:

My org-mode config (org-plus-contrib-20170210)

;; org-mode
  (with-eval-after-load 'org
    ;; Turning `org-use-property-inheritance' on can cause significant overhead when doing a search, which is why it is not on by default.
    (setq org-use-property-inheritance t)
    (setq org-reveal-root "/usr/workspace/reveal.js")
    (setq org-src-fontify-natively t)
    (setq org-src-tab-acts-natively t)
    (setq org-confirm-babel-evaluate nil)
    (setq org-export-babel-evaluate nil)
    (setq org-startup-indented t)
    (setq org-imenu-depth 3) ;;; increase imenu depth to include third level headings
    (setq org-ditaa-jar-path "/usr/local/bin/ditaa")
    (setq org-html-checkbox-type 'html)
    (setq org-hide-emphasis-markers t)
    (setq org-src-window-setup 'other-window) ;; reuses another open buffer window
    (add-hook 'org-mode-hook 'org-display-inline-images) 
    (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) ;;; Update images from babel code blocks automatically

      ;;; LaTex
    ;; To perform full-document previews (that is, aside from the inline previewing
    ;; under SPC m p), add the following to your .spacemacs under
    ;; dotspacemacs/user-config.  Then when you open up a compiled PDF, the preview
    ;; will update automatically when you recompile.
    (add-hook 'doc-view-mode-hook 'auto-revert-mode)
    ;; Don't use CDLaTeX mode itself under Org mode, but use the light version
    ;; org-cdlatex-mode that comes as part of Org mode. Turn it on for the current
    ;; buffer with M-x org-cdlatex-mode RET, or for all Org files with
    (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
    (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0)) ;;
    (setq org-format-latex-options (plist-put org-format-latex-options :justify 'center)) ;;
    (setq org-pandoc-options-for-latex-pdf '((latex-engine . "xelatex")));;  "pdflatex")));; "lualatex")));;
    (add-to-list 'org-latex-packages-alist '("" "tikz" t))
    (setq org-latex-create-formula-image-program 'imagemagick)
    (eval-after-load "preview" '(add-to-list 'preview-default-preamble "\\PreviewEnvironment{tikzpicture}" t))
    (setq org-latex-logfiles-extensions (quote ("lof" "lot" "tex~" "aux" "idx" "log" "out" "toc" "nav" "snm" "vrb" "dvi" "fdb_latexmk" "blg" "brf" "fls" "entoc" "ps" "spl" "bbl")))

    (define-key evil-normal-state-map (kbd "zp") 'org-toggle-latex-fragment)

    ;; (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)) 
    (require 'ob-haskell)
    (require 'ob-scala)
    (require 'ob-dot)
    (require 'ob-ditaa)
    (require 'ob-shell)
    (require 'ob-C)
    (require 'ob-dot)
    (require 'ob-gnuplot)
    (require 'ob-java)
    (require 'ob-org)

    (add-to-list 'org-babel-load-languages '(haskell    . t))
    ;; (erlang . t)
    (add-to-list 'org-babel-load-languages '(elixir     . t))
    ;; (ipython . t)
    (add-to-list 'org-babel-load-languages '(python     . t))
    (add-to-list 'org-babel-load-languages '(java       . t))
    (add-to-list 'org-babel-load-languages '(js         . t))
    (add-to-list 'org-babel-load-languages '(ruby       . t))
    (add-to-list 'org-babel-load-languages '(emacs-lisp . t))
    (add-to-list 'org-babel-load-languages '(C          . t))
    (add-to-list 'org-babel-load-languages '(latex      . t))
    (add-to-list 'org-babel-load-languages '(ditaa      . t))
    (add-to-list 'org-babel-load-languages '(gnuplot    . t))
    (add-to-list 'org-babel-load-languages '(dot        . t))
    (add-to-list 'org-babel-load-languages '(latex      . t))
    ;; (org     . t)
    (add-to-list 'org-babel-load-languages '(calc       . t))
    (add-to-list 'org-babel-load-languages '(shell      . t))
    (add-to-list 'org-babel-load-languages '(org        . t))

    ;; redefines source code block templae to provide a name
    (add-to-list 'org-structure-template-alist
                 '("s" "#+NAME: ?\n#+BEGIN_SRC \n\n#+END_SRC"))


  (eval-after-load "preview"
    '(add-to-list 'preview-default-preamble "\\PreviewEnvironment{tikzpicture}" t))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]