From a6dad433956d33cba254b0ec3bd819aa0cd91d8f Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Mon, 5 Mar 2012 00:19:35 +0530 Subject: [PATCH 01/10] org-e-html: Support for cross references --- EXPERIMENTAL/org-e-html.el | 104 ++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 47 deletions(-) diff --git a/EXPERIMENTAL/org-e-html.el b/EXPERIMENTAL/org-e-html.el index bb5c80d8f..7e3eb30c0 100644 --- a/EXPERIMENTAL/org-e-html.el +++ b/EXPERIMENTAL/org-e-html.el @@ -56,6 +56,7 @@ (declare-function org-element-parse-secondary-string "org-element" (string restriction &optional buffer)) (defvar org-element-string-restrictions) +(defvar org-element-object-restrictions) (declare-function org-export-clean-table "org-export" (table specialp)) (declare-function org-export-data "org-export" (data backend info)) @@ -1566,10 +1567,13 @@ This function shouldn't be used for floats. See (when (plist-get info :style-include-scripts) org-e-html-scripts))) -(defun org-e-html-mathjax-config (template options in-buffer) +(defun org-e-html-mathjax-config (info) "Insert the user setup into the matchjax template." (when (member (plist-get info :LaTeX-fragments) '(mathjax t)) - (let (name val (yes " ") (no "// ") x) + (let ((template org-e-html-mathjax-template) + (options org-e-html-mathjax-options) + (in-buffer (or (plist-get info :mathjax) "")) + name val (yes " ") (no "// ") x) (mapc (lambda (e) (setq name (car e) val (nth 1 e)) @@ -1725,9 +1729,7 @@ original parsed data. INFO is a plist holding export options." " (org-e-html-meta-info info) ; meta (org-e-html-style info) ; style - (org-e-html-mathjax-config ; mathjax - org-e-html-mathjax-template org-e-html-mathjax-options - (or (plist-get info :mathjax) "")) + (org-e-html-mathjax-config info) ; mathjax " " @@ -2061,7 +2063,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (concat ;; Insert separator between two footnotes in a row. (let ((prev (org-export-get-previous-element footnote-reference info))) - (when (and (listp prev) (eq (car prev) 'footnote-reference)) + (when (eq (org-element-type prev) 'footnote-reference) org-e-html-footnote-separator)) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -2092,7 +2094,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." "Transcode an HEADLINE element from Org to HTML. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." - (let* ((numberedp (plist-get info :section-numbers)) + (let* ((numberedp (org-export-numbered-headline-p headline info)) (level (org-export-get-relative-level headline info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property @@ -2126,7 +2128,7 @@ holding contextual information." CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." (let* ((class (plist-get info :latex-class)) - (numberedp (plist-get info :section-numbers)) + (numberedp (org-export-numbered-headline-p headline info)) ;; Get level relative to current parsed data. (level (org-export-get-relative-level headline info)) ;; (class-sectionning (assoc class org-e-html-classes)) @@ -2396,8 +2398,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." (cond ((string= key "latex") value) ((string= key "index") (format "\\index{%s}" value)) - ((string= key "target") - (format "\\label{%s}" (org-export-solidify-link-text value))) + ;; Invisible targets. + ((string= key "target") nil) ; FIXME ((string= key "toc") (let ((value (downcase value))) (cond @@ -2545,50 +2547,58 @@ INFO is a plist holding contextual information. See (cond ;; Image file. (imagep (org-e-html-link--inline-image link info)) - ;; Target or radioed target: replace link with the normalized - ;; custom-id/target name. - ((member type '("target" "radio")) + ;; Radioed target: Target's name is obtained from original raw + ;; link. Path is parsed and transcoded in order to have a proper + ;; display of the contents. + ((string= type "radio") (format "%s" (org-export-solidify-link-text path) - (or desc (org-export-secondary-string path 'e-html info)))) + (org-export-secondary-string + (org-element-parse-secondary-string + path (cdr (assq 'radio-target org-element-object-restrictions))) + 'e-html info))) ;; Links pointing to an headline: Find destination and build - ;; appropriate referencing commanding. + ;; appropriate referencing command. ((member type '("custom-id" "fuzzy" "id")) (let ((destination (if (string= type "fuzzy") (org-export-resolve-fuzzy-link link info) (org-export-resolve-id-link link info)))) - ;; Fuzzy link points to a target. Do as above. (case (org-element-type destination) - (target - (format "%s" - (org-export-solidify-link-text (org-element-property - :raw-value destination)) + ;; Fuzzy link points nowhere. + ('nil + (format "%s" (or desc (org-export-secondary-string (org-element-property :raw-link link) 'e-html info)))) - ;; Fuzzy link points to an headline. If headlines are - ;; numbered and the link has no description, display - ;; headline's number. Otherwise, display description or - ;; headline's title. + ;; Fuzzy link points to an invisible target. + (keyword nil) + ;; LINK points to an headline. If headlines are numbered + ;; and the link has no description, display headline's + ;; number. Otherwise, display description or headline's + ;; title. (headline - (let ((label - (format "sec-%s" - (mapconcat - 'number-to-string - (org-export-get-headline-number destination info) - "-")))) - (if (and (plist-get info :section-numbers) (not desc)) - (format "\\ref{%s}" label) - (format "%s" - label (or desc - (org-export-secondary-string - (org-element-property :title destination) - 'e-html info)))))) - ;; Fuzzy link points nowhere. + (let* ((headline-no (org-export-get-headline-number destination info)) + (label (format "sec-%s" (mapconcat 'number-to-string + headline-no "-"))) + (section-no (mapconcat 'number-to-string headline-no "."))) + (setq desc + (cond + (desc desc) + ((plist-get info :section-numbers) section-no) + (t (org-export-secondary-string + (org-element-property :title destination) + 'e-html info)))) + (format "%s" label desc))) + ;; Fuzzy link points to a target. Do as above. (otherwise - (format "%s" (or desc (org-export-secondary-string - (org-element-property :raw-link link) - 'e-html info))))))) + (let ((path (org-export-solidify-link-text path))) + (unless desc + (setq desc (let ((number (org-export-get-ordinal + destination info))) + (when number + (if (atom number) (number-to-string number) + (mapconcat 'number-to-string number ".")))))) + (format "%s" path (or desc "FIXME"))))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. ((string= type "coderef") @@ -2635,7 +2645,7 @@ the plist used as a communication channel." (class (cdr (assoc style '((footnote . "footnote") (verse . nil))))) (extra (if class (format " class=\"%s\"" class) "")) - (parent (car (org-export-get-genealogy paragraph info)))) + (parent (org-export-get-parent paragraph info))) (cond ((and (equal (car parent) 'item) (= (org-element-property :begin paragraph) @@ -3060,13 +3070,13 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Target -(defun org-e-html-target (target text info) +(defun org-e-html-target (target contents info) "Transcode a TARGET object from Org to HTML. -TEXT is the text of the target. INFO is a plist holding -contextual information." +CONTENTS is nil. INFO is a plist holding contextual +information." (let ((id (org-export-solidify-link-text - (org-element-property :raw-value target)))) - (format "%s" id id text))) + (org-element-property :value target)))) + (format "" id id))) ;;;; Time-stamp From 1749db14fbe198d14bbd7f987042640c3fd626df Mon Sep 17 00:00:00 2001 From: Karl Fogel Date: Thu, 1 Mar 2012 00:45:05 +0000 Subject: [PATCH 02/10] org-agenda: Handle case of heading w/ date but no keyword * lisp/org-agenda.el (org-agenda-highlight-todo): Handle the case of a heading that has a date but no todo keyword. This is a fix for the args-out-of-range bug discussed in these threads: http://thread.gmane.org/gmane.emacs.orgmode/52621 http://thread.gmane.org/gmane.emacs.orgmode/52793 http://thread.gmane.org/gmane.emacs.orgmode/52786 http://thread.gmane.org/gmane.emacs.orgmode/52810 The discussions involved Ilya Shlyakhter, James Atwood, Nick Dokos, and myself, and the subject headers are: bug report: agenda timeline crashes Bug report: weekly agenda and blank, timestamped headers org-agenda-list (from git) giving "args-out-of-range error" TINYCHANGE --- lisp/org-agenda.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index d46f2efa8..883782814 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5868,8 +5868,18 @@ could bind the variable in the options section of a custom command.") (let ((pl (text-property-any 0 (length x) 'org-heading t x))) (setq re (get-text-property 0 'org-todo-regexp x)) (when (and re + ;; Test `pl' because if there's no heading content, + ;; there's no point matching to highlight. Note + ;; that if we didn't test `pl' first, and there + ;; happened to be no keyword from `org-todo-regexp' + ;; on this heading line, then the `equal' comparison + ;; afterwards would spuriously succeed in the case + ;; where `pl' is nil -- causing an args-out-of-range + ;; error when we try to add text properties to text + ;; that isn't there. + pl (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)") - x (or pl 0)) pl)) + x pl) pl)) (add-text-properties (or (match-end 1) (match-end 0)) (match-end 0) (list 'face (org-get-todo-face (match-string 2 x))) From 4a6e02c7229c2e5e030771b99e0343ba9998ec16 Mon Sep 17 00:00:00 2001 From: Bernt Hansen Date: Sat, 25 Feb 2012 07:43:16 +0000 Subject: [PATCH 03/10] Fix task cloning for repeating tasks * org.el (org-clone-subtree-with-time-shift): Fix task cloning for repeating tasks using .+n and ++n syntax Tasks with repeaters using .+n and ++n syntax retain the repeater in all of the clones causing duplicate tasks. These tasks are now handled the same as the regular repeating task using +n syntax. --- lisp/org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 74329b517..838129658 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7909,7 +7909,7 @@ the following will happen: repeater intact. - the start days in the repeater in the original entry will be shifted to past the last clone. -I this way you can spell out a number of instances of a repeating task, +In this way you can spell out a number of instances of a repeating task, and still retain the repeater to cover future instances of the task." (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") (let (beg end template task idprop @@ -7936,7 +7936,7 @@ and still retain the repeater to cover future instances of the task." (setq end (point)) (setq template (buffer-substring beg end)) (when (and doshift - (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) + (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template)) (delete-region beg end) (setq end beg) (setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) @@ -7967,7 +7967,7 @@ and still retain the repeater to cover future instances of the task." (while (re-search-forward org-ts-regexp nil t) (save-excursion (goto-char (match-beginning 0)) - (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") + (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)") (delete-region (match-beginning 1) (match-end 1))))))) (setq task (buffer-string))) (insert task)) From 595769d359b16c768e36bcf12d98ef61f33cf428 Mon Sep 17 00:00:00 2001 From: David Maus Date: Sun, 4 Mar 2012 20:35:04 +0100 Subject: [PATCH 04/10] org-bbdb: Declare functions, silence byte compiler * org-bbdb.el (bbdb-record-get-field, bbdb-search-name) (bbdb-search-organization): Declare functions to silence byte compiler. --- lisp/org-bbdb.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el index bc5b96f43..7fb9fc9d9 100644 --- a/lisp/org-bbdb.el +++ b/lisp/org-bbdb.el @@ -112,6 +112,9 @@ (&optional dont-check-disk already-in-db-buffer)) (declare-function bbdb-split "ext:bbdb" (string separators)) (declare-function bbdb-string-trim "ext:bbdb" (string)) +(declare-function bbdb-record-get-field "ext:bbdb" (record field)) +(declare-function bbdb-search-name "ext:bbdb-com" (regexp &optional layout)) +(declare-function bbdb-search-organization "ext:bbdb-com" (regexp &optional layout)) (declare-function calendar-leap-year-p "calendar" (year)) (declare-function diary-ordinal-suffix "diary-lib" (n)) From c9482d61a83ddd9ddfa205ad9831e25a51638d7d Mon Sep 17 00:00:00 2001 From: David Maus Date: Sun, 4 Mar 2012 20:37:46 +0100 Subject: [PATCH 05/10] org-bbdb: Pass variable to avoid dynamic scoping. * org-bbdb.el (org-bbdb-open, org-bbdb-open-old) (org-bbdb-open-new): Pass record name to avoid dynamic scoping. --- lisp/org-bbdb.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el index 7fb9fc9d9..c4ef2a48d 100644 --- a/lisp/org-bbdb.el +++ b/lisp/org-bbdb.el @@ -225,10 +225,10 @@ italicized, in all other cases it is left unchanged." (let ((inhibit-redisplay (not debug-on-error)) (bbdb-electric-p nil)) (if (fboundp 'bbdb-name) - (org-bbdb-open-old) - (org-bbdb-open-new)))) + (org-bbdb-open-old name) + (org-bbdb-open-new name)))) -(defun org-bbdb-open-old () +(defun org-bbdb-open-old (name) (catch 'exit ;; Exact match on name (bbdb-name (concat "\\`" name "\\'") nil) @@ -248,7 +248,7 @@ italicized, in all other cases it is left unchanged." (delete-window (get-buffer-window "*BBDB*")) (error "No matching BBDB record")))) -(defun org-bbdb-open-new () +(defun org-bbdb-open-new (name) (catch 'exit ;; Exact match on name (bbdb-search-name (concat "\\`" name "\\'") nil) From a49193da37a926b6848754a48029a79e34309f3f Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Mon, 5 Mar 2012 01:22:20 +0530 Subject: [PATCH 06/10] org-e-odt: Bring it to the same level as org-e-html --- EXPERIMENTAL/org-e-odt.el | 105 ++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/EXPERIMENTAL/org-e-odt.el b/EXPERIMENTAL/org-e-odt.el index 9cbf9299e..ece643fbe 100644 --- a/EXPERIMENTAL/org-e-odt.el +++ b/EXPERIMENTAL/org-e-odt.el @@ -1838,6 +1838,7 @@ formula file." (declare-function org-element-parse-secondary-string "org-element" (string restriction &optional buffer)) (defvar org-element-string-restrictions) +(defvar org-element-object-restrictions) (declare-function org-export-clean-table "org-export" (table specialp)) (declare-function org-export-data "org-export" (data backend info)) @@ -3488,7 +3489,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." (defun org-e-odt-footnote-def (raw info) ; FIXME (if (equal (org-element-type raw) 'org-data) - (org-trim (org-export-data raw 'e-odt info)) + (org-trim (org-export-data raw 'e-odt info)) ; fix paragraph + ; style (org-odt-format-stylized-paragraph 'footnote (org-trim (org-export-secondary-string raw 'e-odt info))))) @@ -3501,7 +3503,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (concat ;; Insert separator between two footnotes in a row. (let ((prev (org-export-get-previous-element footnote-reference info))) - (when (and (listp prev) (eq (car prev) 'footnote-reference)) + (when (eq (org-element-type prev) 'footnote-reference) org-e-odt-footnote-separator)) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -3536,7 +3538,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." "Transcode an HEADLINE element from Org to HTML. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." - (let* ((numberedp (plist-get info :section-numbers)) + (let* ((numberedp (org-export-numbered-headline-p headline info)) (level (org-export-get-relative-level headline info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property @@ -3570,7 +3572,7 @@ holding contextual information." CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." (let* ((class (plist-get info :latex-class)) - (numberedp (plist-get info :section-numbers)) + (numberedp (org-export-numbered-headline-p headline info)) ;; Get level relative to current parsed data. (level (org-export-get-relative-level headline info)) ;; (class-sectionning (assoc class org-e-odt-classes)) @@ -3789,8 +3791,9 @@ CONTENTS is nil. INFO is a plist holding contextual information." (cond ((string= key "latex") value) ((string= key "index") (format "\\index{%s}" value)) - ((string= key "target") - (format "\\label{%s}" (org-export-solidify-link-text value))) + ((string= key "target") nil ; FIXME + ;; (format "\\label{%s}" (org-export-solidify-link-text value)) + ) ((string= key "toc") (let ((value (downcase value))) (cond @@ -3942,53 +3945,58 @@ INFO is a plist holding contextual information. See (cond ;; Image file. (imagep (org-e-odt-link--inline-image link info)) - ;; Target or radioed target: replace link with the normalized - ;; custom-id/target name. - ((member type '("target" "radio")) + ;; Radioed target: Target's name is obtained from original raw + ;; link. Path is parsed and transcoded in order to have a proper + ;; display of the contents. + ((string= type "radio") (org-e-odt-format-internal-link - (or desc (org-export-secondary-string path 'e-odt info)) + (org-export-secondary-string + (org-element-parse-secondary-string + path (cdr (assq 'radio-target org-element-object-restrictions))) + 'e-odt info) (org-export-solidify-link-text path))) ;; Links pointing to an headline: Find destination and build - ;; appropriate referencing commanding. + ;; appropriate referencing command. ((member type '("custom-id" "fuzzy" "id")) (let ((destination (if (string= type "fuzzy") (org-export-resolve-fuzzy-link link info) (org-export-resolve-id-link link info)))) - ;; Fuzzy link points to a target. Do as above. (case (org-element-type destination) - (target - (org-e-odt-format-internal-link - (or desc - (org-export-secondary-string - (org-element-property :raw-link link) - 'e-odt info)) - (org-export-solidify-link-text - (org-element-property :raw-value destination)))) - ;; Fuzzy link points to an headline. If headlines are - ;; numbered and the link has no description, display - ;; headline's number. Otherwise, display description or - ;; headline's title. - (headline - (let ((label - (format "sec-%s" - (mapconcat - 'number-to-string - (org-export-get-headline-number destination info) - "-")))) - (if (and (plist-get info :section-numbers) (not desc)) - (format "\\ref{%s}" label) - (org-e-odt-format-internal-link - (or desc - (org-export-secondary-string - (org-element-property :title destination) - 'e-odt info)) label)))) ;; Fuzzy link points nowhere. - (otherwise + ('nil (org-e-odt-format-fontify - (or desc - (org-export-secondary-string - (org-element-property :raw-link link) - 'e-odt info)) 'emphasis))))) + (or desc (org-export-secondary-string + (org-element-property :raw-link link) + 'e-odt info)) 'emphasis)) + ;; Fuzzy link points to an invisible target. + (keyword nil) + ;; LINK points to an headline. If headlines are numbered + ;; and the link has no description, display headline's + ;; number. Otherwise, display description or headline's + ;; title. + (headline + (let* ((headline-no (org-export-get-headline-number destination info)) + (label (format "sec-%s" (mapconcat 'number-to-string + headline-no "-"))) + (section-no (mapconcat 'number-to-string headline-no "."))) + (setq desc + (cond + (desc desc) + ((plist-get info :section-numbers) section-no) + (t (org-export-secondary-string + (org-element-property :title destination) + 'e-odt info)))) + (org-e-odt-format-internal-link desc label))) + ;; Fuzzy link points to a target. Do as above. + (otherwise + (let ((path (org-export-solidify-link-text path))) + (unless desc + (setq desc (let ((number (org-export-get-ordinal + destination info))) + (when number + (if (atom number) (number-to-string number) + (mapconcat 'number-to-string number ".")))))) + (org-e-odt-format-internal-link (or desc "FIXME") path)))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. ((string= type "coderef") @@ -4032,7 +4040,7 @@ the plist used as a communication channel." (class (cdr (assoc style '((footnote . "footnote") (verse . nil))))) (extra (if class (format " class=\"%s\"" class) "")) - (parent (car (org-export-get-genealogy paragraph info))) + (parent (org-export-get-parent paragraph info)) (parent-type (org-element-type parent)) (style (case parent-type (quote-block 'quote) @@ -4384,13 +4392,12 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Target -(defun org-e-odt-target (target text info) +(defun org-e-odt-target (target contents info) "Transcode a TARGET object from Org to HTML. -TEXT is the text of the target. INFO is a plist holding -contextual information." +CONTENTS is nil. INFO is a plist holding contextual +information." (org-e-odt-format-anchor - text (org-export-solidify-link-text - (org-element-property :raw-value target)))) + "" (org-export-solidify-link-text (org-element-property :value target)))) ;;;; Time-stamp From aceddafc064b9a04a3d8efb3a0f43cc750606661 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 5 Mar 2012 07:32:03 -0700 Subject: [PATCH 07/10] fixed bug in `sbe' when variables are force interpreted as strings * lisp/ob-table.el (sbe): Don't accidentally leave a `t' value when variables are force interpreted as strings. --- lisp/ob-table.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index 15ebff94f..7d41a0017 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -97,7 +97,7 @@ as shown in the example below. (delq nil (mapcar (lambda (el) (if (eq '$ el) - (setq quote t) + (prog1 nil (setq quote t)) (prog1 (if quote (format "\"%s\"" el) (org-babel-clean-text-properties el)) From efe039db93ec95899f06fb335f8309e4fa7d2a44 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 5 Mar 2012 08:22:35 -0700 Subject: [PATCH 08/10] fix two bugs related to calling tangle with a prefix argument * lisp/ob-tangle.el (org-babel-tangle): Don't prompt for a file name if :tangle is specified. * lisp/ob.el (org-babel-expand-noweb-references): Widen buffer when expanding noweb references. --- lisp/ob-tangle.el | 8 +++++--- lisp/ob.el | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index f5dbb3063..5ff00baa7 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -185,9 +185,11 @@ exported source code blocks by language." (when only-this-block (unless (org-babel-where-is-src-block-head) (error "Point is not currently inside of a code block")) - (unless target-file - (setq target-file - (read-from-minibuffer "Tangle to: " (buffer-file-name)))) + (save-match-data + (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info)))) + target-file) + (setq target-file + (read-from-minibuffer "Tangle to: " (buffer-file-name))))) (narrow-to-region (match-beginning 0) (match-end 0))) (save-excursion (let ((block-counter 0) diff --git a/lisp/ob.el b/lisp/ob.el index 39f53ef77..97878fb0d 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -2169,6 +2169,8 @@ block but are passed literally to the \"example-block\"." (setq index (point)) (nb-add (with-current-buffer parent-buffer + (save-restriction + (widen) (mapconcat ;; interpose PREFIX between every line #'identity (split-string @@ -2228,7 +2230,7 @@ block but are passed literally to the \"example-block\"." "could not be resolved (see " "`org-babel-noweb-error-langs')")) ""))) - "[\n\r]") (concat "\n" prefix))))) + "[\n\r]") (concat "\n" prefix)))))) (nb-add (buffer-substring index (point-max))))) new-body)) From 9480a2210ce7383c74d76f94bf933a11f87c5733 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 5 Mar 2012 10:45:25 -0700 Subject: [PATCH 09/10] improved sbe documentation --- lisp/ob-table.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index 7d41a0017..fb1991792 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -75,9 +75,8 @@ results NOTE: by default string variable names are interpreted as references to source-code blocks, to force interpretation of a -cell's value as a string, prefix the identifier with two \"$\"s -rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the -example above. +cell's value as a string, prefix the identifier a \"$\" (e.g., +\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\"). NOTE: it is also possible to pass header arguments to the code block. In this case a table cell should hold the string value of From 9371465aabaf10fe948f4bf2e4f107a18eb958d5 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 5 Mar 2012 14:54:56 -0700 Subject: [PATCH 10/10] describe the ability to execute noweb references in the manual * doc/org.texi (Noweb reference syntax): Describe the ability to execute noweb references in the manual. --- doc/org.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/org.texi b/doc/org.texi index 61e6707b0..170a55255 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -14057,6 +14057,14 @@ evaluation. If @code{:noweb no}, the default, then the reference is not expanded before evaluation. See the @ref{noweb-ref} header argument for a more flexible way to resolve noweb references. +It is possible to include the @emph{results} of a code block rather than the +body. This is done by appending parenthesis to the code block name which may +optionally contain arguments to the code block as shown below. + +@example +<> +@end example + Note: the default value, @code{:noweb no}, was chosen to ensure that correct code is not broken in a language, such as Ruby, where @code{<>} is a syntactically valid construct. If @code{<>} is not