Commit graph

179 commits

Author SHA1 Message Date
Nicolas Goaziou bd68169b4b org-list: reorder file, rename functions, improve comments
* lisp/ob.el (org-babel-result-end): apply renaming.
* lisp/org-exp.el (org-export-mark-list-properties): apply renaming.
* lisp/org-list.el (org-list-prevs-alist): renamed from
  org-list-struct-prev-alist.
(org-list-parents-alist): renamed from org-list-struct-parent-alist.
(org-list-write-struct): renamed from org-list-struct-fix-struct.
(org-list-parse-list, org-sort-list, org-list-indent-item-generic,
org-toggle-checkbox, org-update-checkbox-count, org-cycle-list-bullet,
org-list-repair, org-insert-item, org-move-item-up, org-move-item-up,
org-move-item-down, org-next-item, org-previous-item,
org-end-of-item-list, org-beginning-of-item-list, org-apply-on-list):
apply renaming.
(org-get-bullet): removed function, as it is not needed anymore.
2011-02-18 12:45:11 +01:00
Nicolas Goaziou b219690f05 ob: compute correct end position when results are a list
* lisp/ob.el (org-babel-result-end): end position is end of current
  sublist instead of bottom point, as results might be inserted in a
  list themselves.
2011-02-18 12:45:10 +01:00
Nicolas Goaziou 2adbcfffe1 Remove uses of deprecated top-point and bottom-point functions
* lisp/org.el (org-skip-over-state-notes,org-store-log-note): use new
  accessors.

* list/ob.el (org-babel-result-end): use new accessors.

* list/org-exp.el (org-export-mark-list-ending): use new accessors.
2011-02-18 12:45:08 +01:00
Eric Schulte e9cba96b0a ob: fix indentation bug when inserting results from inline code blocks
* lisp/ob.el (org-babel-insert-result): Don't choke if indent is not a number.
2011-02-14 23:51:40 -07:00
Dan Davison 1d1368e142 ob: Maintain in-context text properties when listing search hits in minibuffer
* lisp/ob.el (org-babel-src-block-names): Don't strip text properties from search hits
(org-babel-result-names): Don't strip text properties from search hits
2011-02-13 11:13:32 +00:00
Dan Davison a8f2163d76 ob: `substring' comparison instead of regexp matching
* lisp/ob.el (org-babel-script-escape): Use `substring' comparison
instead of regexp matching

Workaround for regexp limitation, e.g.

(string-match
 "^\\[.+\\]$"
 (concat
  "["
  (mapconcat (lambda (i) "x") (number-sequence 1 33500) "")
  "]"))

gives "Stack overflow in regexp matcher" in several current builds.
2011-02-13 11:03:58 +00:00
Dan Davison 934e6b0510 ob: Allow ":header-arg-name" as matching property name.
* lisp/ob.el (org-babel-params-from-properties): Test for
"header-arg-name" and ":header-arg-name", in that order.
2011-02-12 18:26:10 +00:00
Bastien Guerry 03c33d0d38 Don't wrap org-entry-get into condition-case.
* ob.el (org-babel-params-from-properties): don't wrap
org-entry-get into condition-case.

* org-table.el (org-table-export): don't wrap org-entry-get
into condition-case.

* org.el (org-store-link): don't wrap org-entry-get into
condition-case.
2011-02-12 19:02:52 +01:00
Dan Davison 775d962788 ob: Fix bug in using #+babel properties in fresh buffer
* lisp/ob.el (org-babel-params-from-buffer): Return desired value
rather than nil from failed re search.
2011-02-12 15:29:07 +00:00
Eric Schulte 7b720d28a6 ob: adding no-expand to list of header argument names
* lisp/ob.el (org-babel-header-arg-names): no-expand is now part of
  the default header argument names list.
2011-02-10 09:34:46 -07:00
Eric Schulte 496ea6c527 ob: changing the default header args for inline code blocks 2011-02-04 13:28:51 -07:00
Dan Davison bbb28d5bf8 Get rid of extra help message when editing src code
* lisp/org-src.el (org-edit-src-persistent-message): Change docstring.
(org-edit-src-code): Get rid of help message in echo area.
* lisp/ob.el (org-babel-do-in-edit-buffer): Do not pass 'quietly
argument to org-edit-src-code as this has been removed
2011-02-01 11:44:32 +00:00
Dan Davison 9511f9e153 ob: Allow src block to be executed with point on #+header line
* lisp/ob.el (org-babel-where-is-src-block-head): Detect src block if
point is on a #+header line.
2011-01-31 15:38:49 +00:00
Dan Davison 4a2ed86f6d ob: Don't allow #+header lines to prevent block finding
* lisp/ob.el (org-babel-where-is-src-block-head): Skip over
intervening #+header lines when searching for block associated with
block name line.
2011-01-30 13:07:11 +00:00
Eric Schulte ba0f6d765f ob: safer insertion of results into a list
* lisp/ob.el (org-babel-result-end): Replace call to org-in-item-p to
  the more specific org-at-item-p.
2011-01-29 08:40:57 -07:00
Eric Schulte d0ca215105 ob: simplified code block exportation -- same process for inline and regular blocks
* lisp/ob-exp.el (org-babel-exp-inline-src-blocks): Simplified
  exportation of inline code blocks using normal code block execution
  mechanism to insert results.
  (org-babel-exp-results): Results exportation mechanism is unified
  for both inline and regular code blocks.
* lisp/ob.el (org-babel-where-is-src-block-result): Returns the point
  after an inline code block for inline code blocks.
2011-01-27 12:48:45 -07:00
Eric Schulte 8cca4424a4 ob: better insertion of inline code block results
* lisp/ob.el (org-babel-insert-result): Special handling of the
  position of results of inline code blocks.
  (org-babel-examplize-region): Now able to comment inline regions.
2011-01-27 11:31:47 -07:00
Eric Schulte 39c982eb49 ob: ob-exec-buf and ob-exec-tree now eval inline code blocks as well
* lisp/ob.el (org-babel-map-inline-src-blocks): Macro for executing
  code in each inline code block.
  (org-babel-execute-buffer): Executes inline code blocks as well as
  regular code blocks.
2011-01-25 10:15:47 -07:00
Eric Schulte db0e815a4c ob: fixed issue with ":results replace org"
* lisp/ob.el (org-babel-result-end): Now recognizes "#+begin_org"
  blocks for removal.
2011-01-25 09:15:06 -07:00
Dan Davison 8d00354704 ob: more permissive regexp match for inline src blocks
* lisp/ob.el (org-babel-inline-src-block-regexp): Character preceding
"src_" can now be anything as long as it is neither alphanumeric nor
'-'.
2011-01-21 17:47:51 +00:00
Dan Davison dcfeec887a docstring edits
* lisp/ob.el (org-babel-merge-params): docstring typo
2011-01-20 17:20:19 +00:00
Dan Davison 05ef2ae7cc ob: Allow babel settings to be made in multiple #+babel: lines
* lisp/ob.el (org-babel-params-from-buffer): Process all #+babel:
lines in the buffer
2011-01-20 17:20:18 +00:00
Dan Davison 624141cc68 ob: Make #+header lines override higher-level settings
* lisp/ob.el (org-babel-get-src-block-info): Alter order of merge arguments
2011-01-20 17:20:18 +00:00
Eric Schulte 3d4b884cb3 ob: Ensure all portions of results wrappers end in newlines
* lisp/ob.el (org-babel-insert-result): Ensure all parts of result
  wrappers end in newlines.
2011-01-20 09:30:28 -07:00
Eric Schulte eb3bf55d48 ob: new ":comments noweb" option for wrapping noweb references in comment links
* lisp/ob-tangle.el (org-babel-spec-to-string): Adding "noweb" as a
  linking comment type
  (org-babel-tangle-comment-links): Returns comment links for the
  source code block at point

* lisp/ob.el (org-babel-expand-noweb-references): When :comments is
  set to "noweb" then wrap noweb references in comment links.
2011-01-16 08:21:16 -07:00
Eric Schulte 47537dcda8 ob: allow detangling of text containing '\'s -- Thanks to Seth Burleigh
* lisp/ob.el (org-babel-update-block-body): Literal argument to
  `replace-match' to allow insertion of text containing '\'.
2011-01-13 10:00:39 -07:00
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