Commit Graph

393 Commits

Author SHA1 Message Date
Eric Schulte d45826943a babel: cleanup trailing newline after removed #+source and #+results lines
* contrib/babel/lisp/org-babel-exp.el (org-exp-res/src-name-cleanup):
  cleanup trailing newline after removed #+source and #+results lines
2010-06-16 10:16:22 -07:00
Eric Schulte becfc8979e babel: now using re-search-forward to find the end of source blocks
* contrib/babel/lisp/org-babel.el (org-babel-result-end): replacing
  search-forward with re-search-forward when finding the end of result
  blocks
2010-06-15 18:20:29 -07:00
Eric Schulte 689b51224f babel: make sure that source-code blocks don't consume their neighbors
* contrib/babel/lisp/org-babel.el (org-babel-where-is-src-block-result):
  on result insertion, ensure that code blocks don't overrun
  subsequent lines or source blocks
2010-06-15 16:36:07 -07:00
Eric Schulte b7e50cdc3d babel: cleaning up leftovers from block exportation
* contrib/babel/lisp/org-babel-exp.el (org-export-blocks-postblock-hook):
  adding function to cleanup leftovers after block exportation

  (org-exp-res/src-name-cleanup): function to cleanup leftovers from
  block exportation
2010-06-15 16:21:22 -07:00
Eric Schulte 74d337ef23 babel: fixed latex packages in org-babel-latex -- Thanks to William Henney
* contrib/babel/lisp/langs/org-babel-latex.el (org-babel-latex-body-to-tex-file):
  now calling `org-export-latex-fix-inputenc' to sort out encodings in
  latex package list
2010-06-14 14:45:33 -07:00
Eric Schulte 08d8331307 babel: fixed bug resulting from two inline src blocks on the same line
* contrib/babel/lisp/org-babel.el (org-babel-set-interpreters): less
  greedy regexp for inline source blocks ensures that there is no
  confusion when two inline blocks are on the same line.
2010-06-14 13:50:10 -07:00
Eric Schulte 18be132545 babel: adding buffer-wide header arguments behind #+BABEL:
e.g. placing the following at the top of your buffer

will result in all source-code blocks in the buffer having their
:session header argument set to "example"

* contrib/babel/lisp/org-babel-lob.el (org-babel-lob-execute): now
  included buffer-wide header arguments in lob header arguments

* contrib/babel/lisp/org-babel.el (org-babel-params-from-buffer): new
  function for grabbing header arguments from the top of the buffer

  (org-babel-parse-src-block-match): now includes buffer-wide header
  arguments

  (org-babel-parse-inline-src-block-match): now includes buffer-wide
  header arguments

  (org-babel-current-buffer-properties): buffer-local variable to hold
  buffer-wide header arguments
2010-06-14 12:15:11 -07:00
Eric Schulte 1da53c668a babel: bug fix in exporter wrt: contents of lob info lists
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-lob-one-liners):
  exportation of #+lob and #+call type lines is now correctly handling
  the addition of the indentation information to the info list
2010-06-11 10:16:56 -07:00
Eric Schulte a5712e4b0a babel: can open results which don't start on the first column
* contrib/babel/lisp/org-babel.el (org-babel-open-src-block-result):
  now able to handle results which don't start on the first column
2010-06-11 08:07:19 -07:00
Eric Schulte cc1c446791 babel: ensure positional invariance of the `info' list
* contrib/babel/lisp/org-babel.el (org-babel-get-src-block-info):
  ensure that info always has the same number of arguments in the same
  order
2010-06-10 21:36:57 -07:00
Eric Schulte 9311325030 babel: all org-babel elements should now work when indented
* contrib/babel/lisp/org-babel-lob.el
  (org-babel-lob-one-liner-regexp):
  (org-babel-lob-get-info):
  (org-babel-lob-execute):
  all org-babel elements should now work when indented

* contrib/babel/lisp/org-babel-ref.el
  (org-babel-ref-at-ref-p):
  all org-babel elements should now work when indented

* contrib/babel/lisp/org-babel.el
  (org-babel-set-interpreters):
  (org-babel-execute-src-block):
  (org-babel-expand-src-block):
  (org-babel-get-src-block-info):
  (org-babel-hash-at-point):
  (org-mode-hook):
  (org-babel-parse-src-block-match):
  (org-babel-where-is-src-block-result):
  (org-babel-read-result):
  (org-babel-insert-result):
  (org-babel-result-end):
  all org-babel elements should now work when indented
2010-06-10 14:36:08 -07:00
Eric Schulte a9c4439d5a babel: removed debug line
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-src-blocks):
  removed debug line
2010-06-10 10:16:45 -07:00
Eric Schulte 8021cf9288 babel: undo two troubling unintended tab insertions in previous commit
* contrib/babel/lisp/org-babel.el (org-babel-execute-src-block):
  undo to troubling unintentional tab insertions from the previous
  commit
2010-06-10 10:04:12 -07:00
Eric Schulte 0e9e01c3fd babel: results now indented to the level of the #+results: line
Thanks to Sébastien Vauban for pointing this out -- as well as the
  previous babel commit :)

* contrib/babel/lisp/org-babel.el (org-babel-insert-result):
  results are now indented to the level of any existing #+results
  line.
2010-06-10 10:02:07 -07:00
Eric Schulte 9a3e9ad865 babel: can now find table and result lines which don't start on column 0
* contrib/babel/lisp/org-babel-ref.el (org-babel-ref-resolve-reference):
  now able to recognize #+tblname, #+resname and #+results lines which
  do not start on column 0
2010-06-10 09:45:06 -07:00
Eric Schulte 799c15ffaf babel: adding simple "echo" function to library-of-babel 2010-06-09 21:03:21 -07:00
Eric Schulte 4fb9fa323e babel: fixed bug dealing with ignoring quoted inline code blocks
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-inline-src-blocks):
  fixed bug dealing with ignoring quoted inline code blocks
2010-06-08 16:27:44 -07:00
Eric Schulte 5068f4a5cf babel: don't evaluate inline code located in verbatim or quoted environments
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-inline-src-blocks):
  only evaluate inline source code blocks if they do not appear in a
  verbatim or quoted context

  (org-babel-in-example-or-verbatim): check if the point is currently
  located in a verbatim or quoted context
2010-06-08 16:19:54 -07:00
Eric Schulte 7361f79d4c babel: no longer automatically inserting '='s around inline code results
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-results):
  removing forced verbatim '=' tags from around inline source code
  results, if users want their results displayed in this way they can
  add the '='s easily themselves, but there is no way to remove '='s
  inserted automatically by Org-babel.
2010-06-08 16:06:32 -07:00
Eric Schulte ae234f787b babel: noweb references are now expanded in the pre-export buffer
this is required because in the temporary org-mode file used during
  export code blocks may be removed entirely leading to unresolved
  references

* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-src-blocks):
  expanding noweb references during export now takes place in the
  pre-export buffer

  (org-babel-exp-inline-src-blocks): expanding noweb references during
  export now takes place in the pre-export buffer

  (org-babel-exp-results): ensure that the expanded body is passed
  through to org-babel-execute-src-block
2010-06-08 14:40:50 -07:00
Eric Schulte efbb07fe12 babel: number checking no longer fooled by strings ending in newlines
* contrib/babel/lisp/org-babel.el (org-babel-number-p): number
  checking is no longer fooled by strings ending in single newlines
2010-06-07 17:59:58 -07:00
Eric Schulte ef931fcd3a babel: resolving references outside of the visible portion of narrowed buffers
Thanks to Tom Dye for pointing out the need for this fix

* contrib/babel/lisp/org-babel.el (org-babel-expand-noweb-references):
  now able to find noweb references even outside of the narrowed
  portion of the buffer when the buffer is narrowed

* contrib/babel/lisp/org-babel-ref.el (org-babel-ref-resolve-reference):
  now able to resolve references which are located outside of the
  narrowed portion of the buffer when the buffer is narrowed
2010-06-07 17:38:35 -07:00
Eric Schulte 93ab492464 babel: updating results in place and adding `prepend' and `append' :results options
Thanks to Graham Smith for pointing out the need for in-place
  results updates

* contrib/babel/lisp/org-babel.el (org-babel-merge-params): adding
  append and prepend as exclusive options to the :results header
  argument

  (org-babel-insert-result): now updating results in place, and
  honoring the `prepend' and `append' :results header arguments
2010-06-07 16:50:59 -07:00
Eric Schulte 8d7ab3a4b7 babel: adding :noeval header argument to inhibit execution of code blocks on export
* contrib/babel/lisp/org-babel.el (org-babel-header-arg-names): adding
  :noeval header argument which can be specified to inhibit the
  execution of a source block during export.

* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-do-export):
  adding :noeval header argument which can be specified to inhibit the
  execution of a source block during export.
2010-06-07 14:08:06 -07:00
Eric Schulte ac2e6fefee babel: more careful not to evaluate code blocks without sessions on export
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-do-export): now
  explicitly checking if session is equal to "none" on export
2010-06-07 13:35:28 -07:00
Eric Schulte aa794b50b9 babel: now removing existing results when exporting "code" or "none"
Thanks to Russell Adams for pointing this out

* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-do-export):
  Removing existing results on export.
2010-06-07 13:20:22 -07:00
Eric Schulte 134de59fd7 babel: cleaning up indentation
* contrib/babel/lisp/org-babel.el (org-babel-expand-src-block-maybe):
  Cleaning up indentation

* contrib/babel/lisp/org-babel.el (org-babel-load-in-session-maybe):
  Cleaning up indentation
2010-06-07 13:14:52 -07:00
Eric Schulte 9c02bf4946 babel: more robust newline regexp in `org-babel-comint-with-output'
* contrib/babel/lisp/org-babel-comint.el (org-babel-comint-with-output):
  Placing a more general regexp substitution for matching newlines
  returned by comint.  This new option should definitely cover all
  cases.
2010-06-07 12:58:38 -07:00
Eric Schulte 8318845f6d babel: stashing away text dangling after the process mark in comint buffers
* contrib/babel/lisp/org-babel-comint.el (org-babel-comint-with-output):
  If there is dangling text left after the process mark in a comint
  buffer, it will now be safely stored away during babel execution,
  and then replaced when babel is finished with the buffer.

  This commit also fixes some indentation issues.
2010-06-07 12:25:58 -07:00
Eric Schulte 909f375ba6 babel: fixing indentation in org-babel-ruby.el
* contrib/babel/lisp/langs/org-babel-ruby.el (org-babel-execute:ruby):
  fixing indentation

* contrib/babel/lisp/langs/org-babel-ruby.el (org-babel-ruby-evaluate):
  fixing indentation
2010-06-07 12:13:37 -07:00
Eric Schulte 6e34e75888 babel: small wait on new ruby sessions to allow process to start
* contrib/babel/lisp/langs/org-babel-ruby.el (org-babel-ruby-initiate-session):
   Adding a small wait after stating a new ruby session.  This avoids
   errors with `ansi-color-process-output' not being able to find the
   process mark.
2010-06-07 12:08:43 -07:00
Eric Schulte dc2baab09c babel: protecting restrictions on `org-babel-execute-subtree' 2010-06-07 11:52:04 -07:00
Eric Schulte ee94addaac babel: now strips protective commas from code blocks on tangling 2010-06-07 11:46:11 -07:00
Eric Schulte 4e43e7fea8 babel: adding library-of-babel functions for file I/O
* contrib/babel/lisp/org-babel.el (org-babel-insert-result): Replaced
  call to `org-cycle' with a call to the simpler and more appropriate
  `org-table-align'.

* contrib/babel/library-of-babel.org (Read/Write): adding
  library-of-babel functions for file I/O
2010-06-06 19:56:09 -07:00
Eric Schulte 367d81d9dc babel: all code blocks with sessions are now evaluated on export
* contrib/babel/lisp/org-babel-exp.el (org-babel-exp-do-export):

  This brings babel more inline with Sweave, by ensuring that any code
  block which could change the state in a persistent session is
  executed.  Prior to this change the following org-mode text like would
  not export as expected because the x variable would not be
  initialized.

  ** inline expressions
     :PROPERTIES:
     :session:  *R*
     :END:

  #+begin_src R :exports code :results silent
    x<-5
  #+end_src

  the sum of 1 and 4 is equal to src_R{x}
2010-06-06 19:13:14 -07:00
Nicolas Goaziou 359a86cda4 babel-asymptote: now accepts variables in a variety of types 2010-06-04 09:51:18 -06:00
Eric Schulte 198780f1ff babel: adding some newline padding around tangle code blocks 2010-06-02 14:07:20 -06:00
Eric Schulte c5e3660fa9 babel: tangle works when buffer name and file name differ
Thanks to "w t" from the mailing list for reporting this bug and
  providing reproduction information.
2010-06-02 09:07:23 -06:00
Eric Schulte 47a6c25df3 org-babel-tangle: fixing indentation 2010-06-02 09:07:22 -06:00
Eric Schulte afab7897a5 babel: fixed error resolving references on export
Thanks to Nicolas Goaziou for reporting this problem
2010-06-02 09:07:01 -06:00
Eric Schulte b7e273f25d babel-exp: minor documentation and indentation changes 2010-06-02 09:07:00 -06:00
Eric Schulte 8fac7aa38b Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2010-05-28 08:48:22 -06:00
Eric Schulte ff58dacc7c babel: `org-babel-tangle-w-comments' controls comment insertion in tangled code
* contrib/babel/lisp/org-babel-tangle.el (org-babel-spec-to-string):
  The insertion of automatically generated comments into tangled code
  is now customizable through the `org-babel-tangle-w-comments'
  variable.
2010-05-28 08:48:03 -06:00
Dan Davison e5d8764de6 babel: Declare R-specific header arguments
* babel/lisp/langs/org-babel-R.el
(org-babel-header-arg-names:R):
New variable to contain R-specific header args
2010-05-28 09:53:13 -04:00
Dan Davison 71cd358e21 babel: check properties for language-specific header arguments
* contrib/babel/lisp/org-babel.el
(org-babel-params-from-properties):
Check for language-specific header arguments
(org-babel-parse-src-block-match):
Pass lang parameter when checking properties for header args
(org-babel-parse-inline-src-block-match):
Pass lang parameter when checking properties for header args
2010-05-28 09:50:20 -04:00
Michael Sperber 6fc2ea3b9b Xemacs incompatibilities
Carsten Dominik <carsten.dominik@gmail.com> writes:

> On May 17, 2010, at 4:39 PM, Michael Sperber wrote:
>
>> In particular, fixing the require won't be enough: org-babel-python.el
>> uses `run-python' and interacts with the inferior Python, whereas
>> python-mode.el defines `py-shell'.
>>
>> Should I try to abstract over the differences?
>
> Yes, this would be much appreciated. (I think, Eric or Dan?)

OK, I've attached a patch that makes `org-babel-python' work on XEmacs.
Most of the issues are pure XEmacs issues.  Notes:

- XEmacs doesn't have [[:digit:]] - I hope to rectify this in the
  future, but it seems there's no downside in this particular case to
  replacing by [0-9].
- XEmacs doesn't have `move-end-of-line', but does have `end-of-line'.
  I don't understand the intent of having both of these, but the code
  seems fine with `end-of-line'.
- It seems there are way too few `require's throughout org-babel.  I
  don't know if it's OK to add the ones I needed.
- `org-babel-python-evaluate' looked broken as-is: It doesn't use the
  `body' argument properly, the result is (I think) processed in the
  wrong order and not properly split into lines.  I've fixed all these,
  but a review is probably in order.
2010-05-26 22:45:01 -06:00
Eric Schulte 5d52daab10 babel: org-babel-execute-buffer is no longer flummoxed by hidden subtrees 2010-05-26 19:44:04 -06:00
Eric Schulte 8d78778c89 babel: updated key bindings in refcard
and removed a binding which was shadowing the `keyboard-quit'
2010-05-26 16:55:48 -06:00
Eric Schulte 4f113630f8 org-babel-exp: no longer throws errors on empty bodies 2010-05-25 20:20:13 -06:00
Eric Schulte ceeb4681ef babel: tangled files which include shebang lines are now made executable 2010-05-25 20:01:20 -06:00
Eric Schulte 6151c88f10 babel: replaced `line-number-at-pos' with `count-lines' 2010-05-25 17:31:34 -06:00
Eric Schulte d84699459e babel: xemacs variable compatibility check -- thanks to Volker Zell 2010-05-25 17:29:41 -06:00
Eric Schulte 2139651c0d babel: org-babel-clean-text-properties now checks for valid argument
thanks to Michael Sperber for pointing this out
2010-05-17 17:13:20 -06:00
Eric Schulte 236f209b25 babel: changes to org-babel key bindings 2010-05-17 17:08:32 -06:00
Carsten Dominik 38b4fcc90c XEmacs compatibility 2010-05-14 14:40:44 +02:00
Eric Schulte b7555ae433 babel: new keymap `org-babel-map' and new prefix keys "C-c C-v" 2010-05-12 23:51:41 -06:00
Eric Schulte 98af57cdbd babel: ob-sh.el now respects the :results "scalar" option 2010-05-07 17:18:38 -06:00
Dan Davison 2d1025298e babel: More concise matlab/octave code template
Patch by Christopher Long
2010-05-03 21:45:27 -04:00
Dan Davison 245d98786d babel: matlab: detect end of evaluation under Emacs Link
Currently, this uses the presence of a temporary file to signal that
Matlab Emacs Link evaluation is not yet complete.

Emacs Link support added in collaboration with Christopher Long.
2010-05-03 21:45:01 -04:00
Benjamin Andresen c133dd394e babel: Fix org-babel-screen after expand changes 2010-05-02 21:30:13 -04:00
Dan Davison d2b9343029 babel: Avoid trouble with '%' in matlab/octave output
Patch by Christopher Long
2010-05-02 18:26:22 -04:00
Dan Davison 65a98e3282 babel: fix editing error in org-babel-octave.el 2010-05-02 00:41:53 -04:00
Dan Davison 1a43a5939b Merge branch 'octave-matlab' 2010-04-30 18:26:37 -04:00
Dan Davison a61de7b130 babel: matlab: don't try matlab-shell if using emacs link 2010-04-30 18:23:36 -04:00
Eric Schulte a3cc050a96 babel: `org-babel-get-colnames' no longer requires hline 2010-04-30 13:03:46 -06:00
Dan Davison 6f399c20b6 babel: Allow EmacsLink to be used for matlab session evaluation
To use EmacsLink, the user will need to set
org-babel-matlab-with-emacs-link to a non-nil value, and also arrange
that (matlab-with-emacs-link) evaluates to a non-nil value.
2010-04-30 14:39:31 -04:00
Dan Davison 10a07a644b babel: R: allow forcing of colnames without hline 2010-04-30 14:14:27 -04:00
Dan Davison 7f3e64bfb4 babel: R: output colnames when other languages would 2010-04-30 14:14:13 -04:00
Eric Schulte 6a1f5b2bcb babel: ob-emacs-lisp now wraps body in a progn on execute 2010-04-27 13:55:48 -06:00
Dan Davison 837e898936 babel: Fall back to generic expand function during tangling 2010-04-27 15:02:55 -04:00
Eric Schulte 44bb82d38e babel: `org-babel-ref-resolve-reference' doesn't break paren nesting when resolving indicies 2010-04-24 13:26:34 -06:00
Eric Schulte b8adc74894 babel: ob-emacs-lisp and ob-clojure now only wrap bodies in `let' forms when variables are present 2010-04-24 09:21:14 -06:00
Eric Schulte bc0a6c624d babel: adding :no-expand option to code blocks to inhibit body expansion 2010-04-24 09:08:27 -06:00
Eric Schulte c12e18b6cf babel: org-babel-reassemble-table checks for matching table/name dimensions 2010-04-23 11:54:31 -06:00
Dan Davison b8c4bb27ba babel: Use org-src edit buffer for expanded body preview 2010-04-23 10:10:01 -06:00
Eric Schulte 2f71d79e5e org-babel-c: now using org-babel-read on outline-property parameters 2010-04-23 10:10:00 -06:00
Eric Schulte 9124e9055d fixed bug in org-babel-execute:C 2010-04-23 10:10:00 -06:00
Eric Schulte 59251c8d08 babel: fixed bug in org-babel-execute:gnuplot related to body-expand changes 2010-04-23 10:10:00 -06:00
Dan Davison d0dde7c6d5 babel: flip default values of :hlines header arg 2010-04-23 10:10:00 -06:00
Dan Davison 9fdd058669 org-babel-expand-body:R 2010-04-23 10:10:00 -06:00
Eric Schulte 32c7ae42c3 babel: remove superfluous newlines from tangled C code bodies 2010-04-23 10:10:00 -06:00
Eric Schulte 03f13106fb babel: adding org-babel-expand-body:generic for languages w/o body expansion support 2010-04-23 10:10:00 -06:00
Eric Schulte 626cb079e4 babel: fixed bug in org-babel-expand-body:sass 2010-04-23 10:10:00 -06:00
Dan Davison 7decdec3b2 babel: erase previous contents of preview buffer 2010-04-23 10:10:00 -06:00
Dan Davison 8872454566 org-babel-expand-body:R 2010-04-23 10:10:00 -06:00
Eric Schulte 0917218da5 babel: fixed bug in org-babel-expand-body:python 2010-04-23 10:10:00 -06:00
Eric Schulte 9ff31a5110 babel: bound `org-babel-expand-src-block' to (C-c M-b p) 2010-04-23 10:09:59 -06:00
Eric Schulte 0734bf96ba org-babel-expand-body:sql 2010-04-23 10:09:59 -06:00
Eric Schulte 1fdc012e3d org-babel-expand-body:sh 2010-04-23 10:09:59 -06:00
Eric Schulte e6c979f0d7 org-babel-expand-body:screen 2010-04-23 10:09:59 -06:00
Eric Schulte 35434e1389 org-babel-expand-body:sass 2010-04-23 10:09:59 -06:00
Eric Schulte 394031eb38 org-babel-expand-body:ruby 2010-04-23 10:09:59 -06:00
Eric Schulte 1bcafa5d9f org-babel-expand-body:python 2010-04-23 10:09:59 -06:00
Eric Schulte 598dc1ad67 org-babel-expand-body:perl 2010-04-23 10:09:59 -06:00
Eric Schulte 41663b0ce4 org-babel-expand-body:oz 2010-04-23 10:09:59 -06:00
Eric Schulte 2759b6621d org-babel-expand-body:octave 2010-04-23 10:09:59 -06:00
Eric Schulte 8e9f4eec88 org-babel-expand-body:ocaml 2010-04-23 10:09:58 -06:00
Eric Schulte e07aced178 org-babel-expand-body:matlab 2010-04-23 10:09:58 -06:00
Eric Schulte 7bd0712ac2 org-babel-expand-body:latex 2010-04-23 10:09:58 -06:00
Eric Schulte dd500005ef org-babel-expand-body:haskell 2010-04-23 10:09:58 -06:00