* lisp/ob-tangle.el (org-babel-interpret-file-mode): Modify the regexp
for the ls -l style tangle file mode to allow for the suid/sgid bits to
be set. While I was at it I noticed that the a= parameter should have
been o=, and so that has been fixed too.
The sticky bit is ignored, but that is not a concern as it is only
relevant to directories.
* lisp/ob-tangle.el (org-babel-tangle-default-file-mode): Prefer
":package-version" to ":version".
The :version keyword should correspond to the Emacs version. Using
the Org version leads to an incorrect help message:
This variable was introduced, or its default value was changed, in
version 9.6 of Emacs.
Instead go through :package-version so that the displayed message is
This variable was introduced, or its default value was changed, in
version 9.6 of the Org package that is part of Emacs 29.1.
* lisp/ob-tangle.el (org-babel-tangle-default-mode,
org-babel-interpret-file-mode): Rename `org-babel-tangle-default-mode`
to the slightly more apt `org-babel-tangle-default-file-mode`, and
update `org-babel-interpret-file-mode` accordingly.
* lisp/ob-tangle (org-babel-interpret-file-mode): Accept "o755" and
similar as octal shorthand. A non-digit character must be included as
otherwise `org-babel-parse-header-arguments' will convert it to a
base-10 integer.
* lisp/ob-tangle.el (org-babel-tangle): Accept many more forms for
:tangle-mode, including octal strings (#o755, 0755, 755), ls forms (rwx,
rw-r--r--), and chmod forms (a=rw,u+x). The interpretation of the input
is now handled by the new function `org-babel-interpret-file-mode' which
references the new variable `org-babel-tangle-default-mode' when
considering relative mode forms.
* lisp/ob-tangle.el (org-babel-tangle-single-block,
org-babel-tangle-comment-links): Suppress org-id-link-to-org-use-id
during tangling. The links used during tangle process are transient
and do not really need to use ID. Using ID may create unexpected
edits in the tangled Org buffer when org-id-link-to-org-use-id is set
to t. Fixes [1].
[1] https://orgmode.org/list/9eb31da73b12fcaf6820484834cc8cd3@libre.brussels/T/#t
* lisp/ob-tangle.el (org-babel-tangle): Fix stringp error which happens
when confirming successful tangle when `org-babel-tangle' is called from
an org-src edit buffer.
TINYCHANGE
* lisp/ob-tangle.el (org-babel-effective-tangled-filename): Check for
the "no" parameter in this function to avoid erroneous tangling of a
single block (e.g. with C-u C-c C-v t) even with the parameter
:tangle no
TINYCHANGE
lisp/ob-tangle.el (org-babel-tangle-single-block): Fix the result when
`only-this-block' is `t' to match what is expected by
`org-babel-tangle'.
(org-babel-effective-tangled-filename): Extract the
computation of filename of tangled src block.
(org-babel-tangle-collect-blocks): Use `org-babel-effective-tangled-filename'.
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Group
collected blocks by tangled file name.
(org-babel-tangle): Avoid quadratic behavior in number of blocks and
set modes before writing to file.
* testing/lisp/test-ob-tangle.el (ob-tangle/block-order): Update test.
* lisp/ob-tangle.el (orb-babel-tangle-single-block): Regularize
behavior when removing coderefs during tangling. This fixes an issue
where trailing whitespace would be retained when coderefs were removed
for tangling.
* lisp/ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Use `declare`.
* lisp/ob-core.el (org-babel-map-src-blocks): Use `declare`.
(org-babel-result-cond): Simplify edebug spec.
* lisp/org-clock.el (org-with-clock-position, org-with-clock):
* lisp/org-agenda.el (org-agenda-with-point-at-orig-entry):
* lisp/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`.
Use `declare` instead of `def-edebug-spec` in most places
f8dbefbaa59bb17dd4a2dfa4d9ff560c46785792
Stefan Monnier
Fri Feb 12 16:08:01 2021 -0500
* lisp/org.el (org-in-archived-heading-p): New function.
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Use
`org-in-archived-heading-p' to skip archived headings when tangling
and exporting.
* testing/lisp/test-org.el (test-org/in-archived-heading-p): Add
test for `org-in-archived-heading-p'.
Reported-by: flare <gabrielxaviersmith@gmail.com>
See https://orgmode.org/list/877dt9ey2c.fsf@gmail.com/
* lisp/ob-tangle.el (org-babel-tangle-single-block): Fix regression
from v9.0.2 that resulted in org-babel-tangle-use-relative-file-links
being ignored.
* testing/lisp/test-ob-tangle.el
(ob-tangle/comment-links-relative-file): Add test.
As of 7b148e2d0 (ob-tangle: Respect buffer local variables,
2016-12-10), the condition in org-babel-tangle-single-block that
checks whether to return a file link with a relative target always
returns nil because the full org-link-types-re match, including the
final colon, is compared with "file" (no colon). Also, were this
condition to succeed, "file:" would be used as the file name.
Adjust the condition and fix the extracted file name.
Reported-by: Jeremias Gonzalez <jgonzalez49@ucmerced.edu>
https://orgmode.org/list/6fb12326-52d3-7177-eff5-62603261b388@ucmerced.edu
* lisp/org.el (org-babel-load-file): Load both "emacs-lisp"
and "elisp" source blocks.
* lisp/ob-tangle.el (org-babel-tangle-file)
(org-babel-tangle, org-babel-tangle-collect-blocks): Use a
regular expression to match the language(s) to tangle.
Thanks to Troy Hinckley for reporting this.
* lisp/ob-core.el (org-babel-expand-noweb-references):
* lisp/ob-tangle.el (org-babel-tangle): Use `org-src-get-lang-mode' so
as to use proper major mode.
Reported-by: immanuel <immanuel.litzroth@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00272.html>
* 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.