emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* header argument :noweb-ref seems can't be resolved
@ 2017-12-17 14:58 stardiviner
  2017-12-17 17:40 ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: stardiviner @ 2017-12-17 14:58 UTC (permalink / raw)
  To: emacs-org-mode

I have the following org-mode file content:

```org

#+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
<<fullest-disk>>
#+end_src

** the mount point of the fullest disk
   :PROPERTIES:
   :header-args: :noweb-ref fullest-disk
   :END:

*** query all mounted disks

#+begin_src shell
   df \
#+end_src

*** strip the header row

#+begin_src shell
   | sed '1d' \
#+end_src

*** output mount point of fullest disk

#+begin_src shell
   | awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
#+end_src

```


When I press [C-c C-c] on first src block:

```org

#+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
<<fullest-disk>>
#+end_src

```

Emacs reports error:

```

Debugger entered--Lisp error: (error "<<fullest-disk>> could not be 
resolved (see ‘org-babel-noweb-error-langs’)")
   signal(error ("<<fullest-disk>> could not be resolved (see 
‘org-babel-noweb-error-langs’)"))
   error("%s could not be resolved (see `org-babel-noweb-error-langs')" 
"<<fullest-disk>>")
   (if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) "")
   (or (nth 2 (assoc (intern source-name) org-babel-library-of-babel)) 
(save-excursion (if (org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) #1#))
   (if evaluate (let ((raw (org-babel-ref-resolve source-name))) (if 
(stringp raw) raw (format "%S" raw))) (or (nth 2 (assoc (intern 
source-name) org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) #1#)))
   (split-string (if evaluate (let ((raw (org-babel-ref-resolve 
source-name))) (if (stringp raw) raw (format "%S" raw))) (or (nth 2 
(assoc (intern source-name) org-babel-library-of-babel)) (save-excursion 
(if (org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#1#))) "[\n\015]")
   (mapconcat (function identity) (split-string (if evaluate (let ((raw 
(org-babel-ref-resolve source-name))) (if (stringp raw) raw (format "%S" 
raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#1#))) "[\n\015]") (concat "\n" prefix))
   (save-restriction (widen) (mapconcat (function identity) 
(split-string (if evaluate (let ((raw (org-babel-ref-resolve 
source-name))) (if (stringp raw) raw (format "%S" raw))) (or (nth 2 
(assoc (intern source-name) org-babel-library-of-babel)) (save-excursion 
(if (org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#1#))) "[\n\015]") (concat "\n" prefix)))
   (save-current-buffer (set-buffer parent-buffer) (save-restriction 
(widen) (mapconcat (function identity) (split-string (if evaluate (let 
((raw (org-babel-ref-resolve source-name))) (if (stringp raw) raw 
(format "%S" raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#1#))) "[\n\015]") (concat "\n" prefix))))
   (funcall nb-add (save-current-buffer (set-buffer parent-buffer) 
(save-restriction (widen) (mapconcat (function identity) (split-string 
(if evaluate (let ((raw (org-babel-ref-resolve source-name))) (if 
(stringp raw) raw (format "%S" raw))) (or (nth 2 (assoc (intern 
source-name) org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #1="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#1#))) "[\n\015]") (concat "\n" prefix)))))
   (while (and (re-search-forward (org-babel-noweb-wrap) nil t)) (let 
#1=((save-match-data-internal (match-data))) (unwind-protect (progn 
(setq source-name (match-string 1))) #2=(set-match-data 
save-match-data-internal 'evaporate))) (let #1# (unwind-protect (progn 
(setq evaluate (string-match "(.*)" source-name))) #2#)) (let #1# 
(unwind-protect (progn (setq prefix (buffer-substring (match-beginning 
0) (save-excursion (beginning-of-line 1) (point))))) #2#)) (goto-char 
(match-beginning 0)) (funcall nb-add (buffer-substring index (point))) 
(goto-char (match-end 0)) (setq index (point)) (funcall nb-add 
(save-current-buffer (set-buffer parent-buffer) (save-restriction 
(widen) (mapconcat (function identity) (split-string (if evaluate (let 
((raw (org-babel-ref-resolve source-name))) (if (stringp raw) raw 
(format "%S" raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #3="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#3#))) "[\n\015]") (concat "\n" prefix))))))
   (progn (set (make-local-variable 'org-babel-noweb-wrap-start) 
ob-nww-start) (set (make-local-variable 'org-babel-noweb-wrap-end) 
ob-nww-end) (insert body) (goto-char (point-min)) (setq index (point)) 
(while (and (re-search-forward (org-babel-noweb-wrap) nil t)) (let 
#1=((save-match-data-internal (match-data))) (unwind-protect (progn 
(setq source-name (match-string 1))) #2=(set-match-data 
save-match-data-internal 'evaporate))) (let #1# (unwind-protect (progn 
(setq evaluate (string-match "(.*)" source-name))) #2#)) (let #1# 
(unwind-protect (progn (setq prefix (buffer-substring (match-beginning 
0) (save-excursion (beginning-of-line 1) (point))))) #2#)) (goto-char 
(match-beginning 0)) (funcall nb-add (buffer-substring index (point))) 
(goto-char (match-end 0)) (setq index (point)) (funcall nb-add 
(save-current-buffer (set-buffer parent-buffer) (save-restriction 
(widen) (mapconcat (function identity) (split-string (if evaluate (let 
((raw (org-babel-ref-resolve source-name))) (if (stringp raw) raw 
(format "%S" raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #3="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#3#))) "[\n\015]") (concat "\n" prefix)))))) (funcall nb-add 
(buffer-substring index (point-max))))
   (unwind-protect (progn (set (make-local-variable 
'org-babel-noweb-wrap-start) ob-nww-start) (set (make-local-variable 
'org-babel-noweb-wrap-end) ob-nww-end) (insert body) (goto-char 
(point-min)) (setq index (point)) (while (and (re-search-forward 
(org-babel-noweb-wrap) nil t)) (let #1=((save-match-data-internal 
(match-data))) (unwind-protect (progn (setq source-name (match-string 
1))) #2=(set-match-data save-match-data-internal 'evaporate))) (let #1# 
(unwind-protect (progn (setq evaluate (string-match "(.*)" 
source-name))) #2#)) (let #1# (unwind-protect (progn (setq prefix 
(buffer-substring (match-beginning 0) (save-excursion (beginning-of-line 
1) (point))))) #2#)) (goto-char (match-beginning 0)) (funcall nb-add 
(buffer-substring index (point))) (goto-char (match-end 0)) (setq index 
(point)) (funcall nb-add (save-current-buffer (set-buffer parent-buffer) 
(save-restriction (widen) (mapconcat (function identity) (split-string 
(if evaluate (let ((raw (org-babel-ref-resolve source-name))) (if 
(stringp raw) raw (format "%S" raw))) (or (nth 2 (assoc (intern 
source-name) org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #3="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#3#))) "[\n\015]") (concat "\n" prefix)))))) (funcall nb-add 
(buffer-substring index (point-max)))) (and (buffer-name temp-buffer) 
(kill-buffer temp-buffer)))
   (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(set (make-local-variable 'org-babel-noweb-wrap-start) ob-nww-start) 
(set (make-local-variable 'org-babel-noweb-wrap-end) ob-nww-end) (insert 
body) (goto-char (point-min)) (setq index (point)) (while (and 
(re-search-forward (org-babel-noweb-wrap) nil t)) (let 
#1=((save-match-data-internal (match-data))) (unwind-protect (progn 
(setq source-name (match-string 1))) #2=(set-match-data 
save-match-data-internal 'evaporate))) (let #1# (unwind-protect (progn 
(setq evaluate (string-match "(.*)" source-name))) #2#)) (let #1# 
(unwind-protect (progn (setq prefix (buffer-substring (match-beginning 
0) (save-excursion (beginning-of-line 1) (point))))) #2#)) (goto-char 
(match-beginning 0)) (funcall nb-add (buffer-substring index (point))) 
(goto-char (match-end 0)) (setq index (point)) (funcall nb-add 
(save-current-buffer (set-buffer parent-buffer) (save-restriction 
(widen) (mapconcat (function identity) (split-string (if evaluate (let 
((raw (org-babel-ref-resolve source-name))) (if (stringp raw) raw 
(format "%S" raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
temp-buffer) (unwind-protect (progn (funcall (intern (concat lang 
"-mode"))) (comment-region (point) (progn (insert s) (point))) (org-trim 
(buffer-string))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))))) (expand-body (function (lambda (i) (let ((b 
(org-babel-expand-noweb-references i))) (if (not comment) b (let ((cs 
(org-babel-tangle-comment-links i))) (concat (funcall c-wrap (car cs)) 
"\n" b "\n" (funcall c-wrap (car (cdr cs))))))))))) (if 
(re-search-forward name-regexp nil t) (funcall expand-body 
(org-babel-get-src-block-info 'light)) (let ((expansion nil)) (let* 
((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #3="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#3#))) "[\n\015]") (concat "\n" prefix)))))) (funcall nb-add 
(buffer-substring index (point-max)))) (and (buffer-name temp-buffer) 
(kill-buffer temp-buffer))))
   (let ((temp-buffer . #3=((generate-new-buffer " *temp*")))) 
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(set (make-local-variable 'org-babel-noweb-wrap-start) ob-nww-start) 
(set (make-local-variable 'org-babel-noweb-wrap-end) ob-nww-end) (insert 
body) (goto-char (point-min)) (setq index (point)) (while (and 
(re-search-forward (org-babel-noweb-wrap) nil t)) (let 
#1=((save-match-data-internal (match-data))) (unwind-protect (progn 
(setq source-name (match-string 1))) #2=(set-match-data 
save-match-data-internal 'evaporate))) (let #1# (unwind-protect (progn 
(setq evaluate (string-match "(.*)" source-name))) #2#)) (let #1# 
(unwind-protect (progn (setq prefix (buffer-substring (match-beginning 
0) (save-excursion (beginning-of-line 1) (point))))) #2#)) (goto-char 
(match-beginning 0)) (funcall nb-add (buffer-substring index (point))) 
(goto-char (match-end 0)) (setq index (point)) (funcall nb-add 
(save-current-buffer (set-buffer parent-buffer) (save-restriction 
(widen) (mapconcat (function identity) (split-string (if evaluate (let 
((raw (org-babel-ref-resolve source-name))) (if (stringp raw) raw 
(format "%S" raw))) (or (nth 2 (assoc (intern source-name) 
org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer . #3#)) 
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(funcall (intern (concat lang "-mode"))) (comment-region (point) (progn 
(insert s) (point))) (org-trim (buffer-string))) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))))))) (expand-body (function 
(lambda (i) (let ((b (org-babel-expand-noweb-references i))) (if (not 
comment) b (let ((cs (org-babel-tangle-comment-links i))) (concat 
(funcall c-wrap (car cs)) "\n" b "\n" (funcall c-wrap (car (cdr 
cs))))))))))) (if (re-search-forward name-regexp nil t) (funcall 
expand-body (org-babel-get-src-block-info 'light)) (let ((expansion 
nil)) (let* ((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #4="")))))) 
(if (or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#4#))) "[\n\015]") (concat "\n" prefix)))))) (funcall nb-add 
(buffer-substring index (point-max)))) (and (buffer-name temp-buffer) 
(kill-buffer temp-buffer)))))
   (let* ((parent-buffer (or parent-buffer (current-buffer))) (info (or 
info (org-babel-get-src-block-info 'light))) (lang (nth 0 info)) (body 
(nth 1 info)) (ob-nww-start org-babel-noweb-wrap-start) (ob-nww-end 
org-babel-noweb-wrap-end) (new-body #4="") (nb-add (function (lambda 
(text) (setq new-body (concat new-body text))))) index source-name 
evaluate prefix) (let ((temp-buffer . #3=((generate-new-buffer " 
*temp*")))) (save-current-buffer (set-buffer temp-buffer) 
(unwind-protect (progn (set (make-local-variable 
'org-babel-noweb-wrap-start) ob-nww-start) (set (make-local-variable 
'org-babel-noweb-wrap-end) ob-nww-end) (insert body) (goto-char 
(point-min)) (setq index (point)) (while (and (re-search-forward 
(org-babel-noweb-wrap) nil t)) (let #1=((save-match-data-internal 
(match-data))) (unwind-protect (progn (setq source-name (match-string 
1))) #2=(set-match-data save-match-data-internal 'evaporate))) (let #1# 
(unwind-protect (progn (setq evaluate (string-match "(.*)" 
source-name))) #2#)) (let #1# (unwind-protect (progn (setq prefix 
(buffer-substring (match-beginning 0) (save-excursion (beginning-of-line 
1) (point))))) #2#)) (goto-char (match-beginning 0)) (funcall nb-add 
(buffer-substring index (point))) (goto-char (match-end 0)) (setq index 
(point)) (funcall nb-add (save-current-buffer (set-buffer parent-buffer) 
(save-restriction (widen) (mapconcat (function identity) (split-string 
(if evaluate (let ((raw (org-babel-ref-resolve source-name))) (if 
(stringp raw) raw (format "%S" raw))) (or (nth 2 (assoc (intern 
source-name) org-babel-library-of-babel)) (save-excursion (if 
(org-babel-ref-goto-headline-id source-name) (progn 
(org-babel-ref-headline-body)))) (save-excursion (goto-char (point-min)) 
(let* ((name-regexp (org-babel-named-src-block-regexp-for-name 
source-name)) (comment (string= "noweb" (cdr (assq :comments (nth 2 
info))))) (c-wrap (function (lambda (s) (let ((temp-buffer . #3#)) 
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(funcall (intern (concat lang "-mode"))) (comment-region (point) (progn 
(insert s) (point))) (org-trim (buffer-string))) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))))))) (expand-body (function 
(lambda (i) (let ((b (org-babel-expand-noweb-references i))) (if (not 
comment) b (let ((cs (org-babel-tangle-comment-links i))) (concat 
(funcall c-wrap (car cs)) "\n" b "\n" (funcall c-wrap (car (cdr 
cs))))))))))) (if (re-search-forward name-regexp nil t) (funcall 
expand-body (org-babel-get-src-block-info 'light)) (let ((expansion 
nil)) (let* ((case-fold-search t) (file nil) (visited-p (or (null file) 
(get-file-buffer (expand-file-name file)))) (point (point)) 
to-be-removed) (let ((wconfig (current-window-configuration))) 
(unwind-protect (progn (if file (progn (find-file file))) (setq 
to-be-removed (current-buffer)) (goto-char (point-min)) (while 
(re-search-forward org-babel-src-block-regexp nil t) (if 
(org-babel-active-location-p) (progn (goto-char (match-beginning 0)) 
(let ((full-block (match-string 0)) (beg-block (match-beginning 0)) 
(end-block (match-end 0)) (lang (match-string 2)) (beg-lang 
(match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 
3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) 
(header-args (match-string 4)) (beg-header-args (match-beginning 4)) 
(end-header-args (match-end 4)) (body (match-string 5)) (beg-body 
(match-beginning 5)) (end-body (match-end 5))) (ignore full-block 
beg-block end-block lang beg-lang end-lang switches beg-switches 
end-switches header-args beg-header-args end-header-args body beg-body 
end-body) (let ((i (org-babel-get-src-block-info 'light))) (if (equal 
source-name (cdr (assq :noweb-ref (nth 2 i)))) (progn (let ((sep (or 
(cdr (assq :noweb-sep (nth 2 i))) "\n"))) (setq expansion (cons sep 
(cons (funcall expand-body i) expansion))))))) (goto-char 
end-block)))))) (set-window-configuration wconfig))) (if visited-p nil 
(kill-buffer to-be-removed)) (goto-char point)) (and expansion 
(mapconcat (function identity) (nreverse (cdr expansion)) #4#)))))) (if 
(or org-babel-noweb-error-all-langs (member lang 
org-babel-noweb-error-langs)) (error "%s could not be resolved (see 
`org-babel-noweb-error-langs')" (org-babel-noweb-wrap source-name)) 
#4#))) "[\n\015]") (concat "\n" prefix)))))) (funcall nb-add 
(buffer-substring index (point-max)))) (and (buffer-name temp-buffer) 
(kill-buffer temp-buffer))))) new-body)
   org-babel-expand-noweb-references(("shell" "<<fullest-disk>>" 
((:colname-names) (:rowname-names) (:result-params "replace" "output") 
(:result-type . output) (:results . "replace output") (:exports . 
"code") (:session . "none") (:cache . "no") (:hlines . "no") (:mkdirp . 
"yes") (:padline . "true") (:comments . "links") (:tangle . "yes") 
(:noweb . "yes") (:shebang . "#!/bin/sh")) "" nil 9 "(ref:%s)"))
   (if (org-babel-noweb-p params :eval) 
(org-babel-expand-noweb-references info) (nth 1 info))
   (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params 
:eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not 
coderef) expand (replace-regexp-in-string (org-src-coderef-regexp 
coderef) "" expand nil nil 1)))
   (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)
   (cond (current-cache (save-excursion (goto-char 
(org-babel-where-is-src-block-result nil info)) (forward-line) 
(skip-chars-forward " \011") (let ((result (org-babel-read-result))) 
(message (replace-regexp-in-string "%" "%%" (format "%S" result))) 
result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) 
(result-params (cdr (assq :result-params params))) (body (let ((coderef 
(nth 6 info)) (expand (if (org-babel-noweb-p params :eval) 
(org-babel-expand-noweb-references info) (nth 1 info)))) (if (not 
coderef) expand (replace-regexp-in-string (org-src-coderef-regexp 
coderef) #1="" expand nil nil 1)))) (dir (cdr (assq :dir params))) 
(default-directory (or (and dir (file-name-as-directory 
(expand-file-name dir))) default-directory)) (cmd (intern (concat 
"org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No 
org-babel-execute function for %s!" lang)) (message "executing %s code 
block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name 
(format " (%s)" name) #1#))) (if (member "none" result-params) (progn 
(funcall cmd body params) (message "result silenced")) (setq result (let 
((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type 
params)) 'value) (or (member "vector" result-params) (member "table" 
result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr 
(assq :file params)))) (if file (progn (if result (progn (let 
((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)))
   (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache 
params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache 
(org-babel-sha1-hash info))) (old-hash (and cache 
(org-babel-current-result-hash))) (current-cache (and new-hash (equal 
new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char 
(org-babel-where-is-src-block-result nil info)) (forward-line) 
(skip-chars-forward " \011") (let ((result (org-babel-read-result))) 
(message (replace-regexp-in-string "%" "%%" (format "%S" result))) 
result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) 
(result-params (cdr (assq :result-params params))) (body (let ((coderef 
(nth 6 info)) (expand (if (org-babel-noweb-p params :eval) 
(org-babel-expand-noweb-references info) (nth 1 info)))) (if (not 
coderef) expand (replace-regexp-in-string (org-src-coderef-regexp 
coderef) #1="" expand nil nil 1)))) (dir (cdr (assq :dir params))) 
(default-directory (or (and dir (file-name-as-directory 
(expand-file-name dir))) default-directory)) (cmd (intern (concat 
"org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No 
org-babel-execute function for %s!" lang)) (message "executing %s code 
block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name 
(format " (%s)" name) #1#))) (if (member "none" result-params) (progn 
(funcall cmd body params) (message "result silenced")) (setq result (let 
((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type 
params)) 'value) (or (member "vector" result-params) (member "table" 
result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr 
(assq :file params)))) (if file (progn (if result (progn (let 
((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result))))
   (progn (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache 
(let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" 
c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and 
cache (org-babel-current-result-hash))) (current-cache (and new-hash 
(equal new-hash old-hash)))) (cond (current-cache (save-excursion 
(goto-char (org-babel-where-is-src-block-result nil info)) 
(forward-line) (skip-chars-forward " \011") (let ((result 
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" 
(format "%S" result))) result))) ((org-babel-confirm-evaluate info) 
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)))))
   (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 
info))) (setcar c (org-babel-process-params (car c)))) (let* ((params 
(nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not 
arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash 
info))) (old-hash (and cache (org-babel-current-result-hash))) 
(current-cache (and new-hash (equal new-hash old-hash)))) (cond 
(current-cache (save-excursion (goto-char 
(org-babel-where-is-src-block-result nil info)) (forward-line) 
(skip-chars-forward " \011") (let ((result (org-babel-read-result))) 
(message (replace-regexp-in-string "%" "%%" (format "%S" result))) 
result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) 
(result-params (cdr (assq :result-params params))) (body (let ((coderef 
(nth 6 info)) (expand (if (org-babel-noweb-p params :eval) 
(org-babel-expand-noweb-references info) (nth 1 info)))) (if (not 
coderef) expand (replace-regexp-in-string (org-src-coderef-regexp 
coderef) #1="" expand nil nil 1)))) (dir (cdr (assq :dir params))) 
(default-directory (or (and dir (file-name-as-directory 
(expand-file-name dir))) default-directory)) (cmd (intern (concat 
"org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No 
org-babel-execute function for %s!" lang)) (message "executing %s code 
block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name 
(format " (%s)" name) #1#))) (if (member "none" result-params) (progn 
(funcall cmd body params) (message "result silenced")) (setq result (let 
((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type 
params)) 'value) (or (member "vector" result-params) (member "table" 
result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr 
(assq :file params)))) (if file (progn (if result (progn (let 
((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result))))))
   (let* ((org-babel-current-src-block-location (or 
org-babel-current-src-block-location (nth 5 info) 
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info) 
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate 
info) (progn (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache 
(let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" 
c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and 
cache (org-babel-current-result-hash))) (current-cache (and new-hash 
(equal new-hash old-hash)))) (cond (current-cache (save-excursion 
(goto-char (org-babel-where-is-src-block-result nil info)) 
(forward-line) (skip-chars-forward " \011") (let ((result 
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" 
(format "%S" result))) result))) ((org-babel-confirm-evaluate info) 
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)))))))
   (closure (*this* org-babel-confirm-evaluate-answer-no t) (&optional 
arg info params) "Execute the current source code block.\nInsert the 
results of execution into the buffer.  Source code\nexecution and the 
collection and formatting of results can be\ncontrolled through a 
variety of header arguments.\n\nWith prefix argument ARG, force 
re-execution even if an existing\nresult cached in the buffer would 
otherwise have been returned.\n\nOptionally supply a value for INFO in 
the form returned by\n`org-babel-get-src-block-info'.\n\nOptionally 
supply a value for PARAMS which will be merged with\nthe header 
arguments specified at the front of the source code\nblock." 
(interactive) (let* ((org-babel-current-src-block-location (or 
org-babel-current-src-block-location (nth 5 info) 
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info) 
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate 
info) (progn (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache 
(let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" 
c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and 
cache (org-babel-current-result-hash))) (current-cache (and new-hash 
(equal new-hash old-hash)))) (cond (current-cache (save-excursion 
(goto-char (org-babel-where-is-src-block-result nil info)) 
(forward-line) (skip-chars-forward " \011") (let ((result 
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" 
(format "%S" result))) result))) ((org-babel-confirm-evaluate info) 
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result))))))))(nil ("shell" 
"<<fullest-disk>>" ((:colname-names) (:rowname-names) (:result-params 
"output" "replace") (:result-type . output) (:results . "output 
replace") (:exports . "code") (:shebang . "#!/bin/sh") (:noweb . "yes") 
(:tangle . "yes") (:comments . "links") (:padline . "true") (:mkdirp . 
"yes") (:hlines . "no") (:cache . "no") (:session . "none")) "" nil 9 
"(ref:%s)") nil)
   ad-Advice-org-babel-execute-src-block((closure (*this* 
org-babel-confirm-evaluate-answer-no t) (&optional arg info params) 
"Execute the current source code block.\nInsert the results of execution 
into the buffer.  Source code\nexecution and the collection and 
formatting of results can be\ncontrolled through a variety of header 
arguments.\n\nWith prefix argument ARG, force re-execution even if an 
existing\nresult cached in the buffer would otherwise have been 
returned.\n\nOptionally supply a value for INFO in the form returned 
by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for 
PARAMS which will be merged with\nthe header arguments specified at the 
front of the source code\nblock." (interactive) (let* 
((org-babel-current-src-block-location (or 
org-babel-current-src-block-location (nth 5 info) 
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info) 
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate 
info) (progn (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache 
(let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" 
c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and 
cache (org-babel-current-result-hash))) (current-cache (and new-hash 
(equal new-hash old-hash)))) (cond (current-cache (save-excursion 
(goto-char (org-babel-where-is-src-block-result nil info)) 
(forward-line) (skip-chars-forward " \011") (let ((result 
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" 
(format "%S" result))) result))) ((org-babel-confirm-evaluate info) 
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)))))))) nil ("shell" 
"<<fullest-disk>>" ((:colname-names) (:rowname-names) (:result-params 
"output" "replace") (:result-type . output) (:results . "output 
replace") (:exports . "code") (:shebang . "#!/bin/sh") (:noweb . "yes") 
(:tangle . "yes") (:comments . "links") (:padline . "true") (:mkdirp . 
"yes") (:hlines . "no") (:cache . "no") (:session . "none")) #1# nil 9 
"(ref:%s)"))
   apply(ad-Advice-org-babel-execute-src-block (closure (*this* 
org-babel-confirm-evaluate-answer-no t) (&optional arg info params) 
"Execute the current source code block.\nInsert the results of execution 
into the buffer.  Source code\nexecution and the collection and 
formatting of results can be\ncontrolled through a variety of header 
arguments.\n\nWith prefix argument ARG, force re-execution even if an 
existing\nresult cached in the buffer would otherwise have been 
returned.\n\nOptionally supply a value for INFO in the form returned 
by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for 
PARAMS which will be merged with\nthe header arguments specified at the 
front of the source code\nblock." (interactive) (let* 
((org-babel-current-src-block-location (or 
org-babel-current-src-block-location (nth 5 info) 
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info) 
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate 
info) (progn (let* ((c (nthcdr 2 info))) (setcar c 
(org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache 
(let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" 
c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and 
cache (org-babel-current-result-hash))) (current-cache (and new-hash 
(equal new-hash old-hash)))) (cond (current-cache (save-excursion 
(goto-char (org-babel-where-is-src-block-result nil info)) 
(forward-line) (skip-chars-forward " \011") (let ((result 
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" 
(format "%S" result))) result))) ((org-babel-confirm-evaluate info) 
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) #1="" expand nil nil 1)))) (dir (cdr 
(assq :dir params))) (default-directory (or (and dir 
(file-name-as-directory (expand-file-name dir))) default-directory)) 
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp 
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message 
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 
info))) (if name (format " (%s)" name) #1#))) (if (member "none" 
result-params) (progn (funcall cmd body params) (message "result 
silenced")) (setq result (let ((r (funcall cmd body params))) (if (and 
(eq (cdr (assq :result-type params)) 'value) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn 
(if result (progn (let ((temp-file file) (temp-buffer (get-buffer-create 
(generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 
(save-current-buffer (set-buffer temp-buffer) (insert 
(org-babel-format-result result (cdr (assq :sep params))))) 
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil 
temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer 
temp-buffer)))))) (setq result file))) (let ((post (cdr (assq :post 
params)))) (if post (progn (let ((*this* (if (not file) result 
(org-babel-result-to-file file (let ((desc (assq :file-desc params))) 
(and desc (or (cdr desc) result))))))) (setq result 
(org-babel-ref-resolve post)) (if file (progn (setq result-params 
(remove "file" result-params)))))))) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks 
'org-babel-after-execute-hook) result)))))))) (nil ("shell" 
"<<fullest-disk>>" ((:colname-names) (:rowname-names) (:result-params 
"output" "replace") (:result-type . output) (:results . "output 
replace") (:exports . "code") (:shebang . "#!/bin/sh") (:noweb . "yes") 
(:tangle . "yes") (:comments . "links") (:padline . "true") (:mkdirp . 
"yes") (:hlines . "no") (:cache . "no") (:session . "none")) #1# nil 9 
"(ref:%s)")))
   org-babel-execute-src-block(nil ("shell" "<<fullest-disk>>" 
((:colname-names) (:rowname-names) (:result-params "output" "replace") 
(:result-type . output) (:results . "output replace") (:exports . 
"code") (:shebang . "#!/bin/sh") (:noweb . "yes") (:tangle . "yes") 
(:comments . "links") (:padline . "true") (:mkdirp . "yes") (:hlines . 
"no") (:cache . "no") (:session . "none")) "" nil 9 "(ref:%s)"))
   (if org-babel-no-eval-on-ctrl-c-ctrl-c nil 
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block 
current-prefix-arg (org-babel-get-src-block-info nil context)))
   (cond ((memq type '(src-block inline-src-block)) (if 
org-babel-no-eval-on-ctrl-c-ctrl-c nil 
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block 
current-prefix-arg (org-babel-get-src-block-info nil context)))) 
((org-match-line "[ \011]*$") (or (run-hook-with-args-until-success 
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys 
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type 
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info 
context))) (if info (progn (org-babel-execute-src-block nil info))))) 
((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 
'dynamic-block) (save-excursion (goto-char (org-element-property 
:post-affiliated context)) (org-update-dblock))) ((eq type 
'footnote-definition) (goto-char (org-element-property :post-affiliated 
context)) (call-interactively 'org-footnote-action)) ((eq type 
'footnote-reference) (call-interactively (function 
org-footnote-action))) ((memq type '(inlinetask headline)) 
(save-excursion (goto-char (org-element-property :begin context)) 
(call-interactively (function org-set-tags)))) ((eq type 'item) (let* 
((box (org-element-property :checkbox context)) (struct 
(org-element-property :structure context)) (old-struct (copy-tree 
struct)) (parents (org-list-parents-alist struct)) (prevs 
(org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil 
"ORDERED")))) (org-list-set-checkbox (org-element-property :begin 
context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal 
arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ 
]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) 
(org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct 
prevs) (org-list-struct-fix-ind struct parents) (let ((block-item 
(org-list-struct-fix-box struct parents prevs orderedp))) (if (and box 
(equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes 
already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq 
box 'on) "all subitems checked" "unchecked subitems"))) 
(org-list-struct-apply-struct struct old-struct) 
(org-update-checkbox-count-maybe)) (if block-item (progn (message 
"Checkboxes were removed due to empty box at line %d" (org-current-line 
block-item))))))) ((eq type 'keyword) (let 
((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables 
nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function 
delete-overlay) org-table-coordinate-overlays) (setq 
org-table-coordinate-overlays nil))) (let ((--data 
(org-outline-overlay-data #1='use-markers))) (unwind-protect (prog1 
(progn (org-mode-restart)) (org-set-outline-overlay-data --data)) (if 
#1# (progn (let ((--dolist-tail-- --data)) (while --dolist-tail-- (let 
((c (car --dolist-tail--))) (if (markerp (car c)) (progn (move-marker 
(car c) nil))) (if (markerp (cdr c)) (progn (move-marker (cdr c) nil))) 
(setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local 
setup has been refreshed")) ((eq type 'plain-list) (let* ((begin 
(org-element-property :contents-begin context)) (beginm (move-marker 
(make-marker) begin)) (struct (org-element-property :structure context)) 
(old-struct (copy-tree struct)) (first-box (save-excursion (goto-char 
begin) (looking-at org-list-full-item-re) (match-string-no-properties 
3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if 
first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond 
(arg (let ((--dolist-tail-- (org-list-get-all-items begin struct 
(org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car 
--dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq 
--dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) 
begin)) (org-list-set-checkbox begin struct new-box))) 
(org-list-write-struct struct (org-list-parents-alist struct) 
old-struct) (org-update-checkbox-count-maybe) (save-excursion (goto-char 
beginm) (org-list-send-list 'maybe)))) ((memq type '(node-property 
property-drawer)) (call-interactively (function org-property-action))) 
((eq type 'radio-target) (call-interactively (function 
org-update-radio-target-regexp))) ((eq type 'statistics-cookie) 
(call-interactively (function org-update-statistics-cookies))) ((memq 
type '(table-row table-cell table)) (if (eq (org-element-property :type 
context) 'table\.el) (message "%s" (substitute-command-keys 
"\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) 
(if (or (eq type 'table) (and (eq type 'table-row) (= (point) 
(org-element-property :end context)))) (save-excursion (if 
(org-at-TBLFM-p) (progn (require 'org-table) 
(org-table-calc-current-TBLFM)) (goto-char (org-element-property 
:contents-begin context)) (org-call-with-arg 'org-table-recalculate (or 
arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) 
(cond (arg (call-interactively (function org-table-recalculate))) 
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond 
((org-at-timestamp-p 'lax) (funcall pcase-0)) 
(#2=(run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 
nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' 
can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) 
(call-interactively (function org-set-tags))) (#2# (funcall pcase-1)) (t 
(funcall pcase-2)))) (#2# (funcall pcase-1)) (t (funcall pcase-2)))
   (let* ((pcase-2 (function (lambda nil #2=(user-error 
(substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful 
here"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambda 
nil (org-timestamp-change 0 'day))))) (cond ((memq type '(src-block 
inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil 
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block 
current-prefix-arg (org-babel-get-src-block-info nil context)))) 
((org-match-line "[ \011]*$") (or (run-hook-with-args-until-success 
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys 
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type 
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info 
context))) (if info (progn (org-babel-execute-src-block nil info))))) 
((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 
'dynamic-block) (save-excursion (goto-char (org-element-property 
:post-affiliated context)) (org-update-dblock))) ((eq type 
'footnote-definition) (goto-char (org-element-property :post-affiliated 
context)) (call-interactively 'org-footnote-action)) ((eq type 
'footnote-reference) (call-interactively (function 
org-footnote-action))) ((memq type '(inlinetask headline)) 
(save-excursion (goto-char (org-element-property :begin context)) 
(call-interactively (function org-set-tags)))) ((eq type 'item) (let* 
((box (org-element-property :checkbox context)) (struct 
(org-element-property :structure context)) (old-struct (copy-tree 
struct)) (parents (org-list-parents-alist struct)) (prevs 
(org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil 
"ORDERED")))) (org-list-set-checkbox (org-element-property :begin 
context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal 
arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ 
]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) 
(org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct 
prevs) (org-list-struct-fix-ind struct parents) (let ((block-item 
(org-list-struct-fix-box struct parents prevs orderedp))) (if (and box 
(equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes 
already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq 
box 'on) "all subitems checked" "unchecked subitems"))) 
(org-list-struct-apply-struct struct old-struct) 
(org-update-checkbox-count-maybe)) (if block-item (progn (message 
"Checkboxes were removed due to empty box at line %d" (org-current-line 
block-item))))))) ((eq type 'keyword) (let 
((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables 
nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function 
delete-overlay) org-table-coordinate-overlays) (setq 
org-table-coordinate-overlays nil))) (let ((--data 
(org-outline-overlay-data #1='use-markers))) (unwind-protect (prog1 
(progn (org-mode-restart)) (org-set-outline-overlay-data --data)) (if 
#1# (progn (let ((--dolist-tail-- --data)) (while --dolist-tail-- (let 
((c (car --dolist-tail--))) (if (markerp (car c)) (progn (move-marker 
(car c) nil))) (if (markerp (cdr c)) (progn (move-marker (cdr c) nil))) 
(setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local 
setup has been refreshed")) ((eq type 'plain-list) (let* ((begin 
(org-element-property :contents-begin context)) (beginm (move-marker 
(make-marker) begin)) (struct (org-element-property :structure context)) 
(old-struct (copy-tree struct)) (first-box (save-excursion (goto-char 
begin) (looking-at org-list-full-item-re) (match-string-no-properties 
3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if 
first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond 
(arg (let ((--dolist-tail-- (org-list-get-all-items begin struct 
(org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car 
--dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq 
--dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) 
begin)) (org-list-set-checkbox begin struct new-box))) 
(org-list-write-struct struct (org-list-parents-alist struct) 
old-struct) (org-update-checkbox-count-maybe) (save-excursion (goto-char 
beginm) (org-list-send-list 'maybe)))) ((memq type '(node-property 
property-drawer)) (call-interactively (function org-property-action))) 
((eq type 'radio-target) (call-interactively (function 
org-update-radio-target-regexp))) ((eq type 'statistics-cookie) 
(call-interactively (function org-update-statistics-cookies))) ((memq 
type '(table-row table-cell table)) (if (eq (org-element-property :type 
context) 'table\.el) (message "%s" (substitute-command-keys 
"\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) 
(if (or (eq type 'table) (and (eq type 'table-row) (= (point) 
(org-element-property :end context)))) (save-excursion (if 
(org-at-TBLFM-p) (progn (require 'org-table) 
(org-table-calc-current-TBLFM)) (goto-char (org-element-property 
:contents-begin context)) (org-call-with-arg 'org-table-recalculate (or 
arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) 
(cond (arg (call-interactively (function org-table-recalculate))) 
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond 
((org-at-timestamp-p 'lax) (funcall pcase-0)) 
(#3=(run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 
nil) (t #2#))) ((null type) (cond ((org-at-heading-p) 
(call-interactively (function org-set-tags))) (#3# (funcall pcase-1)) (t 
(funcall pcase-2)))) (#3# (funcall pcase-1)) (t (funcall pcase-2))))
   (let* ((context (org-element-lineage (org-element-context) 
'(babel-call clock dynamic-block footnote-definition footnote-reference 
inline-babel-call inline-src-block inlinetask item keyword node-property 
paragraph plain-list planning property-drawer radio-target src-block 
statistics-cookie table table-cell table-row timestamp) t)) (type 
(org-element-type context))) (if (eq type 'paragraph) (progn (let 
((parent (org-element-property :parent context))) (if (and (eq 
(org-element-type parent) 'item) (= (line-beginning-position) 
(org-element-property :begin parent))) (progn (setq context parent) 
(setq type 'item)))))) (let* ((pcase-2 (function (lambda nil 
#2=(user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do 
nothing useful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 
(function (lambda nil (org-timestamp-change 0 'day))))) (cond ((memq 
type '(src-block inline-src-block)) (if 
org-babel-no-eval-on-ctrl-c-ctrl-c nil 
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block 
current-prefix-arg (org-babel-get-src-block-info nil context)))) 
((org-match-line "[ \011]*$") (or (run-hook-with-args-until-success 
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys 
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type 
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info 
context))) (if info (progn (org-babel-execute-src-block nil info))))) 
((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 
'dynamic-block) (save-excursion (goto-char (org-element-property 
:post-affiliated context)) (org-update-dblock))) ((eq type 
'footnote-definition) (goto-char (org-element-property :post-affiliated 
context)) (call-interactively 'org-footnote-action)) ((eq type 
'footnote-reference) (call-interactively (function 
org-footnote-action))) ((memq type '(inlinetask headline)) 
(save-excursion (goto-char (org-element-property :begin context)) 
(call-interactively (function org-set-tags)))) ((eq type 'item) (let* 
((box (org-element-property :checkbox context)) (struct 
(org-element-property :structure context)) (old-struct (copy-tree 
struct)) (parents (org-list-parents-alist struct)) (prevs 
(org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil 
"ORDERED")))) (org-list-set-checkbox (org-element-property :begin 
context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal 
arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ 
]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) 
(org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct 
prevs) (org-list-struct-fix-ind struct parents) (let ((block-item 
(org-list-struct-fix-box struct parents prevs orderedp))) (if (and box 
(equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes 
already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq 
box 'on) "all subitems checked" "unchecked subitems"))) 
(org-list-struct-apply-struct struct old-struct) 
(org-update-checkbox-count-maybe)) (if block-item (progn (message 
"Checkboxes were removed due to empty box at line %d" (org-current-line 
block-item))))))) ((eq type 'keyword) (let 
((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables 
nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function 
delete-overlay) org-table-coordinate-overlays) (setq 
org-table-coordinate-overlays nil))) (let ((--data 
(org-outline-overlay-data #1='use-markers))) (unwind-protect (prog1 
(progn (org-mode-restart)) (org-set-outline-overlay-data --data)) (if 
#1# (progn (let ((--dolist-tail-- --data)) (while --dolist-tail-- (let 
((c (car --dolist-tail--))) (if (markerp (car c)) (progn (move-marker 
(car c) nil))) (if (markerp (cdr c)) (progn (move-marker (cdr c) nil))) 
(setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local 
setup has been refreshed")) ((eq type 'plain-list) (let* ((begin 
(org-element-property :contents-begin context)) (beginm (move-marker 
(make-marker) begin)) (struct (org-element-property :structure context)) 
(old-struct (copy-tree struct)) (first-box (save-excursion (goto-char 
begin) (looking-at org-list-full-item-re) (match-string-no-properties 
3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if 
first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond 
(arg (let ((--dolist-tail-- (org-list-get-all-items begin struct 
(org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car 
--dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq 
--dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) 
begin)) (org-list-set-checkbox begin struct new-box))) 
(org-list-write-struct struct (org-list-parents-alist struct) 
old-struct) (org-update-checkbox-count-maybe) (save-excursion (goto-char 
beginm) (org-list-send-list 'maybe)))) ((memq type '(node-property 
property-drawer)) (call-interactively (function org-property-action))) 
((eq type 'radio-target) (call-interactively (function 
org-update-radio-target-regexp))) ((eq type 'statistics-cookie) 
(call-interactively (function org-update-statistics-cookies))) ((memq 
type '(table-row table-cell table)) (if (eq (org-element-property :type 
context) 'table\.el) (message "%s" (substitute-command-keys 
"\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) 
(if (or (eq type 'table) (and (eq type 'table-row) (= (point) 
(org-element-property :end context)))) (save-excursion (if 
(org-at-TBLFM-p) (progn (require 'org-table) 
(org-table-calc-current-TBLFM)) (goto-char (org-element-property 
:contents-begin context)) (org-call-with-arg 'org-table-recalculate (or 
arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) 
(cond (arg (call-interactively (function org-table-recalculate))) 
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond 
((org-at-timestamp-p 'lax) (funcall pcase-0)) 
(#3=(run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 
nil) (t #2#))) ((null type) (cond ((org-at-heading-p) 
(call-interactively (function org-set-tags))) (#3# (funcall pcase-1)) (t 
(funcall pcase-2)))) (#3# (funcall pcase-1)) (t (funcall pcase-2)))))
   (cond ((or (and (boundp 'org-clock-overlays) org-clock-overlays) 
org-occur-highlights) (if (boundp 'org-clock-overlays) (progn 
(org-clock-remove-overlays))) (org-remove-occur-highlights) (message 
"Temporary highlights/overlays removed from current buffer")) ((and 
(local-variable-p 'org-finish-function) (fboundp org-finish-function)) 
(funcall org-finish-function)) ((org-babel-hash-at-point)) 
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) (t (let* 
((context (org-element-lineage (org-element-context) '(babel-call clock 
dynamic-block footnote-definition footnote-reference inline-babel-call 
inline-src-block inlinetask item keyword node-property paragraph 
plain-list planning property-drawer radio-target src-block 
statistics-cookie table table-cell table-row timestamp) t)) (type 
(org-element-type context))) (if (eq type 'paragraph) (progn (let 
((parent (org-element-property :parent context))) (if (and (eq 
(org-element-type parent) 'item) (= (line-beginning-position) 
(org-element-property :begin parent))) (progn (setq context parent) 
(setq type 'item)))))) (let* ((pcase-2 (function (lambda nil 
#2=(user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do 
nothing useful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 
(function (lambda nil (org-timestamp-change 0 'day))))) (cond ((memq 
type '(src-block inline-src-block)) (if 
org-babel-no-eval-on-ctrl-c-ctrl-c nil 
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block 
current-prefix-arg (org-babel-get-src-block-info nil context)))) 
((org-match-line "[ \011]*$") (or (run-hook-with-args-until-success 
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys 
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type 
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info 
context))) (if info (progn (org-babel-execute-src-block nil info))))) 
((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 
'dynamic-block) (save-excursion (goto-char (org-element-property 
:post-affiliated context)) (org-update-dblock))) ((eq type 
'footnote-definition) (goto-char (org-element-property :post-affiliated 
context)) (call-interactively 'org-footnote-action)) ((eq type 
'footnote-reference) (call-interactively (function 
org-footnote-action))) ((memq type '(inlinetask headline)) 
(save-excursion (goto-char (org-element-property :begin context)) 
(call-interactively (function org-set-tags)))) ((eq type 'item) (let* 
((box (org-element-property :checkbox context)) (struct 
(org-element-property :structure context)) (old-struct (copy-tree 
struct)) (parents (org-list-parents-alist struct)) (prevs 
(org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil 
"ORDERED")))) (org-list-set-checkbox (org-element-property :begin 
context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal 
arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ 
]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) 
(org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct 
prevs) (org-list-struct-fix-ind struct parents) (let ((block-item 
(org-list-struct-fix-box struct parents prevs orderedp))) (if (and box 
(equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes 
already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq 
box 'on) "all subitems checked" "unchecked subitems"))) 
(org-list-struct-apply-struct struct old-struct) 
(org-update-checkbox-count-maybe)) (if block-item (progn (message 
"Checkboxes were removed due to empty box at line %d" (org-current-line 
block-item))))))) ((eq type 'keyword) (let 
((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables 
nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function 
delete-overlay) org-table-coordinate-overlays) (setq 
org-table-coordinate-overlays nil))) (let ((--data 
(org-outline-overlay-data #1='use-markers))) (unwind-protect (prog1 
(progn (org-mode-restart)) (org-set-outline-overlay-data --data)) (if 
#1# (progn (let ((--dolist-tail-- --data)) (while --dolist-tail-- (let 
((c (car --dolist-tail--))) (if (markerp (car c)) (progn (move-marker 
(car c) nil))) (if (markerp (cdr c)) (progn (move-marker (cdr c) nil))) 
(setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local 
setup has been refreshed")) ((eq type 'plain-list) (let* ((begin 
(org-element-property :contents-begin context)) (beginm (move-marker 
(make-marker) begin)) (struct (org-element-property :structure context)) 
(old-struct (copy-tree struct)) (first-box (save-excursion (goto-char 
begin) (looking-at org-list-full-item-re) (match-string-no-properties 
3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if 
first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond 
(arg (let ((--dolist-tail-- (org-list-get-all-items begin struct 
(org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car 
--dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq 
--dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) 
begin)) (org-list-set-checkbox begin struct new-box))) 
(org-list-write-struct struct (org-list-parents-alist struct) 
old-struct) (org-update-checkbox-count-maybe) (save-excursion (goto-char 
beginm) (org-list-send-list 'maybe)))) ((memq type '(node-property 
property-drawer)) (call-interactively (function org-property-action))) 
((eq type 'radio-target) (call-interactively (function 
org-update-radio-target-regexp))) ((eq type 'statistics-cookie) 
(call-interactively (function org-update-statistics-cookies))) ((memq 
type '(table-row table-cell table)) (if (eq (org-element-property :type 
context) 'table\.el) (message "%s" (substitute-command-keys 
"\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) 
(if (or (eq type 'table) (and (eq type 'table-row) (= (point) 
(org-element-property :end context)))) (save-excursion (if 
(org-at-TBLFM-p) (progn (require 'org-table) 
(org-table-calc-current-TBLFM)) (goto-char (org-element-property 
:contents-begin context)) (org-call-with-arg 'org-table-recalculate (or 
arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) 
(cond (arg (call-interactively (function org-table-recalculate))) 
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond 
((org-at-timestamp-p 'lax) (funcall pcase-0)) 
(#3=(run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 
nil) (t #2#))) ((null type) (cond ((org-at-heading-p) 
(call-interactively (function org-set-tags))) (#3# (funcall pcase-1)) (t 
(funcall pcase-2)))) (#3# (funcall pcase-1)) (t (funcall pcase-2)))))))
   org-ctrl-c-ctrl-c(nil)
   funcall-interactively(org-ctrl-c-ctrl-c nil)
   call-interactively(org-ctrl-c-ctrl-c nil nil)
   #f(compiled-function (cmd &optional record-flag keys special) 
"Execute CMD as an editor command.\nCMD must be a symbol that satisfies 
the `commandp' predicate.\nOptional second arg RECORD-FLAG 
non-nil\nmeans unconditionally put this command in the variable 
`command-history'.\nOtherwise, that is done only if an arg is read using 
the minibuffer.\nThe argument KEYS specifies the value to use instead of 
(this-command-keys)\nwhen reading the arguments; if it is nil, 
(this-command-keys) is used.\nThe argument SPECIAL, if non-nil, means 
that this command is executing\na special event, so ignore the prefix 
argument and don't clear it." #<bytecode 0x24db8b>)(org-ctrl-c-ctrl-c 
nil nil nil)
   ad-Advice-command-execute(#f(compiled-function (cmd &optional 
record-flag keys special) "Execute CMD as an editor command.\nCMD must 
be a symbol that satisfies the `commandp' predicate.\nOptional second 
arg RECORD-FLAG non-nil\nmeans unconditionally put this command in the 
variable `command-history'.\nOtherwise, that is done only if an arg is 
read using the minibuffer.\nThe argument KEYS specifies the value to use 
instead of (this-command-keys)\nwhen reading the arguments; if it is 
nil, (this-command-keys) is used.\nThe argument SPECIAL, if non-nil, 
means that this command is executing\na special event, so ignore the 
prefix argument and don't clear it." #<bytecode 0x24db8b>) 
org-ctrl-c-ctrl-c)
   apply(ad-Advice-command-execute #f(compiled-function (cmd &optional 
record-flag keys special) "Execute CMD as an editor command.\nCMD must 
be a symbol that satisfies the `commandp' predicate.\nOptional second 
arg RECORD-FLAG non-nil\nmeans unconditionally put this command in the 
variable `command-history'.\nOtherwise, that is done only if an arg is 
read using the minibuffer.\nThe argument KEYS specifies the value to use 
instead of (this-command-keys)\nwhen reading the arguments; if it is 
nil, (this-command-keys) is used.\nThe argument SPECIAL, if non-nil, 
means that this command is executing\na special event, so ignore the 
prefix argument and don't clear it." #<bytecode 0x24db8b>) 
org-ctrl-c-ctrl-c)
   command-execute(org-ctrl-c-ctrl-c)
```

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-17 14:58 header argument :noweb-ref seems can't be resolved stardiviner
@ 2017-12-17 17:40 ` Berry, Charles
  2017-12-18  2:08   ` stardiviner
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-17 17:40 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-org-mode



> On Dec 17, 2017, at 6:58 AM, stardiviner <numbchild@gmail.com> wrote:
> 
> I have the following org-mode file content:
> 
> ```org
> 
> #+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
> <<fullest-disk>>
> #+end_src
> 
> ** the mount point of the fullest disk
>   :PROPERTIES:
>   :header-args: :noweb-ref fullest-disk
>   :END:
> 
> *** query all mounted disks


When I copied your ECM to a fresh org-buffer and typed `C-c C-v v' with point in the above src block I got an org babel preview buffer with nothing. 

Looking closely, I saw a character that was not visible in the gnus buffer from which I copied. Before the: PROPERITES: lines you have 32 160 32.

160 renders as a light brown underscore when I eval `(char-to-string 160)' on my MacPro, emacs 25.2.1.

32 is blank. Converting all three to blank. and Running `C-c C-v v' gives the contents of the src blocks under the noweb-ref headline.

HTH,

Chuck

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-17 17:40 ` Berry, Charles
@ 2017-12-18  2:08   ` stardiviner
  2017-12-18  4:12     ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: stardiviner @ 2017-12-18  2:08 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

The example I original copied from is Emacs org-mode info.
So I rewrite a hand typing content again:
```org
* Test

#+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
<<fullest-disk>>
#+end_src

** the mount point of the fullest disk
:PROPERTIES:
:header-args: :noweb-ref fullest-disk
:END:

*** query all mount disks

#+begin_src shell
df \
#+end_src

*** strip the header row

#+begin_src shell
| sed '1d' \
#+end_src

*** output mount point of fullest disk

#+begin_src shell
| awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
#+end_src
```

I can preview the first src block with [C-c C-v v] now. It is correct:
```shell
df \
| sed '1d' \
| awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
```
I can tangle it with [C-c C-v t] to same file name shell script 
`babel-noweb-ref.sh`.

But just can't run [C-c C-v e] or [C-c C-]. (Reports same error)
Seems org-mode can find correct noweb-ref for tangle but can't for eval.


On 12/18/2017 01:40 AM, Berry, Charles wrote:
>
>> On Dec 17, 2017, at 6:58 AM, stardiviner <numbchild@gmail.com> wrote:
>>
>> I have the following org-mode file content:
>>
>> ```org
>>
>> #+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
>> <<fullest-disk>>
>> #+end_src
>>
>> ** the mount point of the fullest disk
>>    :PROPERTIES:
>>    :header-args: :noweb-ref fullest-disk
>>    :END:
>>
>> *** query all mounted disks
>
> When I copied your ECM to a fresh org-buffer and typed `C-c C-v v' with point in the above src block I got an org babel preview buffer with nothing.
>
> Looking closely, I saw a character that was not visible in the gnus buffer from which I copied. Before the: PROPERITES: lines you have 32 160 32.
>
> 160 renders as a light brown underscore when I eval `(char-to-string 160)' on my MacPro, emacs 25.2.1.
>
> 32 is blank. Converting all three to blank. and Running `C-c C-v v' gives the contents of the src blocks under the noweb-ref headline.
>
> HTH,
>
> Chuck
>
>

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-18  2:08   ` stardiviner
@ 2017-12-18  4:12     ` Berry, Charles
  2017-12-18  4:28       ` stardiviner
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-18  4:12 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-org-mode



> On Dec 17, 2017, at 6:08 PM, stardiviner <numbchild@gmail.com> wrote:
> 
> The example I original copied from is Emacs org-mode info.
> So I rewrite a hand typing content again:
> ```org
> * Test
> 
> #+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
> <<fullest-disk>>
> #+end_src
> 
> ** the mount point of the fullest disk
> :PROPERTIES:
> :header-args: :noweb-ref fullest-disk
> :END:
> 
> *** query all mount disks
> 
> #+begin_src shell
> df \
> #+end_src
> 
> *** strip the header row
> 
> #+begin_src shell
> | sed '1d' \
> #+end_src
> 
> *** output mount point of fullest disk
> 
> #+begin_src shell
> | awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
> #+end_src
> ```
> 
> I can preview the first src block with [C-c C-v v] now. It is correct:
> ```shell
> df \
> | sed '1d' \
> | awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
> ```
> I can tangle it with [C-c C-v t] to same file name shell script `babel-noweb-ref.sh`.
> 
> But just can't run [C-c C-v e] or [C-c C-]. (Reports same error)
> Seems org-mode can find correct noweb-ref for tangle but can't for eval.

Nor can I.

After a good while, I cannot figure how this works in tangle, but not execute. The calls to `org-babel-noweb-ref-resolve' look the same, but in tangle it returns the :noweb-ref src blocks while in execute "" is returned.

FWIW, labelling the individual src-blocks with the :noweb-ref header seems to work.

Chuck

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-18  4:12     ` Berry, Charles
@ 2017-12-18  4:28       ` stardiviner
  2017-12-18 16:46         ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: stardiviner @ 2017-12-18  4:28 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

I can't find `org-babel-noweb-ref-resolve` in any of org-mode `master` 
branch source code.

I use `counsel-git-grep` searched through the repository. Not found.

Can you point out where is it?


On 12/18/2017 12:12 PM, Berry, Charles wrote:
>
>> On Dec 17, 2017, at 6:08 PM, stardiviner <numbchild@gmail.com> wrote:
>>
>> The example I original copied from is Emacs org-mode info.
>> So I rewrite a hand typing content again:
>> ```org
>> * Test
>>
>> #+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh
>> <<fullest-disk>>
>> #+end_src
>>
>> ** the mount point of the fullest disk
>> :PROPERTIES:
>> :header-args: :noweb-ref fullest-disk
>> :END:
>>
>> *** query all mount disks
>>
>> #+begin_src shell
>> df \
>> #+end_src
>>
>> *** strip the header row
>>
>> #+begin_src shell
>> | sed '1d' \
>> #+end_src
>>
>> *** output mount point of fullest disk
>>
>> #+begin_src shell
>> | awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
>> #+end_src
>> ```
>>
>> I can preview the first src block with [C-c C-v v] now. It is correct:
>> ```shell
>> df \
>> | sed '1d' \
>> | awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
>> ```
>> I can tangle it with [C-c C-v t] to same file name shell script `babel-noweb-ref.sh`.
>>
>> But just can't run [C-c C-v e] or [C-c C-]. (Reports same error)
>> Seems org-mode can find correct noweb-ref for tangle but can't for eval.
> Nor can I.
>
> After a good while, I cannot figure how this works in tangle, but not execute. The calls to `org-babel-noweb-ref-resolve' look the same, but in tangle it returns the :noweb-ref src blocks while in execute "" is returned.
>
> FWIW, labelling the individual src-blocks with the :noweb-ref header seems to work.
>
> Chuck
>
>
>

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-18  4:28       ` stardiviner
@ 2017-12-18 16:46         ` Berry, Charles
  2017-12-18 17:28           ` numbchild
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-18 16:46 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-org-mode



> On Dec 17, 2017, at 8:28 PM, stardiviner <numbchild@gmail.com> wrote:
> 
> I can't find `org-babel-noweb-ref-resolve` in any of org-mode `master` branch source code.


Sorry. I was off my medication when I wrote that. I suffer from CDD (Caffeine Deficit Disorder). Now I am back on my meds and can say that I should have typed:

	(org-babel-expand-noweb-references info)

Is there an emoji for chagrin?

Chuck

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-18 16:46         ` Berry, Charles
@ 2017-12-18 17:28           ` numbchild
  2017-12-19  4:59             ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: numbchild @ 2017-12-18 17:28 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

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

You're right, I searched this function through source code and dived into
them. Did not found any obvious places which might cause this issue neither.

Hope someone can help here.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Tue, Dec 19, 2017 at 12:46 AM, Berry, Charles <ccberry@ucsd.edu> wrote:

>
>
> > On Dec 17, 2017, at 8:28 PM, stardiviner <numbchild@gmail.com> wrote:
> >
> > I can't find `org-babel-noweb-ref-resolve` in any of org-mode `master`
> branch source code.
>
>
> Sorry. I was off my medication when I wrote that. I suffer from CDD
> (Caffeine Deficit Disorder). Now I am back on my meds and can say that I
> should have typed:
>
>         (org-babel-expand-noweb-references info)
>
> Is there an emoji for chagrin?
>
> Chuck
>

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

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

* Re: header argument :noweb-ref seems can't be resolved
  2017-12-18 17:28           ` numbchild
@ 2017-12-19  4:59             ` Berry, Charles
  2017-12-19  7:31               ` [BUG] " stardiviner
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-19  4:59 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: emacs-org-mode



> On Dec 18, 2017, at 9:28 AM, numbchild@gmail.com wrote:
> 
> Hope someone can help here.
> 

OK. I think I have it. `org-babel-params-from-properties' uses `org-babel-current-src-block' to figure out where to look for properties. And o-b-c-s-b-l is let bound in `org-babel-noweb-expand-references' to the src block location with the noweb reference, e.g. `<<whatnot>>'. 


The problem can be illustrated like so. Put this in a buffer:

#+begin_src org

  ,* abc
    :PROPERTIES:
    :header-args: :noweb-ref abcblocks
    :END:

  ,#+name: got-abc
  ,#+begin_src R
  1+2
  ,#+end_src


  ,* def

#+end_src

execute this:

#+begin_src emacs-lisp
  (defun show-prob (obcsbl)
    (let
	((org-babel-current-src-block-location obcsbl))
     (assq :noweb-ref (nth 2 (org-babel-get-src-block-info)))))
#+end_src

Then put point in the got-abc src block and type 

    M-: (show-prob (point)) RET

and you will see `(:noweb-ref . "abcblocks")' in the minibuffer.

Now try 

   M-:  (show-prob 1000) RET

and the result is `nil'.

The problem can be fixed by let-binding `org-babel-current-src-block-location' to `beg-body' in `org-babel-noweb-expand-references' like this

		  (org-babel-map-src-blocks nil
			    (let*
				((org-babel-current-src-block-location beg-body)
				 (i (org-babel-get-src-block-info 'light)))
	
but maybe it is better to change  `org-babel-params-from-properties'.

WDYT?

Chuck

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

* [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-19  4:59             ` Berry, Charles
@ 2017-12-19  7:31               ` stardiviner
  2017-12-19 17:49                 ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: stardiviner @ 2017-12-19  7:31 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

Confirmed. I don't know how to fix this problem, so maybe report to 
Org-mode ML is the better way. (I changed the message title by prepend 
[BUG])


On 12/19/2017 12:59 PM, Berry, Charles wrote:
>
>> On Dec 18, 2017, at 9:28 AM, numbchild@gmail.com wrote:
>>
>> Hope someone can help here.
>>
> OK. I think I have it. `org-babel-params-from-properties' uses `org-babel-current-src-block' to figure out where to look for properties. And o-b-c-s-b-l is let bound in `org-babel-noweb-expand-references' to the src block location with the noweb reference, e.g. `<<whatnot>>'.
>
>
> The problem can be illustrated like so. Put this in a buffer:
>
> #+begin_src org
>
>    ,* abc
>      :PROPERTIES:
>      :header-args: :noweb-ref abcblocks
>      :END:
>
>    ,#+name: got-abc
>    ,#+begin_src R
>    1+2
>    ,#+end_src
>
>
>    ,* def
>
> #+end_src
>
> execute this:
>
> #+begin_src emacs-lisp
>    (defun show-prob (obcsbl)
>      (let
> 	((org-babel-current-src-block-location obcsbl))
>       (assq :noweb-ref (nth 2 (org-babel-get-src-block-info)))))
> #+end_src
>
> Then put point in the got-abc src block and type
>
>      M-: (show-prob (point)) RET
>
> and you will see `(:noweb-ref . "abcblocks")' in the minibuffer.
>
> Now try
>
>     M-:  (show-prob 1000) RET
>
> and the result is `nil'.
>
> The problem can be fixed by let-binding `org-babel-current-src-block-location' to `beg-body' in `org-babel-noweb-expand-references' like this
>
> 		  (org-babel-map-src-blocks nil
> 			    (let*
> 				((org-babel-current-src-block-location beg-body)
> 				 (i (org-babel-get-src-block-info 'light)))
> 	
> but maybe it is better to change  `org-babel-params-from-properties'.
>
> WDYT?
>
> Chuck
>
>

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

* Re: [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-19  7:31               ` [BUG] " stardiviner
@ 2017-12-19 17:49                 ` Berry, Charles
  2017-12-19 19:00                   ` Nicolas Goaziou
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-19 17:49 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-org-mode



> On Dec 18, 2017, at 11:31 PM, stardiviner <numbchild@gmail.com> wrote:
> 
> Confirmed. I don't know how to fix this problem, so maybe report to Org-mode ML is the better way. (I changed the message title by prepend [BUG])

I guess I was unclear. There are two ways to fix this.

1) let bind org-babel-current-src-block-location in org-babel-expand-noweb-references in the loop that scans for noweb-ref'ed src blocks.  This fixes the bug, but contradicts the docstring for o-b-c-s-b-l, which says it is the location of the currently executing src block. Maybe not a big deal, since `org-babel-exp-src-block' can export blocks that are not actually executed which is another contradiction of the docstring. Maybe change the docstring. 

2) rewrite org-babel-params-from-properties to add an optional arg `src-block-location' and use it when provided to govern where to look up properties.  Modify `org-babel-get-src-block-info' accordingly to add that arg when calling o-b-p-f-p.  This honors the use of o-b-c-s-b-l as the location of the executing src block, but inflates the code to accommodate just the `noweb-ref' case.  

I think `2' is better as it makes clearer where o-b-p-f-p is looking for properties when reading the code of org-babel-get-src-block-info.

Chuck

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

* Re: [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-19 17:49                 ` Berry, Charles
@ 2017-12-19 19:00                   ` Nicolas Goaziou
  2017-12-20  5:32                     ` Berry, Charles
  0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2017-12-19 19:00 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

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

Hello,

"Berry, Charles" <ccberry@ucsd.edu> writes:

> I guess I was unclear. There are two ways to fix this.
>
> 1) let bind org-babel-current-src-block-location in
> org-babel-expand-noweb-references in the loop that scans for
> noweb-ref'ed src blocks. This fixes the bug, but contradicts the
> docstring for o-b-c-s-b-l, which says it is the location of the
> currently executing src block. Maybe not a big deal, since
> `org-babel-exp-src-block' can export blocks that are not actually
> executed which is another contradiction of the docstring. Maybe change
> the docstring.
>
> 2) rewrite org-babel-params-from-properties to add an optional arg
> `src-block-location' and use it when provided to govern where to look
> up properties. Modify `org-babel-get-src-block-info' accordingly to
> add that arg when calling o-b-p-f-p. This honors the use of
> o-b-c-s-b-l as the location of the executing src block, but inflates
> the code to accommodate just the `noweb-ref' case.
>
> I think `2' is better as it makes clearer where o-b-p-f-p is looking
> for properties when reading the code of org-babel-get-src-block-info.

Since :noweb-ref is the only property that absolutely needs to be
retrieved from definition, another option would be to write a specific
function for that.

It implies some duplicated efforts with `org-babel-get-src-block-info',
but it is faster when the source name doesn't match, which is the most
common case, and avoids all side-effects from
`org-babel-get-src-block-info'.

WDYT?

Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix noweb-ref --]
[-- Type: text/x-diff, Size: 2706 bytes --]

From ea24f751fd4ec91857d59e2c287754d3d6dc33f1 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Tue, 19 Dec 2017 19:55:51 +0100
Subject: [PATCH] ob-core: Correctly find  Noweb reference

* lisp/ob-core.el (org-babel--noweb-reference): New function.
(org-babel-expand-noweb-references): Use new function.
---
 lisp/ob-core.el | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index ade39ec67..bc3c255f5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2662,6 +2662,36 @@ CONTEXT may be one of :tangle, :export or :eval."
     (cl-some (lambda (v) (member v allowed-values))
 	     (split-string (or (cdr (assq :noweb params)) "")))))
 
+(defun org-babel--noweb-reference (element)
+  "Return Noweb reference for ELEMENT.
+ELEMENT is a source block.  Return value from `:noweb-ref',
+possibly inherited from properties, or nil."
+  (let ((language (org-element-property :language element)))
+    (cdr
+     (or (assq :noweb-ref		;from block itself
+	       (org-babel-parse-header-arguments
+		(mapconcat #'identity
+			   (cons (org-element-property :parameters element)
+				 (org-element-property :header element))
+			   " ")))
+	 (assq :noweb-ref		;from properties
+	       (org-babel-parse-header-arguments
+		(org-trim
+		 (concat
+		  (and language
+		       (org-entry-get (point)
+				      (concat "header-args:" language)
+				      'inherit))
+		  " "
+		  (org-entry-get (point) "header-args" 'inherit)))))
+	 (and language
+	      (let ((lang-headers
+		     (intern (concat "org-babel-default-header-args:"
+				     language))))
+		(and (boundp lang-headers)
+		     (assq :noweb-ref (symbol-value lang-headers)))))
+	 (assq :noweb-ref org-babel-default-header-args)))))
+
 (defun org-babel-expand-noweb-references (&optional info parent-buffer)
   "Expand Noweb references in the body of the current source code block.
 
@@ -2777,11 +2807,14 @@ block but are passed literally to the \"example-block\"."
 			;; those with a matching Noweb reference.
 			(let ((expansion nil))
 			  (org-babel-map-src-blocks nil
-			    (let ((i (org-babel-get-src-block-info 'light)))
+			    (let ((element (org-element-at-point)))
 			      (when (equal source-name
-					   (cdr (assq :noweb-ref (nth 2 i))))
-				(let ((sep (or (cdr (assq :noweb-sep (nth 2 i)))
-					       "\n")))
+					   (org-babel--noweb-reference element))
+				(let* ((i (org-babel-get-src-block-info
+					   'light element))
+				       (sep
+					(or (cdr (assq :noweb-sep (nth 2 i)))
+					    "\n")))
 				  (setq expansion
 					(cons sep
 					      (cons (funcall expand-body i)
-- 
2.15.1


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

* Re: [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-19 19:00                   ` Nicolas Goaziou
@ 2017-12-20  5:32                     ` Berry, Charles
  2017-12-20 12:23                       ` Nicolas Goaziou
  0 siblings, 1 reply; 14+ messages in thread
From: Berry, Charles @ 2017-12-20  5:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org-mode



> On Dec 19, 2017, at 11:00 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 
> Since :noweb-ref is the only property that absolutely needs to be
> retrieved from definition, another option would be to write a specific
> function for that.
> 
> It implies some duplicated efforts with `org-babel-get-src-block-info',
> but it is faster when the source name doesn't match, which is the most
> common case, and avoids all side-effects from
> `org-babel-get-src-block-info'.
> 
> WDYT?

Looks pretty clean. I've not had time to try it out, however.

Chuck

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

* Re: [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-20  5:32                     ` Berry, Charles
@ 2017-12-20 12:23                       ` Nicolas Goaziou
  2017-12-20 15:41                         ` numbchild
  0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2017-12-20 12:23 UTC (permalink / raw)
  To: Berry, Charles; +Cc: emacs-org-mode

Hello,

"Berry, Charles" <ccberry@ucsd.edu> writes:

> Looks pretty clean. I've not had time to try it out, however.

Thank you.

OK. I applied it on master. Since there was some differences with maint,
I didn't backport it there, though. Instead, I bound
`org-babel-current-sourced-block-location' to the current block.

Hopefully, the problem is now solved.

Regards,

-- 
Nicolas Goaziou

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

* Re: [BUG] Re: header argument :noweb-ref seems can't be resolved
  2017-12-20 12:23                       ` Nicolas Goaziou
@ 2017-12-20 15:41                         ` numbchild
  0 siblings, 0 replies; 14+ messages in thread
From: numbchild @ 2017-12-20 15:41 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org-mode, Berry, Charles

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

 problem solved, Thanks very much. @Nicolas and @Berry.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Wed, Dec 20, 2017 at 8:23 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> "Berry, Charles" <ccberry@ucsd.edu> writes:
>
> > Looks pretty clean. I've not had time to try it out, however.
>
> Thank you.
>
> OK. I applied it on master. Since there was some differences with maint,
> I didn't backport it there, though. Instead, I bound
> `org-babel-current-sourced-block-location' to the current block.
>
> Hopefully, the problem is now solved.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>

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

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

end of thread, other threads:[~2017-12-20 15:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-17 14:58 header argument :noweb-ref seems can't be resolved stardiviner
2017-12-17 17:40 ` Berry, Charles
2017-12-18  2:08   ` stardiviner
2017-12-18  4:12     ` Berry, Charles
2017-12-18  4:28       ` stardiviner
2017-12-18 16:46         ` Berry, Charles
2017-12-18 17:28           ` numbchild
2017-12-19  4:59             ` Berry, Charles
2017-12-19  7:31               ` [BUG] " stardiviner
2017-12-19 17:49                 ` Berry, Charles
2017-12-19 19:00                   ` Nicolas Goaziou
2017-12-20  5:32                     ` Berry, Charles
2017-12-20 12:23                       ` Nicolas Goaziou
2017-12-20 15:41                         ` numbchild

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).