0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-22 14:10:42 +00:00
Commit graph

153 commits

Author SHA1 Message Date
Eric Schulte 1c3ef40f24 ob: fixed bug in org-babel-read-result
Thanks to Leo Alekseyev for bringing this bug to my attention

* lisp/ob.el (org-babel-open-src-block-result): Must collect result
  *before* jumping to the result buffer.
2011-01-11 10:41:35 -07:00
Eric Schulte ea847dcb5f ob: fix small bug in `org-babel-src-block-names'
* lisp/ob.el (org-babel-src-block-names): Fix bug, wrong match-string
  used after update to regexp.
2011-01-11 10:14:13 -07:00
Eric Schulte e72f207c3e ob: ensure that org-babel-temporary-directory is bound before using
* lisp/ob.el (org-babel-temp-file):  Ensure that
  org-babel-temporary-directory is bound before using.
  (org-babel-remove-temporary-directory):  Safer error throwing.
2011-01-09 17:47:45 -07:00
Eric Schulte 8674006516 ob: Uses org-src-lang-modes to resolve language names for evaluation.
* lisp/ob.el (org-babel-execute-src-block): Uses org-src-lang-modes to
  resolve language names for evaluation.
2011-01-07 11:41:15 -07:00
Eric Schulte 1d3db31ca7 ob: better parsing of list output from scripting languages
* lisp/ob.el (org-babel-script-escape): Replace commas with spaces for
  better list reading when list items are packed with commas,
  e.g. Haskell list output.
2010-12-21 20:18:07 -07:00
Eric Schulte ece347e32c org-babel-confirm-evaluate: better doc and code when using function as
Thanks to Vladimir Alexiev for submitting this patch

* lisp/ob.el (org-babel-confirm-evaluate): Fix for the case when
  org-confirm-babel-evaluate is a function (used to always ask no matter
  what the function returns).
* doc/org.texi (Code evaluation security): Add example for using a
  function.
2010-12-21 09:37:19 -07:00
Eric Schulte 4e146a5ac2 ob: a little more refactoring
* lisp/ob.el (org-babel-execute-src-block): Removed unused flet function.
2010-12-21 14:19:25 +00:00
Dan Davison 366abc6175 ob: Refactoring
* lisp/ob.el (org-babel-format-result): New function to format results
of src block execution.
(org-babel-execute-src-block): Use `org-babel-format-result' when
writing to file.
(org-babel-open-src-block-result): Use `org-babel-format-result' when
displaying results in a buffer; name results buffer differently.
2010-12-21 14:19:24 +00:00
Dan Davison 70349cd0c2 ob: Bug fix in writing results to file
* lisp/ob.el (org-babel-execute-src-block): Avoid calling
`orgtbl-to-generic' on number results
2010-12-21 14:19:24 +00:00
Eric Schulte e0b7927678 ob: :sep specifies table separator when opening or writing tabular results
* lisp/ob.el (org-babel-execute-src-block): Allow specification of
  table separator with :sep header argument.
  (org-babel-open-src-block-result): Allow specification of table
  separator with :sep header argument.
2010-12-21 14:19:24 +00:00
Dan Davison 74d752b4b5 ob: Wipe error buffer before executing buffer/subtree
* lisp/ob.el (org-babel-execute-buffer): Wipe error buffer at outset
of executing buffer (note that this handles execute subtree also).
2010-12-21 11:06:35 +00:00
Dan Davison a871c6a77c new :results behavior 2010-12-20 16:44:24 +00:00
Dan Davison d6fefb406e babel: Interpret string results as file links with :results file
* lisp/ob.el (org-babel-execute-src-block): With :results file, when
:file is not supplied, interpret result as a file link as long as it
is a string.
2010-12-19 14:25:18 +00:00
Eric Schulte f5f2851401 Noweb references can now be resolved from the library of babel.
* lisp/ob.el (org-babel-expand-noweb-references): Noweb references can
  now be resolved from the library of babel.
2010-12-15 10:16:58 -07:00
Eric Schulte e919c97d7e fixed insertion of trailing newline after code block evaluation
* lisp/ob.el (org-babel-result-end): No longer leaving trailing new
  line after block removal.
2010-12-15 09:58:57 -07:00
Achim Gratz 8dfd6a6140 Fixup 95bb16661b
* org.el: remove spurious linebreak introduced by earlier patch
* ob.el, ob-ref.el: remove double fix of the same problem

Achim Gratz <Stromeko@Stromeko.DE> wrote:

> this patch had already been partially applied by Carsten and Eric (in
> slightly a different way than I suggested).  The changes to ob.el and
> ob-ref.el (the require statements) are therefore superfluous and should
> probably be backed out.  There was also a superfluous whitespace change
> in org.el (a closing paren that was broken onto the next line).  Patch
> to this effect is attached.  You've already cleaned up org-agenda.el and
> the conditions in org-macs...
2010-12-12 20:09:28 +01:00
Carsten Dominik 7666ba421f Version number back to 7.4 2010-12-10 18:49:40 +01:00
Carsten Dominik 76a25715c9 Bump version number to 7.5 2010-12-10 18:43:10 +01:00
Dan Davison c6a945e82c babel: Handle errors when temporary directory is on a different partition
* lisp/ob.el (org-babel-remove-temporary-directory): Handle exception
  with message informing of failure to remove directory.

Thanks to Antti Kaihola for the bug report:

http://thread.gmane.org/gmane.emacs.orgmode/34394

From: Antti Kaihola <akaihola <at> gmail.com>
Subject: Can't close Emacs+org-mode if /tmp and /home on different	partitions
Newsgroups: gmane.emacs.orgmode
Date: 2010-12-02 08:33:28 GMT (6 days, 1 hour and 22 minutes ago)
I have /tmp on my root partition and a separate partition for /home.
When trying to close an Emacs session which is using org-mode, I get
this error:

    move-file-to-trash: Non-regular file: Is a directory, /tmp/babel-XXXXXXX

(where XXXXXXX are random characters).

I tracked down the problem to org-babel-remove-temporary-directory
which ob.el adds to kill-emacs-hook. It tries to remove the temporary
directory using delete-directory, which in turn tries to move the
directory (by renaming) into trash, which is in my home directory.

I added this to my ~/.emacs.d/init.el:

   (custom-set-variables '(temporary-file-directory "/home/akaihola/tmp/"))

and closing Emacs works correctly again. However, since my init.el is
part of emacs-starter-kit which I update frequently, I'd prefer not to
modify that file. Unfortunately the customization hook
emacs-starter-kit provides (~/.emacs.d/custom.el) is loaded too late
to affect the temporary directory.

I'm running emacs-snapshot 1:20090909-1 in Ubuntu 10.10. Looks like
this is really an Emacs bug and is already fixed:
http://groups.google.com/group/gnu.emacs.bug/browse_thread/thread/0446b8684a8ef504
2010-12-08 10:11:49 +00:00
Eric Schulte 1ce04c5057 updating Code block evaluation messages
Thanks to Sébastien Vauban for suggesting these changes.

* lisp/ob.el (org-babel-insert-result): More informative code block
  evaluation messages.
2010-12-06 08:04:17 -07:00
Eric Schulte 201eb8ce23 ob: examplization of inserted results is smarter about markers
* lisp/ob.el (org-babel-examplize-region): Check if `end' is a marker
  or a point and handle appropriately.
2010-12-03 07:11:09 -07:00
Eric Schulte a9a77780dc change requirement order to ob-eval is always loaded
* lisp/ob-eval.el (require): No longer require ob.el to allow
  requiring by ob.el.
* lisp/ob.el (ob-eval): Require ob-eval.
2010-12-01 07:19:45 -07:00
Eric Schulte 232651a57e ob: mention code block name when ":eval query"
* lisp/ob.el (org-babel-confirm-evaluate): Show code block's name when
  it is available during evaluation query.
2010-11-30 22:02:02 -07:00
Eric Schulte c4418fc472 ob: fixed insertion of result error
* lisp/ob.el (org-babel-insert-result): Using markers instead of
  points for more robust buffer anchors.
2010-11-30 19:22:34 -07:00
Eric Schulte c3b7eca193 ob: fixed newly introduced empty result error
* lisp/ob.el (org-babel-examplize-region): Remove old assertion which
  no longer applies to the result insertion code.
2010-11-27 17:51:46 -07:00
Eric Schulte 01b4f63fe9 ob: no longer escaping results which will be wrapped in a block.
* lisp/ob.el (org-babel-insert-result): No longer escape results which
  will be wrapped in a block.
2010-11-26 15:48:22 -07:00
Eric Schulte 30b2d604c5 ob: more descriptive "Evaluation Aborted" message
* lisp/ob.el (org-babel-confirm-evaluate): More descriptive message
  when evaluation is aborted or disabled.
2010-11-25 10:28:04 -07:00
Eric Schulte b5f7b02814 "wrap" :results header argument wraps code block results
* lisp/ob.el (org-babel-insert-result): Responds to new "wrap" header
  argument.
  (org-babel-merge-params): Includes new "wrap" header argument in
  one of the results header argument exclusive groups.

* lisp/org.el (org-additional-option-like-keywords): Fontify begin and
  and results lines as comments.
2010-11-24 10:19:44 -07:00
Eric Schulte 950bea36f8 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2010-11-23 09:39:41 -07:00
Eric Schulte d24b04d82f ob: cleaner parsing of header arguments
Thanks to Charles C. Berry for insisting on this issues existence

  This change is now secured with a unit test

* lisp/ob.el (org-babel-parse-header-arguments): Stripping trailing
  spaces off of header arguments (even the first one).
2010-11-23 09:39:26 -07:00
Dan Davison 666e6ed5e7 babel: Wipe error buffer clean at start of execution
* lisp/ob-eval.el (org-babel-error-buffer-name): Define new variable.

  (org-babel-eval-error-notify): Use new variable `org-babel-error-buffer-name'
  (org-babel-eval): Make temp error buffer invisible to the user with
		    initial space in name.
  (org-babel-eval-wipe-error-buffer): New function to wipe the error message buffer.

* lisp/ob-exp.el (org-babel-eval-wipe-error-buffer): Declare external function
  `org-babel-eval-wipe-error-buffer'.
  (org-babel-exp-results): Wipe error buffer clean at outset of execution

* lisp/ob.el (org-babel-execute-src-block-maybe): Wipe error buffer clean at
  outset of execution
  (org-babel-eval-wipe-error-buffer): Declare external function
				    `org-babel-eval-wipe-error-buffer'.
2010-11-23 13:26:31 +00:00
Eric Schulte b174975eb7 ob: safer conversion of results of scripting languages into elisp objects
* lisp/ob-python.el (org-babel-python-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob-ruby.el (org-babel-ruby-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob.el (org-babel-script-escape): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob-haskell.el (org-babel-haskell-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.
2010-11-22 18:51:00 -07:00
Achim Gratz 95bb16661b Fix byte compiler warnings
* org-macs.el (org-called-interactively-p): Wrap function call in
	with-no-warnings.
	(with-silent-modifications) Declare macro for Emacs < 23.2.

TINYCHANGE
2010-11-22 21:22:27 +01:00
Eric Schulte 3785722e92 ob: fix compiler warnings introduced by code-block list reading/writing 2010-11-22 07:21:18 -07:00
Eric Schulte 6baa78b2da ob: no longer adding extra ":" to singleton first header args
* lisp/ob.el (org-babel-parse-header-arguments): Removed addition of
  ":" to singleton first header arguments as it was leading to errors.
2010-11-22 06:44:06 -07:00
Eric Schulte 451acd11ce move ob-map-src-blocks up in ob.el and autoload it
* lisp/ob.el (org-babel-map-src-blocks): Moved to earlier in the file
  and now autoloading.
2010-11-19 01:16:29 -07:00
Eric Schulte e34033fec2 using higher level function for checking list membership
Thanks to Nicolas Goaziou for pointing this out

* lisp/ob-ref.el (org-babel-ref-at-ref-p): Use higher level function
  for testing list membership.
* lisp/ob.el (org-babel-read-result): Use higher level function for
  testing list membership.
  (org-babel-result-end): Use higher level function for testing list
  membership.
2010-11-18 09:34:21 -07:00
Eric Schulte 97f4c3f9a1 fixed (hopefully) error in compiled form of org-babel-map-src-blocks
* lisp/ob.el (org-babel-map-src-blocks): Ensure that the file argument
  is only evaluated once.
2010-11-17 17:03:44 -07:00
Eric Schulte 88947588bc lists are now a data type recognized by code blocks
* lisp/ob-ref.el (org-babel-ref-resolve): Recognize `list' as a unique
  type of data
  (org-babel-ref-at-ref-p): Recognize `list' as a unique type of data

* lisp/ob.el (org-babel-read-result): Recognize `list' as a unique
  type of data
  (org-babel-read-list): A function to read a textual Org-mode list
  into an emacs-lisp list.
  (org-babel-insert-result): Recognizes the "list" result param to
  insert data as an Org-mode list.
  (org-babel-result-end): Find the end of an Org-mode list.
  (org-babel-merge-params): Add "list" as a result param.

* doc/org.texi (results): Documentation of the new "list" results
  header argument.
2010-11-17 16:47:55 -07:00
Eric Schulte c676f62361 passing header arguments through to called code blocks
* lisp/ob-lob.el (org-babel-lob-get-info): including pass-through
  header arguments in results variable header argument string

* lisp/ob.el (org-babel-execute-src-block): working with new header
  argument setup
  (org-babel-parse-header-arguments): only split header argument
  strings when []'s are balanced
2010-11-08 14:18:33 -07:00
Bastien Guerry 6630edbd0f Set version number to 7.3 2010-11-07 14:52:14 +01:00
Dan Davison ed5665e1e2 babel: Use copy-sequence' instead of copy-tree'
* lisp/ob.el: `copy-sequence' suffices to copy alist; no need for
`copy-tree'
2010-10-31 13:22:13 +00:00
Dan Davison d6599c5699 babel: Ensure that result is a file link when that is intended
* lisp/ob.el (org-babel-execute-src-block): If ":results file" is in
effect, then ensure that the value of :file is returned as the result;
don't rely on language files for this.

Examples of languages that were not honouring :file are sh and
emacs-lisp.
2010-10-31 12:55:35 +00:00
Dan Davison cf0cdd7785 babel: Fix data structure corruption when sorting parameters
* lisp/ob.el (org-babel-sha1-hash): Avoid corrupting `info' data
structure by side-effects of `sort'.
2010-10-31 12:51:18 +00:00
Dan Davison 1ee54e0db7 babel: Don't resolve variable references unless requested
* lisp/ob.el (org-babel-initiate-session): Don't resolve variable
  references unless prefix arg is supplied.
2010-10-29 20:44:58 +01:00
Eric Schulte 2152f1ec28 ob-tangle: detangle changes in code files back to the original org files
* lisp/ob-tangle.el (org-babel-update-block-body): declaring function
  for updating code block bodies
  (org-babel-spec-to-string):
  (org-babel-detangle): detangle all tangled and commented code blocks
  in the current file back to org
  (org-babel-tangle-jump-to-org): jump from a tangled and commented
  file back to the originating org-mode code block
ob-tangle: detangle changes in code files back to the original org files

* lisp/ob-tangle.el (org-babel-update-block-body): declaring function
  for updating code block bodies
  (org-babel-spec-to-string):
  (org-babel-detangle): detangle all tangled and commented code blocks
  in the current file back to org
  (org-babel-tangle-jump-to-org): jump from a tangled and commented
  file back to the originating org-mode code block
2010-10-29 02:13:38 -06:00
Carsten Dominik 82af72eef7 Push version number to 7.02trans 2010-10-29 09:11:46 +02:00
Dan Davison 9c1acbc667 babel: Fix regexp parsing of functional-style arguments
* lisp/ob.el (org-babel-get-src-block-info): Retrieve contents of
  parentheses, excluding parentheses themselves
2010-10-27 16:31:34 +01:00
David Maus 095f9e298f Declare to silence byte compiler
* ob.el (org-babel-ref-resolve): Declare to silence byte compiler.
2010-10-24 20:45:26 +02:00
Eric Schulte d87e33ea19 babel: ob-execute-src-block respects prefix argument (which forces re-calculation)
* lisp/ob.el (org-babel-execute-src-block): respects prefix argument
  (which forces re-calculation)
2010-10-21 07:50:32 -06:00