From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: header argument :noweb-ref seems can't be resolved Date: Sun, 17 Dec 2017 22:58:07 +0800 Message-ID: <65580a97-24c4-a54c-655f-c37fcddd2cd1@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQaOa-0003xI-Il for emacs-orgmode@gnu.org; Sun, 17 Dec 2017 09:58:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQaOO-0005my-Ed for emacs-orgmode@gnu.org; Sun, 17 Dec 2017 09:58:26 -0500 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]:41760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQaON-0005ly-Sz for emacs-orgmode@gnu.org; Sun, 17 Dec 2017 09:58:16 -0500 Received: by mail-pg0-x229.google.com with SMTP id o2so8177562pgc.8 for ; Sun, 17 Dec 2017 06:58:15 -0800 (PST) Received: from [0.0.0.0] ([119.28.89.243]) by smtp.gmail.com with ESMTPSA id b9sm24385868pfl.108.2017.12.17.06.58.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 06:58:11 -0800 (PST) Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org-mode I have the following org-mode file content: ```org #+begin_src shell :tangle yes :noweb yes :shebang #!/bin/sh <> #+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 <> #+end_src ``` Emacs reports error: ``` Debugger entered--Lisp error: (error "<> could not be resolved (see ‘org-babel-noweb-error-langs’)")   signal(error ("<> could not be resolved (see ‘org-babel-noweb-error-langs’)"))   error("%s could not be resolved (see `org-babel-noweb-error-langs')" "<>")   (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" "<>" ((: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" "<>" ((: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" "<>" ((: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" "<>" ((: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" "<>" ((: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 "\\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 "\\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 "\\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 "\\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." #)(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." #) 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." #) org-ctrl-c-ctrl-c)   command-execute(org-ctrl-c-ctrl-c) ```