Commit Graph

343 Commits

Author SHA1 Message Date
Gong Qijian 2b96fc9171 ob-core: Fix `org-babel--string-to-number'
* lisp/ob-core.el (org-babel--string-to-number): Fix the regular expression.
* testing/lisp/test-ob.el (test-ob/string-to-number): Test cases.

If people write the data in the form "0001"", it means that he wants to
treat it as a string.

TINYCHANGE

> #+name: TBL
> |   id | name   | age |
> |------|--------|-----|
> | 0001 | Apollo |  16 |
> | 0002 | Bmw    |  16 |
>
> #+BEGIN_SRC emacs-lisp :results value pp :var tbl=TBL
> (mapc 'print tbl)
> #+END_SRC
>
> #+RESULTS:
> : (("0001" "Apollo" 16)
> :  ("0002" "Bmw" 16))

TINYCHANGE
2018-10-13 23:22:05 +02:00
Nicolas Goaziou 1b62a56498 Merge branch 'master' into next 2018-10-06 09:42:04 +02:00
Nicolas Goaziou 5cc69a9ebf Deprecate `org-babel-strip-quotes' in favor of `org-strip-quotes'
* lisp/ob-core.el (org-babel-strip-quotes): Remove function.
* lisp/org-macs.el (org-strip-quotes): New function.
* lisp/org-compat.el (org-babel-strip-quotes): Alias for new function.
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-octave.el (org-babel-octave-evaluate-session): Use new function.
2018-10-06 09:40:33 +02:00
Nicolas Goaziou 26ed66b233 ob: :file and :file-ext no longer imply :results file
* lisp/ob-core.el (org-babel-execute-src-block): ":results file" must
  be specified in order to return a file.
(org-babel-merge-params): :file and :file-ext no longer imply :results
file.
* testing/lisp/test-ob.el (test-ob/indented-cached-org-bracket-link):
(test-ob/result-file-link-type-header-argument):
(test-ob/result-graphics-link-type-header-argument): Update tests.

Deducing the results from some other arguments is not obvious.
Moreover, it prevents users from setting, e.g., :file-ext, in a node
property, as every block would then create a file.

Reported-by: Alex Fenton <alex@pressure.to>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00469.html>
2018-10-06 08:56:05 +02:00
Nicolas Goaziou bfd481be42 ob-core: Remove `org-babel-set-current-result-hash'
* lisp/ob-core.el (org-babel-set-current-result-hash): Remove
  function, unused through the code base.
2018-10-03 18:44:34 +02:00
Nicolas Goaziou 17edaf8c14 "src block" -> "source block" in documentation and comments
* etc/ORG-NEWS (Maxima: new headers ~:prologue~ and ~:epilogue~):
(Texinfo exports inline source blocks as ~@code{}~):
(Default lexical evaluation of emacs-lisp source blocks):
* lisp/ob-clojure.el (org-babel-clojure-default-ns):
* lisp/ob-core.el (org-babel-named-src-block-regexp-for-name):
(org-babel-current-src-block-location):
(org-babel-mark-block):
(org-babel-insert-result):
* lisp/ob-emacs-lisp.el (org-babel-default-header-args:emacs-lisp):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/ob-lob.el (org-babel-lob-ingest):
* lisp/ob-ref.el:
* lisp/org-element.el (org-element-object-restrictions):
(org-element-src-block-parser):
(org-element-inline-src-block-parser):
* lisp/org-lint.el:
(org-lint--checkers):
* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src):
* lisp/org-src.el (org-edit-inline-src-code):
* lisp/org.el (org-ctrl-c-ctrl-c):
(org-in-src-block-p):
(org-fill-element):
* lisp/ox-html.el (org-html--textarea-block):
(org-html-format-code):
* lisp/ox-latex.el (org-latex-minted-options):
(org-latex-custom-lang-environments):
* lisp/ox-md.el:
* lisp/ox-odt.el (org-odt-format-code):
* lisp/ox.el (org-export-collect-listings):
* testing/lisp/test-ob-exp.el (ob-exp/src-block-with-affiliated-keyword):
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation):
  Correct "src block" occurrences when they do not specifically refer
  to the element type `src-block'.
2018-09-20 11:23:49 +02:00
Nicolas Goaziou 318d5bab64 Fix failing test
* lisp/ob-core.el (org-babel-import-elisp-from-file): Refactor code.
  Fix error when `org-table-to-lisp' return value contains `hline'.
2018-08-30 23:48:41 +02:00
Nicolas Goaziou 120f871f41 Small refactoring
* lisp/ob-core.el (org-babel-open-src-block-result): Fix docstring,
  refactor code.
* lisp/org.el (org-open-at-point): Refactor so as to not call
  `org-babel-open-src-block-result' unconditionally.
2018-07-05 13:15:30 +02:00
Nicolas Goaziou 8e54cafeb2 Fix noweb expansion during export
* lisp/ob-core.el (org-babel-sha1-hash): Add optional argument to
  specify context.
(org-babel-execute-src-block): Use new argument.
* lisp/ob-exp.el (org-babel-exp-src-block): Use new argument.
(org-babel-exp-results): Fix context.

Reported-by: Ken Mankoff <mankoff@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00117.html>
2018-06-23 23:04:45 +02:00
Aaron Ecay 4afb7f747b Update declare-function calls for functions that have moved.
In cases where functions have moved from org.el into org-macs.el, it
is often possible to replace declare-function by (require 'org-macs)
2018-05-10 01:04:12 +01:00
Nicolas Goaziou 0dda9bf1c1 Mark `org-get-indentation' as obsolete
* lisp/org-macs.el (org-get-indentation): Move function...
* lisp/org-compat: ... here.
* lisp/ob-core.el (org-babel-demarcate-block):
(org-babel-insert-result):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
* lisp/org-capture.el (org-capture-place-item):
* lisp/org-clock.el (org-clock-in):
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-feed.el (org-feed-format-entry):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-list.el (org-in-item-p):
(org-list-struct):
(org-list-struct-apply-struct):
(org-list-item-body-column):
(org-toggle-item):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-fixup-indentation):
(org-cdlatex-environment-indent):
(org--get-expected-indentation):
(org-indent-region):
(org-toggle-fixed-width):
* lisp/ox.el (org-export-expand-include-keyword): Use
  `current-indentation' instead.
2018-05-09 01:26:31 +02:00
stardiviner b088389c6b ob-core: Add document and test for "graphics" format
* doc/org-manual.org: Document value.

* lisp/ob-core.el (org-babel-common-header-args-w-values): Handle
  symbol "graphics".

* testing/lisp/test-ob.el (test-ob/result-graphics-link-type-header-argument):
  New test.
2018-04-12 15:16:04 +02:00
stardiviner 296b0de4e8 ob-core: Add "link" results format
* lisp/ob-core.el (org-babel-execute-src-block): Handle "link" :results
  format.

* doc/org-manual.org: Add document for new result format "link".

* testing/lisp/test-ob.el (test-ob/result-file-link-type-header-argument):
  New test.
2018-04-12 15:15:59 +02:00
Nicolas Goaziou 003af466c5 ob-core: Fix failing tests.
* lisp/ob-core.el (org-babel-result-to-file): Do not assume current
  buffer is visiting a file.
2018-04-03 00:11:14 +02:00
Nicolas Goaziou bc7b24d0d0 ob-core: Silence byte-compiler 2018-03-13 09:29:50 +01:00
stardiviner 49a8de4ffd
* ob-core.el (org-babel-result-to-file): relative file link result.
Respect option `org-link-file-path-type`.
2018-03-06 14:43:22 +08:00
Nicolas Goaziou b420c8e290 ob-core: Fix last commit
* lisp/ob-core.el (org-babel-execute-src-block): Fix thinko in commit
  122bf2997.
2018-03-05 14:34:28 +01:00
Nicolas Goaziou 122bf29974 ob-core: Tiny refactoring
* lisp/ob-core.el (org-babel-execute-src-block): Tiny refactoring.
  Keep lines under 80 columns.
2018-03-03 10:07:21 +01:00
stardiviner 39bd69b08d
* ob-core.el: (org-babel-execute-src-block) handle :results graphics :file case.
Don't write result to file if result is graphics.
2018-03-02 14:22:52 +08:00
Kyle Meyer 47908228e7 Merge branch 'maint' 2018-02-18 16:33:04 -05:00
Glenn Morris 4ddfc6bd69 Backport commit 66a4e651f from Emacs
; Fix doc typos related to indefinite articles
66a4e651f3cf38c320d1a9d5ae6f88dcc641792b
Glenn Morris
Fri Feb 16 15:16:15 2018 -0500
2018-02-18 16:32:41 -05:00
Nicolas Goaziou 013941de86 `org-save-outline-visibility' preserve outline, blocks and drawers
* lisp/org-macs.el (org-save-outline-visibility): Also preserve blocks
  and drawers visibility.  Re-implement without helper functions.
  (org-outline-overlay-data):
  (org-set-outline-overlay-data): Remove functions.
2018-02-11 11:37:50 +01:00
Nicolas Goaziou e490d2766f Merge branch 'maint' 2018-02-01 15:51:28 +01:00
Nicolas Goaziou b4cc12fc32 ob-core: Fix infloop when filling a region with a source block
* lisp/ob-core.el (org-babel-do-in-edit-buffer): Do not move point.

Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00006.html>
2018-02-01 15:40:51 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Nicolas Goaziou 000b943ebd Re-order visibility functions in "org.el"
* lisp/org-macs.el (org-outline-overlay-data):
(org-set-outline-overlay-data): Moved from "org.el".
* lisp/org.el (org-remove-empty-overlays-at):
(org-show-empty-lines-in-parent):
(org-files-list):
(org-entry-beginning-position):
(org-entry-end-position):
(org-subtree-end-visible-p):
(org-first-headline-recenter):
(org-flag-region):
(org-show-entry):
(org-show-children):
(org-show-subtree):
(org-hide-block-toggle-maybe):
(org-hide-block-toggle):
(org-hide-block-toggle-all):
(org-hide-block-all):
(org-cycle-hide-drawers):
(org-flag-drawer):
(org-previous-block):
(org-next-block): Move functions.
2018-01-13 14:15:53 +01:00
Nicolas Goaziou 4dbb4a76a7 Implement `org-show-all'
* lisp/org.el (org-show-all): New function.
(org-cycle):
(org-cycle-internal-global):
(org-global-cycle):
(org-set-startup-visibility):
(org-set-outline-overlay-data):
(org-hide-block-all):
(org-mode-hook):
(org-tree-to-indirect-buffer):
(org-sort-entries):
(org-mode-map):
(org-org-menu):
* lisp/ob-lilypond.el (org-babel-lilypond-mark-error-line):
* lisp/org-archive.el (org-archive-subtree):
* lisp/org-capture.el (org-capture-place-template):
* lisp/org-mouse.el (org-mouse-popup-global-menu):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/org-test.el (org-test-at-id):
(org-test-in-example-file): Use new function.

* lisp/org-compat.el (org-show-block-all): Mark as obsolete.
2018-01-10 15:58:21 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00
Nicolas Goaziou e9f30779de Merge branch 'maint' 2017-12-31 15:49:55 +01:00
Nicolas Goaziou af58a6dbf7 Change Org-mode into Org mode
* lisp/ob-core.el (org-babel-result-to-file):
* lisp/ob-picolisp.el:
* lisp/org-agenda.el (org-check-for-org-mode):
(org-search-view):
(org-tags-view):
(org-agenda-cleanup-fancy-diary):
(org-agenda-get-day-entries):
* lisp/org-table.el (orgtbl-mode):
* lisp/org-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org.el (org-modules):
(org-startup-options):
(org-fontify-meta-lines-and-blocks):
* mk/default.mk:
* mk/manfull.pl:
* mk/org-fixup.el (org-make-org-version):
(org-make-org-loaddefs):
* mk/orgcard2txt.pl (rep_esc):
* mk/targets.mk ($(info):
* testing/README:
(Example):
* testing/examples/no-heading.org:
* testing/examples/normal.org: Change Org-mode into Org mode
2017-12-31 15:48:09 +01:00
Nicolas Goaziou 4d3e7a2a57 ob-core: All Noweb parameters are read at point of definition
* lisp/ob-core.el (org-babel-params-from-properties): Do not force
  using `org-babel-current-src-block-location'.  Extract properties
  from point.
(org-babel--noweb-reference): Remove function.
(org-babel-expand-noweb-references): Apply function removal.  Small
refactoring.
* lisp/ob-lob.el (org-babel-lob-get-info): Small refactoring.
2017-12-23 15:56:53 +01:00
Nicolas Goaziou 38be851245 ob-core: Do not always evaluate Lisp code in parameters
* lisp/ob-core.el (org-babel-get-src-block-info):
(org-babel-params-from-properties):
(org-babel-parse-header-arguments): Add optional argument disabling
Lisp evaluation in parameters.
2017-12-23 15:45:03 +01:00
Nicolas Goaziou 1e40dd6486 ob-core: Tiny refactoring
* lisp/ob-core.el (org-babel-expand-noweb-references): Tiny
  refactoring.
2017-12-23 14:03:52 +01:00
Nicolas Goaziou 774e553f11 Merge branch 'maint' 2017-12-23 14:03:47 +01:00
Nicolas Goaziou d9125e435f Fix recursive Noweb expansion
* lisp/ob-core.el (org-babel-expand-noweb-references): Recursive Noweb
  expansion obey to :noweb parameter.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add tests.

Fixes: 17523
2017-12-23 13:58:25 +01:00
Nicolas Goaziou 3acc212c8f ob-core: Get :noweb-ref from definition instead of point of call
* lisp/ob-core.el (org-babel-expand-noweb-references): Get :noweb-ref
  from definition instead of point of call.

* testing/lisp/test-ob.el (test-ob/noweb-expansion-1):
(test-ob/noweb-expansion-2): Merge tests.  Add test.
2017-12-20 13:15:08 +01:00
Nicolas Goaziou 291d90c53e ob-core: Correctly find Noweb reference
* lisp/ob-core.el (org-babel--noweb-reference): New function.
(org-babel-expand-noweb-references): Use new function.
2017-12-20 13:01:53 +01:00
Nicolas Goaziou 2646271789 Merge branch 'maint' 2017-12-15 22:26:01 +01:00
Nicolas Goaziou 46124812d2 Fix function declarations
Fixes: 29722
2017-12-15 22:24:44 +01:00
Nicolas Goaziou fc5abc2d55 ob-core: Insert lowercase results
* lisp/ob-core.el (org-babel-insert-result): Insert lower case blocks
  and drawers.

* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-wrap):
(test-ob/org-babel-remove-result--results-org):
(test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
(test-ob/org-babel-remove-result--results-code): Update tests.
2017-12-10 23:05:32 +01:00
Nicolas Goaziou 819b2a1a3d Merge branch 'maint' 2017-11-28 23:59:21 +01:00
Nicolas Goaziou b4b2809eb1 ob-core: Fix `org-babel-src-block-names'
* lisp/ob-core.el (org-babel-src-block-names): Do not change
  visibility or windows when called.
2017-11-28 23:57:18 +01:00
Nicolas Goaziou e92732efd0 Merge branch 'maint' 2017-11-28 23:35:44 +01:00
Nicolas Goaziou ebe9eb2423 ob-core: Fix last commit
* lisp/ob-core.el (org-babel-result-end): Add missing `example-block'
  result type.
2017-11-28 23:35:01 +01:00
Nicolas Goaziou c1d7b2cda3 Merge branch 'maint' 2017-11-27 23:26:38 +01:00
Nicolas Goaziou d7940ae2a7 ob-core: Fix removal of elements after RESULTS
* lisp/ob-core.el (org-babel-result-end): Ignore elements that do not
  correspond to a valid result type (e.g., a headline).

Fixes commit 1d8126385c.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2017-11/msg00384.html>
2017-11-27 23:23:04 +01:00
Nicolas Goaziou be1e807942 Merge branch 'maint' 2017-11-25 21:13:58 +01:00
Nicolas Goaziou 1d8126385c ob-core: Fix results removal without blank line between source and results
* lisp/ob-core.el (org-babel-remove-result): Delete blank lines before
  results.
(org-babel-result-end): Use `org-element-at-point'.
* testing/lisp/test-ob.el (test-ob-verify-result-and-removed-result):
  Remove duplicate.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--no-blank-line):
  New test.
* testing/lisp/test-ob.el (test-ob/results-in-narrowed-buffer): Small
  refactoring.

Reported-by: Ken Mankoff <mankoff@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00338.html>
2017-11-25 21:07:52 +01:00