Commit Graph

26106 Commits

Author SHA1 Message Date
Ihor Radchenko d98ca046cc
org-manual.org: Clarify that LANGUAGE may be omitted in code blocks
* doc/org-manual.org (Structure of Code Blocks):
(Editing Source Code): Clarify that <language> is optional.  Link to
possible consequences of <language> being omitted.
2023-01-23 16:29:13 +03:00
Ihor Radchenko 59fa35a0b7
Merge branch 'bugfix' 2023-01-23 15:48:58 +03:00
Ihor Radchenko a1c7cedd28
test-ob-octave: Fix tests failing on Debian CI (followup)
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file-space): Do
not assert absence of warnings.  See 59228e513.
2023-01-23 15:47:08 +03:00
Ihor Radchenko 4166f55da1
Merge branch 'bugfix' 2023-01-23 13:28:46 +03:00
Ihor Radchenko 59228e5134
test-ob-octave: Fix tests failing on Debian CI
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session): Do not assert that octave must not
emit warnings.  Just test the file created by side effect.

We currently have no reliable way to disambiguate warnings from
non-zero exit code when using `org-babel-eval'.  Warnings are ok, as
long as they do not result in the file not being created in the test.

Link: https://orgmode.org/list/87mt6m5n6u.fsf@localhost
2023-01-23 13:28:00 +03:00
Kyle Meyer e84077ded3 Merge branch 'bugfix' 2023-01-22 21:46:52 -05:00
Kyle Meyer e37e9b692e org-persist: Silence recent byte-compiler warning
* lisp/org-persist.el: Bind pp-use-max-width to silence byte-compiler
warning about unused lexical variable.

Note that loading pp.el upfront rather than relying on the pp function
being autoloaded would also eliminate the warning, but that would only
work on Emacs 29 or later because earlier versions do not have the
pp-use-max-width option.
2023-01-22 21:45:57 -05:00
Kyle Meyer 6ae5430962 Merge branch 'km/from-emacs-29' into bugfix 2023-01-22 21:33:37 -05:00
Dmitry Gutov ebaf1c9c04 Backport commit 347933377 from Emacs
* lisp/ob-ruby.el: Fix outdated comments.

lisp/org/ob-ruby.el: Fix outdated comments.
34793337783489297313c67d4a56682514877597
Dmitry Gutov
Fri Jan 20 23:32:21 2023 +0200
2023-01-22 21:33:13 -05:00
Stefan Kangas 0ab9bc138f Backport commit 920a7d38e from Emacs
; Fix typos
920a7d38e96134289393b7bfcc3a7b88be73925b
Stefan Kangas
Sun Jan 15 02:14:19 2023 +0100

[km] These were likely not typos but intended as an abbreviation for
     "if and only if".  However, using "if" works fine in these spots,
     so let's just go along with the change.  (These may end up being
     reverted on Emacs's side; see emacs-devel
     <83a62k72lx.fsf@gnu.org>, 01-15.)
2023-01-22 21:33:13 -05:00
TEC a9ee43a124
ox: Fix parsing of example #+includes
* lisp/ox.el (org-export-parse-include-value): Since the example
environment regexp does not contain a capture group, we can not assume
we can call `replace-match' on the first capture group.  Before doing
so, check that the capture group indeed exists.
2023-01-22 20:14:23 +03:00
Ihor Radchenko ce4f7db3c1
test-ob-shell: Fix test failures on Emacs 26
* testing/lisp/test-ob-shell.el (test-ob-shell/remote-with-stdin-or-cmdline):
Work around non-local exit when running tests on Emacs 26.  Do no call
`kill-matching-buffers' unless Emacs in newer.
2023-01-22 19:21:25 +03:00
TEC f0dfbf0c39
ox-latex: Erase compile buffer at the start
* lisp/ox-latex.el (org-latex-compile): Before running the compile
command, erase the log buffer to ensure that stale/old logging is
cleared.
2023-01-22 18:18:43 +03:00
TEC b84018633e
ox-latex: Split org-latex-compile into two funs
* lisp/ox-latex.el (org-latex-compile): Split off the postprocessing in
`org-latex-compile' into a new function,
`org-latex-compile--postprocess'.
2023-01-22 18:18:43 +03:00
TEC 18d2f871c2
org: Split org-format-latex into two functions
* lisp/org.el (org-place-formula-image, org-format-latex): Extract the
overlay placement component of `org-format-latex' into a new function
`org-place-formula-image`.
2023-01-22 18:18:42 +03:00
TEC d0c87c762a
ox-latex: Do not hardcode fallback compiler
* lisp/ox-latex.el (org-latex-compile): Instead of hardcoding "pdflatex"
as the fallback compiler, use `org-latex-compiler'.
2023-01-22 18:18:41 +03:00
TEC b29f772416
org-macs: Split org-compile-file into two funs
* lisp/org-macs.el (org-compile-file, org-compile-file-commands):
Pull out the logic transforming process descriptions to commands to be
executed into a new function, `org-compile-file-commands'.
`org-compile-file' is now solely concerned with running the commands and
reporting the result.
2023-01-22 18:18:40 +03:00
TEC c8f88589cb
org-persist: Set utf-8 coding when reading/writing
* lisp/org-persist.el (org-persist--write-elisp-file,
org-persist--read-elisp-file): Instead of letting `find-auto-coding' be
invoked to determine the coding for org-persist cache files (which can
be surprisingly expensive), we simply set utf-8 coding when
reading/writing.
2023-01-22 18:18:40 +03:00
TEC e9c0696f79
org-persist: Inhibit fsync when writing cachefiles
* lisp/org-persist.el (org-persist--write-elisp-file): For the reasons
mentioned in the large code comment, it simply does not make much sense
to use fsync when writing cache files.

The value of fsync in general on modern hardware seems questionable,
particularly with CoW filesystems which take care of the problem better
than it seems fsync ever could.
2023-01-22 18:18:39 +03:00
TEC 506989bed5
ox: Improve #+include parsing docstring
* lisp/ox.el (org-export-parse-include-value): Actually describe the
parsing behaviour of the function in the docstring.
2023-01-22 18:18:38 +03:00
TEC ffd832d5d6
org-manual: Update #+include block parsing
* doc/org-manual.org (Include Files): Mention that block names starting
with ":" will need to be quoted, and reformat the paragraph for clarity
while editing the mention of block name.
2023-01-22 18:18:37 +03:00
TEC 7e649050c7
ox: Pass through unparsed #+include content
* lisp/ox.el (org-export-parse-include-value): Adjust the block matches
not to match keywords (i.e. ":\S-+"), and both block and env to consume
their matches in value.  Now value only contains the unmatched content,
which is given in as the results plist as :unmatched.
2023-01-22 18:18:37 +03:00
TEC 5cde90e3c8
ox: Refactor org-export-expand-include-keyword
* lisp/ox.el (org-export-expand-include-keyword): Split the parsing and
inclusion logic of the ~150 line `org-export-expand-include-keyword'
into two new functions: `org-export-parse-include-value' and
`org-export--blindly-expand-include'.
2023-01-22 18:18:36 +03:00
TEC 0af74d33a7
org-manual: Fix typos in print_bibliography kwd
* doc/org-manual.org (Bibliography options in the "biblatex" and "csl"
export processors): In some example Org content, the "+" in the keyword
prefix "#+" was missing.
2023-01-22 18:18:30 +03:00
Ihor Radchenko 4b546e04af
org-element--cache-submit-request: Ensure correct cache synchronization
* lisp/org-element.el (org-element--cache-sync): Add new optional
argument FORCE to force cache synchronization even when
`org-element--cache-active-p' returns non-nil.  Update commentary
explaining why `org-element--cache-active-p' needs to be checked.
(org-element--cache-submit-request): Force cache synchronization.  We
are safe to force it as all the callers of
`org-element--cache-submit-request' do check that cache is active.

This fixes an edge case when Org buffer has transient indirect buffers
with `after-change-functions' not being setup.  If a change happens in
the main Org buffer, `org-element--cache-after-change' gets called and
cache request is processed even though (org-element--cache-active-p),
but not (org-element--cache-active-p t), returns nil (due to the
indirect buffer).

Before this commit, `org-element--cache-submit-request' called by
`org-element--cache-after-change' missed cache synchronization, as
`org-element--cache-sync' did nothing.  As a result, if the indirect
buffer would get deleted, we would end up with incorrect cache state.

Reported-by: Gregor Zattler <telegraph@gmx.net>
2023-01-22 15:13:50 +03:00
Ihor Radchenko ddca762329
org-element--cache-verify-element: Format all the elements in warning
* lisp/org-element.el (org-element--cache-verify-element): Use
`org-element--format-element' to print all the elements.
2023-01-22 15:13:49 +03:00
Ihor Radchenko b34bdc8719
org-capture-finalize: Do not save new file with :no-save aborted capture
* lisp/org-capture.el (org-capture-finalize): Do not save the newly
created file buffer when the capture is aborted and org-capture is not
asked to save upon capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
2023-01-22 13:49:07 +03:00
Ilya Chernyshov 005c9ae747
lisp/org-datetree.el: Allow datetrees with TODO, priority, tags
* org-datetree.el (org-datetree--find-create): Add optional argument
MATCH-TITLE that controls whether to match REGEX-TEMPLATE against
heading title inside complex heading or to match REGEX-TEMPLATE
against the whole heading line.

* org-datetree.el (org-datetree--find-create-group,
org-datetree-find-iso-week-create): Allow finding a datetree with TODO
state, priority, tags, statistics cookies, or COMMENT keyword.

* testing/lisp/test-org-datetree.el
(test-org-datetree/find-date-create,
test-org-datetree/find-iso-week-create): Add tests for a datetree with
tags, TODO or priority keywords.

* etc/ORG-NEWS (Datetree structure headlines can now be complex):
Document the change.

* doc/org-manual.org: Update datetree definition.
2023-01-21 12:29:32 +03:00
Ihor Radchenko f2320a2cc1
Revert "org-agenda.el: Fix `org-agenda-get-blocks'"
This reverts commit cb19f5c94e.

The original commit broke timestamp ranges with same starting and
ending hours.

Link: https://orgmode.org/list/87edrpa15m.fsf@gnu.org
2023-01-21 11:27:39 +03:00
Gautier Ponsinet 84ead47d3c
Define the face `org-agenda-calendar-daterange'
* etc/ORG-NEWS: Announce the introduction of the new face
  `org-agenda-calendar-daterange'.
* lisp/org-faces.el: Define the face `org-agenda-calendar-daterange'.
* lisp/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-daterange' to entries with a date range.
2023-01-21 11:27:38 +03:00
Gautier Ponsinet 22dea8557f
org-agenda: Apply the face `org-agenda-calendar-event'
* list/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-event' to entries with a time range within a
  single day.
2023-01-21 11:27:38 +03:00
Marco Wahl 9d58e1c781 org: Make documentation of org-reverse-note-order true
* lisp/org.el (org-notes-order-reversed-p): Return value is
org-reverse-note-order if it is neither nil or a list.

E.g. before nil has been returned when org-reverse-note-order was a
symbol.  And this did not meet the documentation of
org-reverse-note-order.
2023-01-20 13:56:00 +01:00
Ihor Radchenko c92769a505
org-paste-subtree: Do not leave empty line in place of level indicator
* lisp/org.el (org-paste-subtree): Remove the whole line when level
indicator is provided.  Improve check for level indicator.
* testing/lisp/test-org.el (test-org/paste-subtree): Add test.

Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/a2cc49d3-7f65-5f6a-8f05-21e5056335b3@gmail.com
2023-01-20 13:05:08 +03:00
Ihor Radchenko cf1ccc7154
Merge branch 'bugfix' 2023-01-20 12:10:40 +03:00
Ihor Radchenko 15c519b84c
Do not assume that `org-string-width' preserves match data
* lisp/org-table.el (org-table-blank-field):
(org-table-clean-line): Avoid `org-string-width' modifying match data.

As long as `org-string-width' creates a new window buffer, third-party
modes and Emacs distributions might modify the match data in buffer
hooks.  Hence, we cannot assume that match data is not modified even
though `org-string-width' code itself does not alter the match data.

Note: Adding `save-match-data' around function calls is generally a
good practice when the surrounding code relies on the match data being
intact.  Elisp conventions don't prohibit functions to modify match
data without notice in their docstring.

Reported-by: Thomas Schneider <qsx@chaotikum.eu>
Link: https://orgmode.org/list/wwufsc7edzu.fsf@chaotikum.eu
2023-01-20 12:01:24 +03:00
Ihor Radchenko e553e19ca9
Merge branch 'bugfix' 2023-01-20 11:46:55 +03:00
Ihor Radchenko ecdb442044
org-persist: Work around Emacs bug#58687
* lisp/org-persist.el (org-persist--write-elisp-file): Bind
`pp-use-max-width' to nil when using `pp'.  Otherwise, printing
quickly becomes slow.

Reported-by: Michael Eliachevitch <m.eliachevitch@posteo.de>
Link: https://orgmode.org/list/87wn8tb3zp.fsf@posteo.de
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58687
2023-01-20 11:44:57 +03:00
Ihor Radchenko 52f29d4da3
Merge branch 'bugfix' 2023-01-18 12:19:34 +03:00
Ihor Radchenko cbb288eaa5
ob-core: Do not use `temporary-file-directory' function
* lisp/ob-core.el (org-babel-temporary-stable-directory): Use
`temporary-file-directory' variable instead of function.  The function
returns value depending on the `default-directory' at Org startup time
thus creating unpredictable temporary babel locations that may
sometimes litter current directory.

Reported-by: bhrgunatha <bhrgunatha@gmail.com>
Link: https://orgmode.org/list/93b040e1-6dc6-487f-de89-a4cea9a560ff@gmail.com
2023-01-18 12:16:19 +03:00
Ihor Radchenko f8a601f800
Merge branch 'bugfix' 2023-01-18 11:53:21 +03:00
Ihor Radchenko 5d9c9c27c6
* lisp/org-agenda.el: require 'org-element
Load org-element for agenda instead of relying on org-element being
loaded when agenda is ran.

Reported-by: zimoun <zimon.toutoune@gmail.com>
Link: https://orgmode.org/list/86r0vszn3w.fsf@gmail.com
2023-01-18 11:52:08 +03:00
Ihor Radchenko 0e5de0ff64
org-export-expand-include-keyword: Fix relative links in recursive includes
* lisp/ox.el (org-export-expand-include-keyword): Add new optional
argument INCLUDER-FILE to explicitly pass the includer file path when
expanding inside a temporary buffer.  Pass the INCLUDER-FILE later
during recursive expansion.

Reported-by: Gabriel Petrini da Silveira <gpetrinidasilveira@gmail.com>
Link: https://orgmode.org/list/CAHCA-UvaqnegPYfpPcJCqiY8+dDoj0pfX0vDckUui-MCj3wq5A@mail.gmail.com
2023-01-18 11:41:03 +03:00
Ihor Radchenko 104311c7f8
org-cite-basic--get-field: Throw an error on non-nil field values
* lisp/oc-basic.el (org-cite-basic--get-field): Throw an error when
the field value is not a string.  Document the new behavior.

Link: https://orgmode.org/list/87edsnsocj.fsf@localhost
2023-01-17 15:25:00 +03:00
Ihor Radchenko 15bbb930d5
Merge branch 'bugfix' 2023-01-17 15:05:36 +03:00
Ihor Radchenko c7b976a052
org: Bump the minimal required Emacs version
* lisp/org.el: Bump required Emacs version to 26.1.

See https://orgmode.org/worg/org-maintenance.html#emacs-compatibility
2023-01-17 15:05:11 +03:00
Ihor Radchenko 30dfafac34
Merge branch 'bugfix' 2023-01-16 13:41:26 +03:00
Ihor Radchenko 12bcd322d0
Improve documentation for agenda starting day
* doc/org-manual.org (Weekly/daily agenda):
* lisp/org-agenda.el (org-agenda-start-on-weekday):
(org-agenda-start-day): Document that `org-agenda-start-on-weekday'
takes precedence over `org-agenda-start-day' when agenda span is 7 or
14 days.

Reported-by: Eppo Math <eppolito.math@gmail.com>
Link: https://orgmode.org/list/878ri67plt.fsf@localhost
2023-01-16 13:35:11 +03:00
Ihor Radchenko 889b8cc2fd
Merge branch 'bugfix' 2023-01-16 12:30:03 +03:00
Ihor Radchenko df4a5d86d8
org-fold: Fix isearch when `org-fold-core-style' is 'overlays
* lisp/org-fold-core.el (org-fold-core--isearch-show): Make sure that
the actual isearch match is revealed.  This relies on undocumented
behavior of isearch that point is at the match when
'isearch-open-invisible is called.
(org-fold-core-region): Disable 'isearch-open-invisible-temporary
features when `org-fold-core-style' is 'overlays.  This is to work
around the undocumented requirement of isearch to _not_ delete the
overlay passed to 'isearch-open-invisible-temporary function.  Since
`org-fold-show-set-visibility' may destroy overlays arbitrarily, we
cannot currently support isearch `org-fold-show-context-detail' in
full.

Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87zgb6tk6h.fsf@localhost
2023-01-16 12:21:57 +03:00
Ihor Radchenko 25dd206a0e
Merge branch 'bugfix' 2023-01-14 16:30:26 +03:00