Nicolas Goaziou
93f90c8412
ob-shell: Fix wrong variable assignment binding
...
* lisp/ob-shell.el (org-babel-shell-initialize): Provide bindings to
handle variable assignments for all the supported shells.
(org-babel--variable-assignments:sh-generic):
(org-babel--variable-assignments:bash_array):
(org-babel--variable-assignments:bash_assoc):
(org-babel--variable-assignments:bash): Rename using an internal
naming scheme since they are not meant to be called directly from
"ob-core.el".
(org-babel-variable-assignments:shell): Apply renaming.
Reported-by: David Dynerman <emperordali@block-party.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/111139 >
2017-01-03 18:28:50 +01:00
Aaron Ecay
140aacbf2f
Use ‘eq’ instead of ‘equal’ for symbols
...
* lisp/ob-C.el (org-babel-C-val-to-C-type):
* lisp/ob-core.el (org-babel-get-colnames):
(org-babel-disassemble-tables):
* lisp/ob-lua.el (org-babel-lua-var-to-lua):
(org-babel-lua-table-or-string):
* lisp/ob-python.el (org-babel-python-var-to-python):
(org-babel-python-table-or-string):
* lisp/ob-ruby.el (org-babel-ruby-var-to-ruby):
(org-babel-ruby-table-or-string):
* lisp/ob-shell.el (org-babel-sh-var-to-string):
* lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar):
* lisp/org-agenda.el (org-agenda-prepare-window):
(org-compile-prefix-format):
* lisp/org-bibtex.el (org-bibtex-headline):
* lisp/org-capture.el (org-capture):
* lisp/org-colview.el (org-columns-next-allowed-value):
* lisp/org-mhe.el (org-mhe-store-link):
(org-mhe-get-message-real-folder):
(org-mhe-get-message-folder):
(org-mhe-get-message-num):
(org-mhe-get-header):
(org-mhe-follow-link):
* lisp/org-table.el (org-define-lookup-function):
* lisp/org.el (format-spec):
* lisp/ox-odt.el (org-odt--translate-description-lists):
* lisp/ox-publish.el (org-publish-compare-directory-files):
Use `eq' instead of `equal' when comparing to symbols.
* lisp/org-timer.el (org-timer-set-mode-line):
* lisp/org-capture.el (org-capture-finalize):
Use `cl-case' instead of `(cond ((eq x 'foo) ...) ...)'.
2016-09-25 16:29:06 +01:00
Aaron Ecay
79650ffbbd
Use assq instead of assoc for :keywords
...
* lisp/ob-C.el (org-babel-C-execute):
* lisp/ob-J.el (org-babel-execute:J):
* lisp/ob-R.el (org-babel-edit-prep:R):
(org-babel-expand-body:R):
(org-babel-execute:R):
(org-babel-variable-assignments:R):
(org-babel-R-initiate-session):
* lisp/ob-abc.el (org-babel-execute:abc):
* lisp/ob-asymptote.el (org-babel-execute:asymptote):
* lisp/ob-awk.el (org-babel-execute:awk):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
(org-babel-execute:clojure):
* lisp/ob-core.el (org-babel-expand-body:generic):
(org-babel-load-in-session):
(org-babel-initiate-session):
(org-babel-open-src-block-result):
(org-babel-process-params):
(org-babel-insert-result):
(org-babel-expand-noweb-references):
* lisp/ob-ditaa.el (org-babel-execute:ditaa):
* lisp/ob-dot.el (org-babel-execute:dot):
* lisp/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp):
(org-babel-execute:emacs-lisp):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
(org-babel-exp-do-export):
(org-babel-exp-code):
* lisp/ob-forth.el (org-babel-execute:forth):
* lisp/ob-fortran.el (org-babel-execute:fortran):
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
(org-babel-expand-body:gnuplot):
(org-babel-execute:gnuplot):
* lisp/ob-groovy.el (org-babel-execute:groovy):
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-io.el (org-babel-execute:io):
* lisp/ob-java.el (org-babel-execute:java):
* lisp/ob-js.el (org-babel-execute:js):
* lisp/ob-latex.el (org-babel-execute:latex):
* lisp/ob-ledger.el (org-babel-execute:ledger):
* lisp/ob-lilypond.el (org-babel-lilypond-process-basic):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
(org-babel-execute:lisp):
* lisp/ob-lua.el (org-babel-execute:lua):
* lisp/ob-maxima.el (org-babel-execute:maxima):
* lisp/ob-mscgen.el (org-babel-execute:mscgen):
* lisp/ob-ocaml.el (org-babel-execute:ocaml):
* lisp/ob-octave.el (org-babel-execute:octave):
* lisp/ob-org.el (org-babel-execute:org):
* lisp/ob-perl.el (org-babel-execute:perl):
* lisp/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/ob-plantuml.el (org-babel-execute:plantuml):
* lisp/ob-python.el (org-babel-execute:python):
* lisp/ob-ruby.el (org-babel-execute:ruby):
* lisp/ob-sass.el (org-babel-execute:sass):
* lisp/ob-scala.el (org-babel-execute:scala):
* lisp/ob-scheme.el (org-babel-execute:scheme):
* lisp/ob-screen.el (org-babel-execute:screen):
(org-babel-prep-session:screen):
* lisp/ob-shell.el (org-babel-execute:shell):
(org-babel-variable-assignments:shell):
(org-babel-sh-evaluate):
* lisp/ob-shen.el (org-babel-execute:shen):
* lisp/ob-sql.el (org-babel-execute:sql):
* lisp/ob-sqlite.el (org-babel-execute:sqlite):
* lisp/ob-tangle.el (org-babel-tangle):
(org-babel-tangle-single-block):
* lisp/org-src.el (org-src-associate-babel-session):
* lisp/org.el (org-next-link):
Use `assq' instead of `assoc' with :keyword keys.
2016-09-23 11:20:09 +01:00
Aaron Ecay
6b52bc6a21
Clean up string handling.
...
* lisp/org-compat.el (string-prefix-p, string-suffix-p):
Add compatibility definitions for 24.3.
* lisp/ob-R.el (org-babel-edit-prep:R):
* lisp/ob-core.el (org-babel-demarcate-block):
* lisp/ob-js.el (org-babel-js-read):
* lisp/ob-latex.el (org-babel-execute:latex):
* lisp/ob-ref.el (org-babel-ref-parse):
* lisp/ob-shell.el (org-babel-variable-assignments:shell):
* lisp/org-protocol.el (org-protocol-create):
* lisp/org-table.el (org-table-field-info):
* lisp/org.el (org-get-buffer-for-internal-link):
* lisp/ox-publish.el (org-publish-compare-directory-files):
* lisp/ox-texinfo.el (org-texinfo-template):
Use `string-{suffix,prefix}-p' instead of `string-match(-p)'.
* lisp/ob-python.el (org-babel-python-read-string):
Ditto, also use `substring' rather than `match-string'.
* lisp/org-table.el (org-table-copy-down):
(org-table-insert-hline, org-table-current-field-formula):
(org-table-get-formula): Use `string-match-p' instead of
`string-match'.
2016-08-24 16:05:54 +01:00
Nicolas Goaziou
0dc3811a7a
ob-shell: Silence byte-compiler
2016-07-23 11:49:28 +02:00
Nicolas Goaziou
250304bd2e
ob-shell: Make `org-babel-shell-initalize' a command
...
* lisp/ob-shell.el (org-babel-shell-initialize): Add `interactive.
2016-07-23 10:47:01 +02:00
Nicolas Goaziou
0f7df32711
ob-shell: Use cl-lib
2016-07-23 10:41:17 +02:00
Nicolas Goaziou
609c3b3c14
ob-shell: Improve `org-babel-shell-name' customization
...
* lisp/ob-shell.el (org-babel-shell-initialize): New function
(org-babel-shell-names): Properly update execute functions whenever the
variable is modified outside the Customize interface.
2016-07-23 10:34:37 +02:00
Nicolas Goaziou
4f63cfabb3
Deprecate `org-babel-trim' in favor of `org-trim'
...
* lisp/org.el (org-trim): Add optional argument.
* contrib/lisp/ob-mathematica.el (org-babel-execute:mathematica):
* contrib/lisp/org-bibtex-extras.el (obe-html-export-citations):
* contrib/lisp/org-mime.el (org-mime-compose):
* lisp/ob-C.el (org-babel-C-execute):
* lisp/ob-calc.el (org-babel-execute:calc):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
* lisp/ob-core.el (org-babel-initiate-session):
(org-babel-parse-multiple-vars):
(org-babel-read-element):
(org-babel-insert-result):
(org-babel-expand-noweb-references):
(org-babel-trim): Mark obsolete.
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-fortran.el (org-babel-execute:fortran):
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-latex.el (org-babel-expand-body:latex):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
* lisp/ob-ocaml.el (org-babel-execute:ocaml):
* lisp/ob-octave.el (org-babel-octave-evaluate-session):
* lisp/ob-python.el (org-babel-python-evaluate-external-process):
(org-babel-python-evaluate-session):
* lisp/ob-ref.el (org-babel-ref-split-args):
* lisp/ob-ruby.el (org-babel-ruby-evaluate):
* lisp/ob-shell.el (org-babel-sh-evaluate):
* lisp/ob-table.el (org-sbe):
* lisp/ob-tangle.el (org-babel-spec-to-string):
* lisp/org-bibtex.el (org-bibtex-get):
* testing/lisp/test-ob.el (test-ob/parse-header-args): Use `org-trim'
instead of `org-babel-trim'.
2016-06-21 15:33:00 +02:00
Nicolas Goaziou
f8eb0b30ea
ob-shell: Fix "wrong type sequencep: function" error
...
* lisp/ob-shell.el (org-babel-shell-names): Fix error introduced when
switching to lexical binding.
2016-06-20 22:12:02 +02:00
Nicolas Goaziou
2108f0c23a
ob-shell: Use lexical binding
...
* lisp/ob-shell.el (org-babel-sh-initiate-session): Silence
byte-compiler.
2016-06-20 14:58:32 +02:00
Kyle Meyer
4925d5be7b
Merge branch 'maint'
2016-05-15 19:00:30 -04:00
Kyle Meyer
19cf68da90
Fix remaining declare-function issues
...
* lisp/ob-shell.el (org-babel-comint-in-buffer):
(org-babel-comint-with-output):
* lisp/org-table.el (org-export-create-backend):
* lisp/org.el (org-babel-do-in-edit-buffer): Indicate that FN is not a
defun.
* lisp/ob-tangle.el (org-string-nw-p):
* lisp/org-table.el (org-export-create-backend):
(org-export-data-with-backend):
(org-export-filter-apply-functions):
(org-export-first-sibling-p):
(org-export-get-backend):
(org-export-get-environment):
(org-export-install-filters):
(org-export-table-has-special-column-p):
(org-export-table-row-is-special-p): Correct source file name.
* lisp/ob-R.el (ess-wait-for-process):
* lisp/org-clock.el (calendar-iso-to-absolute):
* lisp/org-list.el (org-previous-line-empty-p):
* lisp/org-pcomplete.el (org-entry-properties):
* lisp/org-table.el (org-export-data-with-backend):
(org-export-get-environment):
* lisp/org.el (org-element-interpret-data): Correct argument list.
2016-05-15 18:59:20 -04:00
Kyle Meyer
6345de2d05
Merge branch 'maint'
2016-01-09 17:43:27 -05:00
Kyle Meyer
6bc48c5f41
Update copyright years
2016-01-09 17:12:03 -05:00
Aaron Ecay
0d000f5680
babel: small change in API.
...
* lisp/ob-core.el (org-babel--get-vars): New function.
(org-babel-get-header): Delete.
* lisp/ob-C.el (org-babel-C-expand-C):
(org-babel-C-expand-D):
* lisp/ob-R.el (org-babel-variable-assignments:R):
* lisp/ob-abc.el (org-babel-expand-body:abc):
* lisp/ob-asymptote.el (org-babel-variable-assignments:asymptote):
* lisp/ob-awk.el (org-babel-execute:awk):
* lisp/ob-calc.el (org-babel-execute:calc):
* lisp/ob-clojure.el (org-babel-expand-body:clojure):
* lisp/ob-dot.el (org-babel-expand-body:dot):
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp):
* lisp/ob-fortran.el (org-babel-expand-body:fortran):
(org-babel-fortran-ensure-main-wrap):
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
* lisp/ob-haskell.el (org-babel-variable-assignments:haskell):
* lisp/ob-js.el (org-babel-variable-assignments:js):
* lisp/ob-latex.el (org-babel-expand-body:latex):
* lisp/ob-lilypond.el (org-babel-expand-body:lilypond):
* lisp/ob-lisp.el (org-babel-expand-body:lisp):
* lisp/ob-maxima.el (org-babel-maxima-expand):
* lisp/ob-ocaml.el (org-babel-variable-assignments:ocaml):
* lisp/ob-octave.el (org-babel-variable-assignments:octave):
* lisp/ob-org.el (org-babel-expand-body:org):
* lisp/ob-perl.el (org-babel-variable-assignments:perl):
* lisp/ob-picolisp.el (org-babel-expand-body:picolisp):
* lisp/ob-processing.el (org-babel-variable-assignments:processing):
* lisp/ob-python.el (org-babel-variable-assignments:python):
* lisp/ob-ruby.el (org-babel-variable-assignments:ruby):
* lisp/ob-scheme.el (org-babel-expand-body:scheme):
* lisp/ob-shell.el (org-babel-variable-assignments:shell):
* lisp/ob-shen.el (org-babel-expand-body:shen):
* lisp/ob-sql.el (org-babel-expand-body:sql):
* lisp/ob-sqlite.el (org-babel-expand-body:sqlite): Adapt to change.
* etc/ORG-NEWS: Document change.
2015-10-29 19:26:11 +00:00
Kyle Meyer
0839dc4322
Protect remaining apostrophes in docstrings
...
Protect apostrophes not covered by the last backport. Convert
expressions like '(...) to \\='(...) and symbols written as 'name to
`name'. (In addition to ensuring the correct display, the latter also
improves consistency with many Org docstrings.)
If these aren't protected, Emacs 25 may display them as curved quotes in
the help buffer, depending on the value of text-quoting-style.
2015-09-21 18:38:39 -04:00
Kyle Meyer
8d2c6af7ed
Update remaining copyright years in lisp/
2015-08-10 02:17:52 -04:00
Nicolas Goaziou
048f0e1a82
ob-shell: Add missing "sh" to "shell" conversions
...
* lisp/ob-shell.el (org-babel-default-header-args:shell): Renamed from
`org-babel-default-header-args:sh'.
(org-babel-variable-assignments:shell): Renamed from
`org-babel-variable-assignments:sh'.
(org-babel-prep-session:shell): Renamed from
`org-babel-prep-session:sh'. Apply renaming.
(org-babel-load-session:shell): Renamed from
`org-babel-load-session:sh'. Apply renaming.
(org-babel-execute:shell): Apply renaming.
Reported-by: Sebastien Vauban
<http://permalink.gmane.org/gmane.emacs.orgmode/98859 >
2015-07-03 16:17:11 +02:00
Nicolas Goaziou
9290395405
Silence byte-compiler
...
* lisp/ob-shell.el (org-babel-sh-evaluate):
* lisp/org-clock.el (org-x11idle-exists-p): Do not use last
`call-process-shell-command' arg.
* lisp/org-mouse.el (org-mouse-show-context-menu): Ignore
`redisplay-dont-pause'.
* lisp/org.el (org-icompleting-read): Fix typo. Small refactoring.
2015-04-22 09:51:52 +02:00
Aaron Ecay
c4f34a69b5
babel: Remove functions which are never called.
...
* lisp/ob-awk.el (org-babel-awk-table-or-string):
* lisp/ob-shell.el (org-babel-sh-table-or-results): Remove.
2015-01-23 14:36:40 -05:00
Achim Gratz
c478b57d4e
Merge branch 'maint'
2014-09-19 11:53:46 +02:00
Achim Gratz
7d8523d9d1
ob-shell: compatibility fix for "Marker does not point anywhere" errors in Emacs 23
...
* lisp/ob-shell.el (org-babel-sh-initiate-session): After initiating a
session, initialize the marker `comint-last-output-start' since it
is going to be used by the ANSI color filter without further checks
in Emacs 23 and throws an error.
2014-09-19 11:34:09 +02:00
Achim Gratz
6d15cd3b89
ob-shell: honor the specified shell for :session
...
* lisp/ob-shell.el: Remove defcustom `org-babel-sh-command' and
replace with `shell-file-name' throughout.
(org-babel-variable-assignments:sh): Make check for bash work in more
cases.
The original code and the patched version rely on the shell being
available via PATH. Instead the shell name should be mapped to the
appropriate executable via an alist and invoked via an absolute
filename. For security reasons the permissible shells should probably
be taken from /etc/shells or equivalent by default. Instead of
checking for bash, the same or another alist could provide the
information of whether or not the shell supports arrays (which indeed
were introduced by ksh originally).
2014-06-23 20:53:22 +02:00
Achim Gratz
2685f31a50
ob-shell: stratify shell variable quoting
...
* lisp/ob-shell.el: Remove unused defcustom
`org-babel-sh-var-quote-fmt'.
(org-babel-variable-assignments:bash_array):
(org-babel-variable-assignments:bash_assoc): Remove superfluous
`mapcar' and double quotes around parameters.
(org-babel-sh-var-to-sh): Single-quote the whole string and escape
all single quotes in the original string.
2014-06-23 20:53:16 +02:00
Eric Schulte
a7189aafc3
whitespace, indentation and a function renaming
...
* lisp/ob-shell.el (org-babel-variable-assignments:sh-generic):
Whitespace and renaming to be shell specific.
(org-babel-variable-assignments:bash_array): Whitespace.
(org-babel-variable-assignments:bash_assoc): Whitespace.
(org-babel-sh-var-to-sh): Whitespace.
2014-04-14 21:30:32 -06:00
Pascal Fleury
3c7e75ab0b
ob-shell.el: export vars as arrays for 'sh' code blocks
...
* lisp/ob-shell.el: added support to serialize vars as arrays or associative arrays as appropriate if it is using bash.
* testing/examples/ob-shell-test.org: a file containing a few code blocks both illustrating the use of arrays as well as serving as test for the new export functionality.
* testing/lisp/test-ob-shell.el: added a few unit tests that verify that this new logic only triggers for bash and no other shell at this time.
When variables are defined in a 'sh' code block, they are exported as strings. when the variable itself is an array or a table, then we simply get a shell variable that contains the list of all values in a non-structured form.
When calling the code block with bash, however, it will now export the list as an array, the table as an associative array. A scalar is exported the same way as before.
Signed-off-by: Pascal Fleury <fleury@google.com>
2014-04-14 21:24:00 -06:00
Achim Gratz
539b89451c
ob-sh: add :hlines processing and :hline-string header arg
...
* lisp/ob-sh.el (org-babel-variable-assignments:sh): Check for
":hlines yes" and use header arg :hlines-string if
defined (default to "hline") and add this to the call of
`org-babel-sh-var-to-sh'.
(org-babel-sh-var-to-sh, org-babel-sh-var-to-string): Add additional
optional string argument `hline' and use it for the :hline parameter
in the call to `orgtbl-to-generic'.
2014-03-25 19:25:58 +01:00
Eric Schulte
b896bd43ad
add :cmdline support to shell code blocks
...
* lisp/ob-shell.el (org-babel-execute:shell): Pass the cmdline header
argument to `org-babel-sh-evaluate'.
(org-babel-sh-evaluate): Pass the cmdline header argument to
`call-process-shell-command'.
2014-02-09 20:13:39 -07:00
Bastien Guerry
f8e1745440
Merge branch 'maint'
...
Conflicts:
contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry
c41f5075ac
Merge branch 'maint'
...
Conflicts:
contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry
096ff7e078
Merge branch 'maint'
...
Conflicts:
contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Eric Schulte
fb09863fbb
more shell names
2013-12-13 16:04:41 -07:00
Eric Schulte
3b3dbca13c
finish rename (split up for git)
2013-12-13 09:54:48 -07:00
Eric Schulte
583e7ab175
rename ob-sh to ob-shell
2013-12-13 09:54:28 -07:00