* lisp/org-compat.el (org-file-name-concat): Do not use
`string-empty-p'.
(combine-change-calls): Create a stub when `combine-change-calls' were
not yet available.
(org-replace-buffer-contents): Add compatibility function for
`replace-buffer-contents'.
* lisp/org-element.el (org-element--current-element): Do not use
`if-let'.
* lisp/org-persist.el (org-persist-gc): Do not use `when-let'.
* lisp/org-plot.el (org-plot/gnuplot): Do not use `if-let'.
* lisp/org-src.el (org-edit-src-save, org-edit-src-exit): Use
`org-replace-buffer-contents'.
* lisp/org.el (org-narrow-to-subtree, org--property-local-values,
org-entry-get-with-inheritance, org-in-commented-heading-p,
org-up-heading-safe, org-goto-first-child): Do not use
`if-let'/`when-let'.
* testing/org-test.el (org-test-at-time): Fallback to old
`decode-time' specification in older Emacs.
* lisp/org-macs.el (org-do-remove-indentation): Add optional argument
to skip the first line.
* lisp/org-src.el (org-src--coordinates): Fix coordinates for inline
LaTeX fragments.
(org-src--contents-for-write-back): Do not indent first line for LaTeX
fragments.
(org-src--edit-element): Compute block-indentation according to parent
for LaTeX fragments. Skip first line when removing common indentation
for LaTeX fragments.
* lisp/org-src.el (org-src--contents-for-write-back): Do not indent blank lines, except for the
current line maybe.
(org-src--preserve-blank-line): New variable, whether to preserve
indentation of the current blank line.
(org-src--edit-element): Set `org-src--preserve-blank-line'.
* lisp/org.el (org-indent-line): When tab acts natively, do some
preindentation, which signals `org-src--edit-element' to
preserve the indentation of current blank line.
Removing all the whitespace was the original behaviour for all blank lines, before `857ae366b3`.
* lisp/org-src.el (org-src--contents-for-write-back): Do not indent
blank lines, except for the current line.
This was the original behaviour for all blank lines, before `857ae366b3`.
* lisp/org-src.el (org-edit-src-save):
(org-edit-src-exit): Use `replace-buffer-contents' only for emacs >=
27.
It was introduced in emacs 26.1, but earlier versions made no
guarantees of correctness.
* lisp/org-src.el (org-src--contents-for-write-back): Shorten the
first line of the docstring.
(org-edit-src-exit): Conditionnally kill the write-back buffer.
* lisp/org-src.el (org-src--contents-for-write-back): Use a write
back buffer.
* lisp/org-src.el (org-edit-src-exit, org-edit-src-save): Use
`replace-buffer-contents'.
Reported-by: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
Link: https://orgmode.org/list/603f9c4e-c621-7592-5b20-a7354c11d5d2@posteo.eu/
* lisp/org-src.el (org-src--coordinates)
(org-src--goto-coordinates): Use point instead of column.
Using a column-based approach fails to account for invisible regions
or display overlays that change the number of columns: for example,
showing a LaTeX \alpha as α. In src edits which involve such
structures, this causes the point to be shifted undesirably. By using
a point-based approach this issue does not occur.
These show up in the Emacs repo (before and after the latest sync in
f22856a5c5), but for an unknown reason do not show up with `make
compile' or `make single' in the Org repo.
All of these functions are autoloaded.
* lisp/org-src.el (org-src--edit-element): Clear undo information once
the initial contents have been inserted.
* testing/lisp/test-org-src.el (test-org-src/undo): New test.
* lisp/org-src.el (org-src--contents-area): Handle `latex-fragment'.
(org-edit-latex-fragment): New function.
* lisp/org.el (org-edit-special): Use new function.
* doc/org-manual.org (Execute commands in the active region):
Update the manual given the new defaults.
* etc/ORG-NEWS (New default settings for some options): New
section.
* lisp/org.el (org-loop-over-headlines-in-active-region):
Change the default value to `t'.
(org-fontify-done-headline): Ditto.
* lisp/org-agenda.el
(org-agenda-loop-over-headlines-in-active-region): Ditto.
* lisp/org-src.el (org-src-tab-acts-natively): Ditto.
* lisp/org-src.el (org-edit-src-code): Don't throw an error
when trying to find the source language in a non-interactive
call, typically when called for template expansion.
Thanks to Tyler Smith and Jack Kamm for reporting a related bug.
* lisp/org-src.el (org-src-switch-to-buffer): Add call to
quit-restore-window in org-src-switch-to-buffer when
org-src-window-setup is other-window so that the popped up window is
closed on exit.
* lisp/org-src.el (org-src--content-indentation): Introduce
permanently buffer-local variable for storing away the potentially
buffer-local value of `org-edit-src-content-indentation' in the source
buffer.
(org-src--contents-for-write-back): Use `org-src--content-indentation'
instead of `org-edit-src-content-indentation' in the edit buffer.
(org-src--edit-element): Set `org-src--content-indentation' in editing
buffer. For greater clarity and consistency, rename already existing
let-bound variable `ind' to `block-ind'.
* org-src.el (org-src-window-setup, org-src-switch-to-buffer): Added
new split-window-right option which splits horizontally.
This has been motivated by the increasing use of wide monitors.
* lisp/org-src.el (org-src-get-lang-mode): New function.
(org-src--get-lang-mode): Rename to `org-src-get-lang-mode'.
(org-src-font-lock-fontify-block):
(org-edit-latex-environment):
(org-edit-export-block):
(org-edit-src-code):
(org-edit-inline-src-code): Use new function.
* lisp/org-src.el (org-src-source-file-name): New variable.
(org-src--edit-element): Set new variable.
* lisp/org.el (org-store-link): Store the source file along with the
coderef so as to insert link in other documents than the one
where the code block is located.
Reported-by: stardiviner <numbchild@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00293.html>