Commit Graph

164 Commits

Author SHA1 Message Date
Nicolas Goaziou a03175d6d9 ob-tangle: Silence byte-compiler 2016-01-02 17:40:22 +01:00
Nicolas Goaziou 59f00529d4 Update copyright years 2016-01-02 17:06:30 +01:00
Nicolas Goaziou e2ac979d9e ob-tangle: Fix commented links
* lisp/ob-tangle.el (org-babel-spec-to-string):
(org-babel-tangle-collect-blocks): Fix numbering and relative path of
commented links.

* testing/lisp/test-ob-tangle.el (ob-tangle/comment-links-numbering):
  New test.

Reported-by: Tobias Müller <mllertobias@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/103861>
2016-01-02 17:05:00 +01:00
Kyle Meyer 2c349cc65a ob-tangle: Check that publishing directory exists
* lisp/ob-tangle.el (org-babel-tangle-publish): Create publishing
  directory if it doesn't exist.

Reported-by: Arun Isaac <theroarofthedragon@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/101697>
2015-10-03 18:08:52 -04:00
Kyle Meyer 36233d976d ob-tangle: Expand paths for publishing
* lisp/ob-tangle.el (org-babel-tangle-file): Return expanded file name.

Reported-by:  Arun Isaac <theroarofthedragon@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/101290>
2015-10-02 23:19:57 -04:00
Paul Eggert c86a10b0bc Backport commit 284c470 from Emacs master branch
Backslash cleanup in Elisp source files
284c470ef752967fcd8bae6a450dc138462b1e49
Paul Eggert
Thu Sep 17 16:09:39 2015 -0700
2015-09-21 18:38:39 -04:00
Nicolas Goaziou 62dc515ae5 ob-tangle: Fix commenting links at column 0
* lisp/ob-tangle.el (org-babel-spec-to-string): Ignore invisible
  characters when commenting in destination file.

* testing/lisp/test-ob-tangle.el (ob-tangle/comment-links-at-left-margin):
New test.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/101002>
2015-09-10 11:12:20 +02:00
Kyle Meyer 85e0c1ce75 Fix tangling in indirect buffers
* lisp/ob-tangle.el (org-babel-tangle-single-block): Get file name from
  base buffer.
(org-babel-tangle): Use file name from attribute list returned by
org-babel-tangle-single-block.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/100845>
2015-09-09 09:54:18 -04:00
Paul Eggert ecf3a4af2c Backport remaining changes from commit 7e09ef0
Add changes from Emacs repo that should have been backported with
bb77dd2.

Update copyright year to 2015
7e09ef09a479731d01b1ca46e94ddadd73ac98e3
Paul Eggert
Thu Jan 1 14:26:41 2015 -0800
2015-08-10 02:17:19 -04:00
Nicolas Goaziou 626caa4e9e ob-tangle: Silence byte-compiler 2015-06-16 00:09:20 +02:00
Nicolas Goaziou 90df55ea7b ob-tangle: Small refactoring
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Refactor.
2015-06-15 21:38:14 +02:00
Eric Schulte a3745c375b tangle option to not post-process tangle comments
* lisp/ob-tangle.el (org-babel-tangle-comment-format-beg): Mention the
  new `org-babel-tangle-uncomment-comments' variable in the
  documentation.
  (org-babel-tangle-comment-format-end): Mention the new
  `org-babel-tangle-uncomment-comments' variable in the documentation.
  (org-babel-tangle-uncomment-comments): New customization variable to
  inhibit the post-processing of tangle comments.
  (org-babel-spec-to-string): Post-processing of tangle comments is
  now dependent upon a customization variable.
2014-06-07 11:29:03 -04:00
Achim Gratz e8e8f6738a Merge branch 'maint' 2014-05-03 10:15:42 +02:00
Achim Gratz 063c8b03b7 ob-tangle: do not run make-directory with nil argument
* lisp/ob-tangle.el (org-babel-tangle): When `file-name-directory'
  returns nil, do not run make-directory.  Remove superfluous when
  clauses by using short-circuiting `and' instead.

Thanks to R. Michael Weylandt for reporting the problem and offering a
patch.

http://permalink.gmane.org/gmane.emacs.orgmode/85749
http://permalink.gmane.org/gmane.emacs.orgmode/85774
2014-05-03 10:12:10 +02:00
Bastien Guerry 6175be9487 Revert "ob-tangle.el (org-babel-spec-to-string): Don't use `org-babel-trim"
This reverts commit a13e133f5a.
2014-04-19 14:54:48 +02:00
Bastien Guerry a13e133f5a ob-tangle.el (org-babel-spec-to-string): Don't use `org-babel-trim
* ob-tangle.el (org-babel-spec-to-string): Don't use
`org-babel-trim'.
2014-04-18 14:49:21 +02:00
Nicolas Goaziou ad16ef42da Silence byte-compiler 2014-03-24 21:07:43 +01:00
Nicolas Goaziou 6d1d61f667 Rename `org-babel-under-commented-heading-p'
* lisp/org.el (org-in-commented-heading-p): New function.
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Remove
  function.
(org-babel-tangle-collect-blocks): Use new function.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Use new function.

* testing/lisp/test-org.el (test-org/in-commented-heading-p): New
  test.
2014-03-24 13:29:42 -04:00
Nicolas Goaziou 7ae45b5331 ob-tangle: Fix `org-babel-under-commented-heading-p'
* lisp/ob-tangle.el (org-babel-under-commented-heading-p):
  `org-comment-string' is case sensitive and cannot be attached to
  other text.
2014-03-15 19:40:08 -06:00
Nicolas Richard ec33c0cf9e lisp/ob-tangle.el: "elisp" should get tangled to ".el" files.
TINYCHANGE
2014-03-06 14:58:12 -07:00
Bastien Guerry 23fa320af8 ob-tangle.el: Fix compiler warning 2014-01-31 09:43:46 +01:00
Bastien Guerry 9368d317fb ob-tangle.el (org-babel-under-commented-heading-p): Throw nil when called before the first heading
* ob-tangle.el (org-babel-under-commented-heading-p): Throw
nil when called before the first heading.

Thanks to John Kitchin for reporting this.
2014-01-30 00:57:24 +01:00
Bastien Guerry f8e1745440 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry 7d9a883b50 Update copyright years again.
Hint: copyright years are all updated in Emacs.
2014-01-07 14:18:17 +01:00
Bastien Guerry c41f5075ac Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry 0beda99171 Revert "Update copyright years."
This reverts commit 21105594fc.
2014-01-05 06:28:07 +01:00
Bastien Guerry 096ff7e078 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Bastien Guerry 21105594fc Update copyright years. 2014-01-04 18:56:11 +01:00
Eric Schulte 39070b7fc7 sometimes remove common indentation when trimming
* lisp/ob-C.el (org-babel-C-execute): Remove common indentation when
  trimming.

* lisp/ob-core.el (org-babel-read-result): Remove common indentation
  when trimming.
  (org-babel-update-block-body): Remove common indentation when
  trimming.

* lisp/ob-fortran.el (org-babel-execute:fortran): Remove common
  indentation when trimming.

* lisp/ob-tangle.el (org-babel-process-comment-text): Better default
  to process tangled comments.
2013-11-23 15:57:29 -07:00
Achim Gratz 54a64f50b5 ob-C, ob-clojure, ob-tangle, org-agenda, org, ox: fix byte-compiler warnings
* lisp/ob-C.el, lisp/ob-clojure.e: Require 'cl at compile-time.
* lisp/ob-tangle.el: Do not require 'cl at compile time.
* lisp/org-agenda.el: Declare function `org-columns-remove-overlays´.
* lisp/org.el: Declare functions `org-clocktable-shift´,
  `org-clock-update-time-maybe´, `org-clock-remove-overlays´,
  `org-babel-tangle-file´, `org-table-blank-field´,
  `org-table-insert-row´, `org-add-archive-files´, `org-table-begin´,
  `org-table-end´.  Move defsubst `org-uniquify´ before its many uses.
* lisp/ox.el: Move defsubst `org-export-get-parent´ before its many
  uses.
2013-11-15 20:18:58 +01:00
Bastien Guerry 71884cc039 Merge branch 'maint'
Conflicts:
	lisp/ob-C.el
	lisp/ob-clojure.el
	lisp/ob-core.el
	lisp/ob-lisp.el
	lisp/org-clock.el
2013-11-12 21:00:49 +01:00
Bastien Guerry f95641c443 Backport changes from Emacs revs 115081 and 115082
2013-11-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	Address some byte-compiler warnings.
	* ob-abc.el (org-babel-expand-body:abc): Use dolist.
	(org-babel-execute:abc): Fix regexp quoting.
	* ob-calc.el (org--var-syms): Rename from `var-syms'.
	* ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding.
	* ob-table.el (sbe): Move debug declaration.
	* org-clock.el (org--msg-extra): Rename from `msg-extra'.
	* org.el (org-version): Avoid var name starting with _.
	(org-inhibit-startup, org-called-with-limited-levels)
	(org-link-search-inhibit-query, org-time-was-given)
	(org-end-time-was-given, org-def, org-defdecode, org-with-time):
	* org-colview.el (org-agenda-overriding-columns-format):
	* org-agenda.el (org-agenda-multi, org-depend-tag-blocked)
	(org-agenda-show-log-scoped):
	* ob-python.el (py-which-bufname, python-shell-buffer-name):
	* ob-haskell.el (org-export-copy-to-kill-ring):
	* ob-exp.el (org-link-search-inhibit-query):
	* ob-R.el (ess-eval-visibly-p):
	* ob-core.el (org-src-window-setup): Declare before use.
	(org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'.
	* ox-odt.el (org-odt-hfy-face-to-css):
	* org-src.el (org-src-associate-babel-session, org-src-get-lang-mode):
	* org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex)
	(org-bibtex-check):
	* ob-tangle.el (org-babel-tangle, org-babel-spec-to-string)
	(org-babel-tangle-single-block, org-babel-tangle-comment-links):
	* ob-table.el (sbe):
	* ob-sqlite.el (org-babel-sqlite-expand-vars):
	* ob-sql.el (org-babel-sql-expand-vars):
	* ob-shen.el (org-babel-execute:shen):
	* ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate):
	* ob-scala.el (org-babel-scala-evaluate):
	* ob-ruby.el (org-babel-ruby-table-or-string)
	(org-babel-ruby-evaluate):
	* ob-python.el (org-babel-python-table-or-string)
	(org-babel-python-evaluate-external-process)
	(org-babel-python-evaluate-session):
	* ob-picolisp.el (org-babel-execute:picolisp):
	* ob-perl.el (org-babel-perl-evaluate):
	* ob-maxima.el (org-babel-execute:maxima):
	* ob-lisp.el (org-babel-execute:lisp):
	* ob-java.el (org-babel-execute:java):
	* ob-io.el (org-babel-io-evaluate):
	* ob-haskell.el (org-babel-execute:haskell):
	* ob-fortran.el (org-babel-execute:fortran):
	* ob-exp.el (org-babel-exp-code):
	* ob-emacs-lisp.el (org-babel-execute:emacs-lisp):
	* ob-ditaa.el (org-babel-execute:ditaa):
	* ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash)
	(org-babel-parse-header-arguments, org-babel-reassemble-table)
	(org-babel-goto-src-block-head, org-babel-mark-block)
	(org-babel-expand-noweb-references, org-babel-script-escape)
	(org-babel-process-file-name):
	* ob-clojure.el (org-babel-execute:clojure):
	* ob-calc.el (org-babel-execute:calc):
	* ob-awk.el (org-babel-execute:awk):
	* ob-abc.el (org-babel-execute:abc):
	* ob-R.el (org-babel-expand-body:R):
	* ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...).

2013-11-12  Glenn Morris  <rgm@gnu.org>

	* ox-html.el (org-html-scripts): Add 2013 to copyright years.
	(org-html-infojs-template): Copyright holder to FSF.
2013-11-12 20:57:31 +01:00
Eric Schulte e4984e2783 fix tangle bug, checking empty headlines commented
Thanks to Michael Brand for catching this bug.

* lisp/ob-tangle.el (org-babel-under-commented-heading-p): robust to
  empty headlines.
2013-11-11 13:54:21 -07:00
Bastien Guerry 2ac57db0a3 Merge branch 'maint' 2013-11-04 12:20:20 +01:00
Bastien Guerry 56d405a41c org.el (org-babel-load-file): Set `exported-file' correctly
* org.el (org-babel-load-file): Set `exported-file' correctly,
in case the file as been tangled using a buffer-local value.

* ob-tangle.el (org-babel-tangle-file): Return the list of
tangled files.

Thanks to Sam Flint for reporting this.
2013-11-04 12:19:45 +01:00
Aaron Ecay a94501a132 babel: don’t move point when tangling a single block
* lisp/ob-tangle.el: (org-babel-tangle): don’t move point when called
with single prefix arg

Previously, C-u C-x C-v C-t would move point to the head of the source block.
2013-10-31 01:54:53 -04:00
Nicolas Goaziou bdbf80aacb ob-tangle: Silence byte-compiler 2013-10-27 09:54:27 +01:00
Eric Schulte 7a17f8a5a7 fix typo in `org-babel-under-commented-heading-p'
Thanks to Alan Schmitt for pointing this out.

* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Fix name
  typo.
2013-10-20 15:56:20 -06:00
Eric Schulte af80144976 tangle checks for COMMENT in parent headlines
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Check if
  the point is under a commented heading (including parents).
  (org-babel-tangle-collect-blocks): Don't tangle blocks is under a
  commented heading (including parents).
2013-10-19 15:53:39 -06:00
Eric Schulte be3dad300f re-apply an orphaned anonymous lambda function
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Re-apply an
  orphaned anonymous lambda function.
2013-10-09 10:29:01 -06:00
Eric Schulte 15847336c3 tangled links use relative paths by default
* lisp/ob-tangle.el (org-babel-tangle-use-relative-file-links):
  Controls the use of relative paths in files and links in tangled
  source code.
  (org-babel-spec-to-string): Optionally use relative paths in files
  and links.
2013-10-09 10:29:01 -06:00
Vladimir Lomov 11498bf86f remove dangling 'padline' variable
And seems that you miss another 'padline' in function
'org-babel-spec-to-string', line 323. I attached small patch which
removes that line so I can tangle Org document with shell scripts.

* lisp/ob-tangle.el (org-babel-spec-to-string): Remove dangling
  'padline' variable.

TINYPATCH
2013-10-01 06:00:44 -06:00
Eric Schulte ae21350aaa :padline insertion aware of placement in file
* lisp/ob-tangle.el (org-babel-spec-to-string): Remove padline
  handling from here as there is insufficient information on context.
  (org-babel-tangle): Moved padline handling here where we can test
  for placement in the file.
2013-09-28 06:15:42 -06:00
Eric Schulte 6f90d903e6 Revert "don't insert a padline at the top of the file"
This reverts commit 6215960d99.
2013-09-28 06:11:36 -06:00
Eric Schulte 6215960d99 don't insert a padline at the top of the file
* lisp/ob-tangle.el (org-babel-spec-to-string): Don't insert a padline
  at the top of the file, instead only insert padlines between blocks.
2013-09-20 15:25:36 -06:00
Eric Schulte 1a8ad7dab1 fixed bug in tangle-file
* lisp/ob-tangle.el (org-babel-tangle): Fixed bug in tangle-file.
2013-06-11 11:59:43 -06:00
Eric Schulte 5c6f4fd130 change file modes once after tangling
* lisp/ob-tangle.el (org-babel-tangle): Collect tangle modes, and only
  apply them to the file after all tangling has completed, including the
  post-tangle-hook.
2013-06-10 09:56:43 -06:00
Eric Schulte 2a73e06a6d adding a new global tangle-mode header argument
* doc/org.texi (Top): Documentation for new tangle-mode header argument.
  (Specific header arguments): Documentation for new tangle-mode header
  argument.
  (rownames): Documentation for new tangle-mode header argument.
  (tangle-mode): Documentation for new tangle-mode header argument.

* lisp/ob-core.el (org-babel-common-header-args-w-values): Adding the
  new :tangle-mode header argument.
  (org-babel-read): Read values starting with a "#" character as emacs
  lisp.

* lisp/ob-tangle.el (org-babel-tangle): Use the new :tangle-mode header
  argument.

* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): Use the
  new :tangle-mode header argument.
2013-06-08 12:29:02 -06:00
Vitalie Spinu 6043de578f avoid file warnings in org-babel-post-tangle-hook
* lisp/ob-tangle.el (org-babel-find-file-noselect-refresh): call
  find-file-noselect with 'nowarn argument to surpress yes-or-no-p
  reversion message.
2013-06-07 07:23:16 -06:00
Eric Schulte bceb151b7e `org-src-switch-to-buffer' to jump from src to org
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Use
  `org-src-switch-to-buffer' to jump from src to org.
2013-06-06 09:11:54 -06:00