From cbd4a5b7642400a8ef143edb64cd9aaa67d65d9e Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 1 Jun 2011 06:32:10 -0600 Subject: [PATCH 1/4] ob-lisp: re-arrange order of function nesting in lisp execution function * lisp/ob-lisp.el (org-babel-execute:lisp): No real functional change, just aesthetic. --- lisp/ob-lisp.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el index a875d552b..a11a300c1 100644 --- a/lisp/ob-lisp.el +++ b/lisp/ob-lisp.el @@ -64,14 +64,14 @@ "Execute a block of Common Lisp code with Babel." (require 'slime) (org-babel-reassemble-table - (with-temp-buffer - (insert (org-babel-expand-body:lisp body params)) - ((lambda (result) - (if (member "output" (cdr (assoc :result-params params))) - (car result) - (condition-case nil - (read (org-bable-lisp-vector-to-list (cadr result))) - (error (cadr result))))) + ((lambda (result) + (if (member "output" (cdr (assoc :result-params params))) + (car result) + (condition-case nil + (read (org-bable-lisp-vector-to-list (cadr result))) + (error (cadr result))))) + (with-temp-buffer + (insert (org-babel-expand-body:lisp body params)) (slime-eval `(swank:eval-and-grab-output ,(format "(progn %s)" (buffer-substring-no-properties (point-min) (point-max)))) From 459cbd4fd86fcca8478de12ed0c067e032e4760c Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 1 Jun 2011 06:35:54 -0600 Subject: [PATCH 2/4] ob-lisp: setting *default-pathname-defaults* to the directory of the Org-mode file Thanks to Mark Cox for suggesting this change. * lisp/ob-lisp.el (org-babel-execute:lisp): Setting the value of *default-pathname-defaults* to either the value of the :dir header argument or the directory of the containing Org-mode file. --- lisp/ob-lisp.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el index a11a300c1..a7c4ec576 100644 --- a/lisp/ob-lisp.el +++ b/lisp/ob-lisp.el @@ -73,8 +73,13 @@ (with-temp-buffer (insert (org-babel-expand-body:lisp body params)) (slime-eval `(swank:eval-and-grab-output - ,(format "(progn %s)" (buffer-substring-no-properties - (point-min) (point-max)))) + ,(format "(let ((*default-pathname-defaults* %S)) %s)" + (let ((dir (if (assoc :dir params) + (cdr (assoc :dir params)) + default-directory))) + (when dir (concat "#P" dir))) + (buffer-substring-no-properties + (point-min) (point-max)))) (cdr (assoc :package params))))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) From fbfc2d1835fd414e13a5a9d33c72cedf64eb9b08 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 1 Jun 2011 18:52:33 -0600 Subject: [PATCH 3/4] ob-lisp: more general handling of the default-directory value in lisp code Once again, thanks to Mark Cox for raising these issues. * lisp/ob-lisp.el (org-babel-lisp-dir-fmt): Defcustom for use in changing how/if the current directory is represented to lisp code. (org-babel-execute:lisp): More general handling of the default directory value. --- lisp/ob-lisp.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el index a7c4ec576..4baf60309 100644 --- a/lisp/ob-lisp.el +++ b/lisp/ob-lisp.el @@ -41,6 +41,12 @@ (defvar org-babel-default-header-args:lisp '()) (defvar org-babel-header-arg-names:lisp '(package)) +(defcustom org-babel-lisp-dir-fmt + "(let ((*default-pathname-defaults* #P%S)) %%s)" + "Format string used to wrap code bodies to set the current directory. +For example a value of \"(progn ;; %s\\n %%s)\" would ignore the +current directory string.") + (defun org-babel-expand-body:lisp (body params) "Expand BODY according to PARAMS, return the expanded body." (let* ((vars (mapcar #'cdr (org-babel-get-header params :var))) @@ -73,13 +79,13 @@ (with-temp-buffer (insert (org-babel-expand-body:lisp body params)) (slime-eval `(swank:eval-and-grab-output - ,(format "(let ((*default-pathname-defaults* %S)) %s)" - (let ((dir (if (assoc :dir params) + ,(let ((dir (if (assoc :dir params) (cdr (assoc :dir params)) default-directory))) - (when dir (concat "#P" dir))) - (buffer-substring-no-properties - (point-min) (point-max)))) + (format + (if dir (format org-babel-lisp-dir-fmt dir) "(progn %s)") + (buffer-substring-no-properties + (point-min) (point-max))))) (cdr (assoc :package params))))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) From 3433861e62dae79beefc649b7cbbf057a42b3266 Mon Sep 17 00:00:00 2001 From: David Maus Date: Thu, 2 Jun 2011 09:10:05 +0200 Subject: [PATCH 4/4] Escape curly brackets in texinfo LaTeX example block * org.texi (Images in LaTeX export): Escape curly brackets in LaTeX example. --- doc/org.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 6f396a25b..eb977594f 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10221,9 +10221,9 @@ For example the @code{#+ATTR_LaTeX:} line below is exported as the @example #+ATTR_LaTeX: placement=[]\footnotesize -\begin{figure}[]\footnotesize +\begin@{figure@}[]\footnotesize ... -\end{figure} +\end@{figure@} @end example If you would like to let text flow around the image, add the word @samp{wrap}