* lisp/ob-tangle.el (org-babel-tangle-comment-links): %start-line
reports the line number, not the buffer position at the beginning of
line.
Reported-by: immanuel <immanuel.litzroth@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00267.html>
Assume that there is file A and symlink B that points to file A. If
there is an open buffer that points to A and we
call (org-babel-tangle-file "B"), then this function kills the buffer
since get-file-buffer does not follow symlinks.
* lisp/ob-tangle.el (org-babel-detangle):
(org-babel-tangle-jump-to-org): Use `org-link-bracket-re'.
* lisp/ol.el (org-link-analytic-bracket-re): Remove variable.
(org-link-make-regexps): Do not set it.
(org-link-display-format): Use `org-link-bracket-re'
(org-link-trim-scheme): New function.
(org-store-link): Remove code duplication.
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Preserver order
of code blocks from the source document.
* testing/lisp/test-ob-tangle.el (ob-tangle/block-order): New test.
Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00062.html>
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Preserve position
in source block only if it doesn't put point outside of the block.
Reported-by: Frederick Giasson <fred@curbside.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00008.html>
* lisp/ob-tangle.el (org-babel-tangle-single-block): Prevent double unescaping
of source block by removing unnecessary call to `org-unescape-code-in-string'.
* testing/lisp/test-ob-tangle.el (ob-tangle/nested-block) New function.
* lisp/ob-tangle.el (org-babel-tangle-publish): Port to new copy-file
behavior.
Adjust ob-tangle to new copy-file behavior
74b8615fcceba7b92c4938e1bcc92015f10ae899
Paul Eggert
Sun Sep 10 22:31:23 2017 -0700
* lisp/ob-tangle.el (org-babel-tangle-single-block):
`org-babel-expand-noweb-references' specifically needs to be run in
the Org document so as to resolve references.
* testing/lisp/test-ob-tangle.el (ob-tangle/continued-code-blocks-w-noweb-ref):
Make sure a failing test doesn't leave a file behind it.
* lisp/ob-tangle.el (org-babel-spec-to-string): Move some processing...
(org-babel-tangle-single-block): ... there. This function is called
with the Org buffer as its original buffer whereas the previous one is
not.
This is a follow-up to 026fb75, which was reverted.
Reported-by: David Dynerman <emperordali@block-party.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/110670>
* lisp/ob-tangle.el (org-babel-tangle): Make sure buffer local
variables from Org document are taken into consideration in tangled
document.
Reported-by: David Dynerman <emperordali@block-party.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/110577>
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Fix the jump from a
tangled part to the respective org in the case when an org-id defines
the linking.
The recent (buggy) behavior was to find the file which has the org-id as
filename.
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Find correct
location in the Org document.
* testing/lisp/test-ob-tangle.el (ob-tangle/jump-to-org): New test.
* 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>
* 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>
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
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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).
* 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.
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
* 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.
* 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.
* 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.
* lisp/ob-eval.el, lisp/ob.el, lisp/org-macro.el, lisp/org-mhe.el:
Require org-macs and org-compat as necessary.
* lisp/ob-tangle.el: Declare function `org-store-link' and
`org-open-link-from-string'.
* lisp/org-compat.el: Extend eval-and-compile clause and add advices
for functions that have different parameter lists in XEmacs. Add
variable definitions that XEmacs lacks .
* lisp/org-macs.el (declare-function): Define macro to use autoload
instead for XEmacs.
* lisp/ox-html.el, lisp/ox-odt.el: XEmacs does not have table.el, so
use 'noerror on the require form.
* lisp/ox-texinfo.el (org-texinfo-table-column-widths): Fix spliced
argument list that XEmacs complains about by adding parenthesis.
This fixes all compilation failures on XEmacs and warnings related to
Org that indicate that XEmacs has compiled things wrongly (for
instance it might have interpreted a function as a variable symbol).
There are still many warnings that probably indicate serious problems.
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Use the existing
org-edit-src functionality to jump back to the correct point in the
code block in the original Org-mode buffer.
* org.el (org-babel-load-file): Move `org-babel-load-file'
from ob-tangle.el to here so that it is correctly autoloaded
by Emacs before Org is required.
Thanks to Eric Schulte for feedback about this.
* lisp/ob-tangle.el (org-babel-tangle): Do not change signature, a nil
arg is even documented in the manual.
* lisp/org-src.el: Change declaration of `org-babel-tangle´ to "arg"
for first argument.
* ob-tangle.el (org-babel-tangle): Remove unused attempt of
prompting the user of the tangle file name since :tangle is
always set. Don't prompt for a tangle file name when called
with two universal prefix arg outside of a src block.
Use `org-babel-tangle-single-block'.
(org-babel-tangle-single-block): New function.
(org-babel-tangle-collect-blocks): Use the new function.
Thanks to Rick Frankel who provided a patch for this fix.
The patch fixes this issue (quoting Rick's email):
"When attempting to tangle a single block, `org-babel-tangle'
would use `narrow-to-region', causing any header arguments not
on the "#+BEGIN_SRC" line to be excluded from the tangled file."
* ob-tangle.el (org-babel-tangle): Rename the ONLY-THIS-BLOCK
parameter to ARG. Allow two universal prefix arguments to
tangle by the target file of the block at point.
(org-babel-tangle-collect-blocks): New parameter TANGLE-FILE
to restrict the collection of blocks to those who will be
tangled in TARGET-FILE.
Thanks to Zech for suggesting this.