emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* :noweb-ref property inheritance failure?
@ 2017-04-18 23:44 D Bro
  2017-04-19  2:04 ` Charles C. Berry
  0 siblings, 1 reply; 4+ messages in thread
From: D Bro @ 2017-04-18 23:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 6736 bytes --]

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 <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref> :

* Create 
#+NAME: TestDemo2
#+BEGIN_SRC java :classname TestDemo2 :noweb yes :tangle yes
  <<testdemo2>>
#+END_SRC

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

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

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

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

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

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:
- System configuration features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

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
    ;; https://www.mfoot.com/static/emacs-config/config.html
    (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
    ;; https://github.com/syl20bnr/spacemacs/tree/master/layers/+lang/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)
    ;; http://orgmode.org/manual/CDLaTeX-mode.html#CDLaTeX-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)
    ;; http://stackoverflow.com/questions/11272236/how-to-make-formule-bigger-in-org-mode-of-emacs
    (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")));;
    ;; http://bnbeckwith.com/blog/org-mode-tikz-previews-on-windows.html
    (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))
    ;; http://emacs.stackexchange.com/questions/23982/cleanup-org-mode-export-intermediary-file
    (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))

    ;; http://emacs.stackexchange.com/questions/12841/quickly-insert-source-blocks-in-org-mode
    ;; 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"))


    )

  ;; http://bnbeckwith.com/blog/org-mode-tikz-previews-on-windows.html
  (eval-after-load "preview"
    '(add-to-list 'preview-default-preamble "\\PreviewEnvironment{tikzpicture}" t))


  )





[-- Attachment #2: Type: text/html, Size: 12334 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: :noweb-ref property inheritance failure?
  2017-04-18 23:44 :noweb-ref property inheritance failure? D Bro
@ 2017-04-19  2:04 ` Charles C. Berry
  2017-04-19  2:47   ` D Bro
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2017-04-19  2:04 UTC (permalink / raw)
  To: D Bro; +Cc: emacs-orgmode

On Tue, 18 Apr 2017, D Bro wrote:

> 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 
> <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref> :

[snip]

Using M-x org-lint on your example gives

      3 high  Unknown header argument ":classname"
     12 high  Incorrect location for PROPERTIES drawer

The latter is because the drawer is not immediately after a headline and 
is disregarded:

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

If you put a space between `**' and `L[...]' the line becomes a valid 
headline. Then the TestDemo2 src block produces

  ,----
   | public class Yo {
   | public static void main (Args[]) {
   | return "The test worked!";
   | //
   | }}
   | cat TestDemo2.java
   `----

on ASCII export.

You can ignore the message about :classname, which comes from ob-java not 
defining it as a header-arg.

HTH,

Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: :noweb-ref property inheritance failure?
  2017-04-19  2:04 ` Charles C. Berry
@ 2017-04-19  2:47   ` D Bro
  2017-04-19  2:53     ` D Bro
  0 siblings, 1 reply; 4+ messages in thread
From: D Bro @ 2017-04-19  2:47 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]

Many thanks—especially for the quick response.  Unfortunately, no go.

The headline was a copy and paste issue into the email — my org-lint only complains about the :classname (I didn’t even know about org-lint, thank you!)
Export to Ascii produces:

… 
1 Create
========

  ,----
  | <<testdemo2>>
  `----


1.1 Let's see what our code-weaving produces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1.1.1 this is how we will assemble our code:
--------------------------------------------

  ,----
  | public class Yo {
  |   public static void main (Args[]) {
  `----


1.1.2 body
----------

  ,----
  | return "The test worked!";
  `----


1.1.3 foot
----------

  ,----
  | // <<test-foot>>
  | }}
  `----


1.1.4 weave together
--------------------

  - which will weave together the above blocks to produce this:

    ,----
    | cat TestDemo2.java
    `——

Ed

> On Apr 18, 2017, at 9:04 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:
> 
> On Tue, 18 Apr 2017, D Bro wrote:
> 
>> 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 <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref> :
> 
> [snip]
> 
> Using M-x org-lint on your example gives
> 
>     3 high  Unknown header argument ":classname"
>    12 high  Incorrect location for PROPERTIES drawer
> 
> The latter is because the drawer is not immediately after a headline and is disregarded:
> 
>> **Let's see what our code-weaving produces
>> :PROPERTIES:
>> :header-args: :noweb-ref testdemo2
>> :END:
> 
> If you put a space between `**' and `L[...]' the line becomes a valid headline. Then the TestDemo2 src block produces
> 
> ,----
>  | public class Yo {
>  | public static void main (Args[]) {
>  | return "The test worked!";
>  | //
>  | }}
>  | cat TestDemo2.java
>  `----
> 
> on ASCII export.
> 
> You can ignore the message about :classname, which comes from ob-java not defining it as a header-arg.
> 
> HTH,
> 
> Chuck


[-- Attachment #2: Type: text/html, Size: 4728 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: :noweb-ref property inheritance failure?
  2017-04-19  2:47   ` D Bro
@ 2017-04-19  2:53     ` D Bro
  0 siblings, 0 replies; 4+ messages in thread
From: D Bro @ 2017-04-19  2:53 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]

PS  I verified that in addition to org-use-property-inheritance, I have org-babel-use-quick-and-dirty-noweb-expansion set to nil, since the documentation and mailing list indicate that’s not compatible with property inheritance.

It’s good (and bad :) to know it’s just my config, based on it working for you…

> On Apr 18, 2017, at 9:47 PM, D Bro <dabroyoh@gmail.com> wrote:
> 
> Many thanks—especially for the quick response.  Unfortunately, no go.
> 
> The headline was a copy and paste issue into the email — my org-lint only complains about the :classname (I didn’t even know about org-lint, thank you!)
> Export to Ascii produces:
> 
> … 
> 1 Create
> ========
> 
>   ,----
>   | <<testdemo2>>
>   `----
> 
> 
> 1.1 Let's see what our code-weaving produces
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 1.1.1 this is how we will assemble our code:
> --------------------------------------------
> 
>   ,----
>   | public class Yo {
>   |   public static void main (Args[]) {
>   `----
> 
> 
> 1.1.2 body
> ----------
> 
>   ,----
>   | return "The test worked!";
>   `----
> 
> 
> 1.1.3 foot
> ----------
> 
>   ,----
>   | // <<test-foot>>
>   | }}
>   `----
> 
> 
> 1.1.4 weave together
> --------------------
> 
>   - which will weave together the above blocks to produce this:
> 
>     ,----
>     | cat TestDemo2.java
>     `——
> 
> Ed
> 
>> On Apr 18, 2017, at 9:04 PM, Charles C. Berry <ccberry@ucsd.edu <mailto:ccberry@ucsd.edu>> wrote:
>> 
>> On Tue, 18 Apr 2017, D Bro wrote:
>> 
>>> 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 <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref> <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref <http://orgmode.org/manual/noweb_002dref.html#noweb_002dref>> :
>> 
>> [snip]
>> 
>> Using M-x org-lint on your example gives
>> 
>>     3 high  Unknown header argument ":classname"
>>    12 high  Incorrect location for PROPERTIES drawer
>> 
>> The latter is because the drawer is not immediately after a headline and is disregarded:
>> 
>>> **Let's see what our code-weaving produces
>>> :PROPERTIES:
>>> :header-args: :noweb-ref testdemo2
>>> :END:
>> 
>> If you put a space between `**' and `L[...]' the line becomes a valid headline. Then the TestDemo2 src block produces
>> 
>> ,----
>>  | public class Yo {
>>  | public static void main (Args[]) {
>>  | return "The test worked!";
>>  | //
>>  | }}
>>  | cat TestDemo2.java
>>  `----
>> 
>> on ASCII export.
>> 
>> You can ignore the message about :classname, which comes from ob-java not defining it as a header-arg.
>> 
>> HTH,
>> 
>> Chuck
> 


[-- Attachment #2: Type: text/html, Size: 5609 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-19  2:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 23:44 :noweb-ref property inheritance failure? D Bro
2017-04-19  2:04 ` Charles C. Berry
2017-04-19  2:47   ` D Bro
2017-04-19  2:53     ` D Bro

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).