Commit Graph

17162 Commits

Author SHA1 Message Date
Ihor Radchenko 1c3a46268f
Backport from main: Fix compatibility with Emacs 26
* lisp/org-compat.el (org-replace-buffer-contents): Add compatibility
function for `replace-buffer-contents'.

* lisp/org-src.el (org-edit-src-save, org-edit-src-exit): Use
`org-replace-buffer-contents'.
2022-07-24 20:23:48 +08:00
Ihor Radchenko a0a078049b
Fix compiler warnings
* lisp/oc-basic.el (org-open-file): Declare function.
2022-07-24 20:19:47 +08:00
Robert Pluim 01b0fb14bc
Backport from main: Escape single left quotes in docstrings
* lisp/ob-core.el (org-babel-default-header-args):
* lisp/ob-julia.el (org-babel-julia-evaluate-external-process):
(org-babel-julia-evaluate-session):
* lisp/ob-lua.el (org-babel-lua-read-string):
* lisp/ob-table.el (org-sbe):
* lisp/oc-basic.el (org-cite-basic--shorten-names):
* lisp/org-agenda.el (org-agenda-sorting-strategy):
(org-agenda--mark-blocked-entry):
(org-agenda-set-restriction-lock):
* lisp/org-fold-core.el (org-fold-core--specs):
(org-fold-core-remove-folding-spec):
(org-fold-core-get-folding-spec):
(org-fold-core--isearch-overlays):
* lisp/org-plot.el (org--plot/prime-factors):
* lisp/org-table.el (org-table-collapse-header):
* lisp/org.el (org-special-ctrl-o):
(org-latex-to-html-convert-command):
* lisp/ox-html.el (org-html--unlabel-latex-environment):
* lisp/ox-publish.el (org-publish-find-property):
Use \\=' when there's a need for a single left quote in a docstring.

The emacs-29 byte compiler complains about such usage.
2022-07-24 20:19:11 +08:00
Ihor Radchenko afe50b7132
Fix Emacs 26 compatibility
* lisp/org-plot.el (org-plot/gnuplot): Do not use `if-let'.
* lisp/ox-ascii.el (org-ascii--describe-links):
* lisp/ox-md.el (org-md--headline-referred-p): Do not use
`ignore-error'.
* testing/org-test.el (org-test-at-time): Fallback to older definition
of `decode-time' when it cannot accept 3 arguments.
2022-07-24 20:11:03 +08:00
Ihor Radchenko e5cf0bc840
org-export: Do not use broken link handler on non-link elements
* lisp/ox.el (org-export-data): Only catch 'org-link-broken on link
objects.  Signaling 'org-link-broken for other element types, should
not happen and we should _not_ export such elements as "" or "[BROKEN
LINK...]".
2022-07-23 14:10:45 +08:00
Ihor Radchenko 14532ec6a5
ox-md: Fix export with broken links
* lisp/ox-md.el (org-md--headline-referred-p): Allow exporting
headlines when the document contains broken links and
`org-export-with-broken-links' is non-nil.  For broken links,
`org-export-resolve-link' throws an error - catch it and do not match
the headline against such broken link.
2022-07-23 14:10:19 +08:00
Ihor Radchenko 4631790fb9
ox-ascii: Fix export with broken links
* lisp/ox-ascii.el (org-ascii--describe-links): Skip broken links.
2022-07-23 14:10:13 +08:00
Ihor Radchenko c779b7aa0e
org-babel-detangle: Fix :comments link for src blocks before first heading
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org): Allow fuzzy
matching when following the backlink to src block from tangles
source.  The current default value of
`org-link-search-must-match-exact-headline` makes
`org-link-open-from-string` treat fuzzy links as headlines without
falling back to fuzzy text search.  Bind it to nil to force fuzzy text
matching while detangling.

Fixes https://orgmode.org/list/87zgh1qxfk.fsf@posteo.net
2022-07-23 10:10:24 +08:00
David Lukes 0dc27a8837
oc-basic.el: Stringify year from CSL-JSON date-parts
* lisp/oc-basic.el (org-cite-basic--parse-json): Make sure year
extracted from date-parts is returned as string.  Raise error if
original type other than number or string.

The stringifiation is motivated by errors like the following on Emacs 28
with nativecomp:

Error during redisplay: (jit-lock-function 544) signaled
(wrong-type-argument "Argument is not a string or a secondary string:
2007")

Additionally, the type check will warn users about problems in their
CSL-JSON bibliographies.

Fixes https://list.orgmode.org/875ykv4k2q.fsf@localhost/T/#t

TINYCHANGE
2022-06-23 21:20:53 +08:00
Bastien e0b05b0752 lisp/org.el: Bump version to 9.5.4 2022-06-03 08:37:30 +02:00
Bastien 4aaa2683b6 lisp/org-clock.el: Fix `read-number' prompt
* lisp/org-clock.el (org-clock-resolve): Fix `read-number' prompt.
2022-05-22 22:01:19 +02:00
Ihor Radchenko ef41f385fb
fixup! org-babel-load-file: Fix loading with non-nil COMPILE argument 2022-05-14 19:34:08 +08:00
Ihor Radchenko 4fe59b688f
org-babel-load-file: Fix loading with non-nil COMPILE argument
* lisp/org.el (org-babel-load-file): Use correct file name to load
compiled file.

Fixes https://orgmode.org/list/t5j75h$dbo$1@ciao.gmane.io
2022-05-13 18:35:13 +08:00
Ihor Radchenko f8bb414615
org-at-timestamp-p: Fix compatibility with Emacs 26
* lisp/org.el (org-at-timestamp-p): Do not use variables in regexp rx
form.  They are not yet supported in Emacs 26.  Expand them at runtime
instead.
2022-05-02 12:03:52 +08:00
Bastien 69c588947d lisp/org.el: Bump version to 9.5.3 2022-04-19 11:24:07 +02:00
Bastien 8aff825682 Revert "org-faces.el: Use fixed-pitch"
This reverts commit 667cb6f1ae.
2022-04-19 11:23:35 +02:00
Ihor Radchenko 1f617727f1
org-at-timestamp-p: Fix invalid regexp groups for 'agenda scope
* lisp/org.el (org-at-timestamp-p): Make sure that match groups follow
the docstring in `agenda' scope.  Update docstring explaining return
values for sexp timestamps.

Reported in https://orgmode.org/list/CAKJdtO8bqdbW5N6pRFNQRATjm2daEBDCpJj0njwcd4fmhSJSKQ@mail.gmail.com
2022-04-18 22:54:28 +08:00
Kyle Meyer 682ccdfffe org.el: Silence byte-compiler under 'make single' 2022-04-17 15:22:27 -04:00
Ihor Radchenko fa5c832e9b
org-cite-basic--key-completion-table: Reuse bibliography for speed
* lisp/oc-basic.el (org-cite-basic--key-completion-table): Supply the
pre-calculated bibliography entries when getting entry fields.  This
avoids excessive file change checks inside
`org-cite-basic--parse-bibliography'.
2022-04-16 18:04:02 +08:00
Ihor Radchenko 7ddc5b57c0
oc-basic: Speed up cached bibliography retrival
* lisp/oc-basic.el (org-cite-basic--file-id-cache): New variable
storing hash of bibliography file contents.
(org-cite-basic--parse-bibliography): Skip buffer hash calculation
when bibliography file is unchanged on disk.  Calculating buffer hash
on every call is slow when bibliography file is large.

* lisp/org-compat.el:
(org-file-has-changed-p--hash-table, org-file-has-changed-p): Define
`file-has-changed-p' from Emacs 29 if necessary.

See https://list.orgmode.org/LO2P265MB1758E12E04832DC712F5A8E9DC149@LO2P265MB1758.GBRP265.PROD.OUTLOOK.COM/T/#t
2022-04-16 18:04:02 +08:00
Bastien 64ee5c2c47 lisp/org-table.el: Fix bug in `org-table-row-get-visible-string'
* lisp/org-table.el (org-table-row-get-visible-string): Don't use
`backward-char' in a function called in a post-command hook.
2022-03-31 17:31:50 +02:00
Bastien 1354e872a7 lisp/ox-html.el: Fix `org-html-style-default'
* lisp/ox-html.el (org-html-style-default): Remove faulty .org-svg css
class specifications.

Reported-by: Yuchen Guo <Guoyuc@students.uni-marburg.de>
2022-03-28 14:34:11 +02:00
Nick Dokos 7caae6c088 Fix typo in doc string
* lisp/org-agenda.el (org-todo-list): Fix typo in doc string.
2022-03-28 14:26:26 +02:00
Ihor Radchenko b1a570b3b4
org-agenda: Fix regression when diary sexp timestamps are ignored
* lisp/org.el (org-at-timestamp-p): Return non-nil on sexp timestamps
when called with 'agenda argument.
* testing/examples/agenda-file.org (test sexp timestamp inside properties):
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking sexp timestamp inside properties drawer.
2022-03-26 15:17:45 +08:00
Nicolas Goaziou 667fa06646 oc-biblatex: Remove \relax hack after multicite commands
* lisp/oc-biblatex.el (org-cite-biblatex--multi-arguments): Do not try
to be smart and add \relax{} after multicite commands, as it breaks
csquotes.

Reported-by: Zac E <zac.endter@gmail.com>
<https://list.orgmode.org/8E381952-2AE5-45BF-B142-91DB4B18A26E@gmail.com/T/#t>
2022-03-23 23:18:05 +01:00
Ihor Radchenko d9bf64f064
org-agenda: Match timestamps inside node properties
* lisp/org-agenda.el (org-agenda-get-timestamps): Use
`org-at-timestamp-p' instead of org-element to check if at valid
timestamp.  Agenda should consider timestamps inside node properties
even though they are not parsed by org-element.

* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking active timestamp inside property drawer.

* testing/examples/agenda-file.org (test timestamp inside properties):
Add heading for `test-org-agenda/property-timestamp'.

Reported in https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com
2022-03-22 17:37:47 +08:00
Samim Pezeshki 847e332301
lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'
* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
2022-03-21 15:25:13 +08:00
Ihor Radchenko af6f1298b6
org-mouse: Fix keyword selection menu
* lisp/org-mouse.el (org-mouse-keyword-menu): Fix void-variable error
when selecting todo keyword.

Reported in https://list.orgmode.org/CAFChFyjzuBtr8BeGTb195AVoGbUKFtXf35vvv-r0mzOy0wvZ2Q@mail.gmail.com/T/#u
2022-03-19 16:07:01 +08:00
Stefan Monnier 668205f769 Backport commit d52c929e3 from Emacs
* lisp/org-refile.el (org-refile):
* lisp/org-capture.el (org-capture-store-last-position):
Pass `format` arg to `with-demoted-errors`.

(with-demoted-errors): Warn on missing `format` arg
d52c929e31f60ff0462371bfe27ebd479e3e82bd
Stefan Monnier
Fri Feb 4 19:39:53 2022 -0500

[km] with-demoted-errors has had a format argument since Emacs 24.4.
     Passing it avoids an error when compiling with Emacs's current
     master (bug#54225).  Once that bug is resolved, it will prevent a
     warning.
2022-03-02 23:02:50 -05:00
Nicolas Goaziou bafeaf161c element: Fix parsing of inline footnotes
* lisp/org-element.el (org-element--pair-round-table):
(org-element--pair-square-table):
(org-element--pair-curly-table): De-activate all but one pair of
parenthesis.
* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
Add test.

Reported-by: Greg Minshall <minshall@umich.edu>
<http://lists.gnu.org/r/emacs-orgmode/2022-02/msg00369.html>
2022-02-28 15:45:25 +01:00
Kyle Meyer 33543d2aa8 org-link-descriptive: Fix docstring typo
* lisp/ol.el (org-link-descriptive): Drop extra word from docstring.
2022-02-27 23:43:59 -05:00
Kyle Meyer 57362f7414 org-copy-visible: Respect buffer-invisibility-spec
* lisp/org.el (org-copy-visible): Decide whether text is invisible by
calling invisible-p rather than checking whether the invisible
property at point is non-nil.

Text may have a non-nil invisible property but _not_ be hidden from
the user (and thus should be copied by org-copy-visible).  For
example, the link itself is shown when org-link-descriptive is nil,
but it still has an invisible property of `org-link'.
2022-02-27 23:43:59 -05:00
Kyle Meyer f2833ff255 org-copy-visible: Fix handling of adjacent invisible text
* lisp/org.el (org-copy-visible): Don't copy invisible text that
follows invisible text with a different property value.

If org-copy-visible sees that the left bound position has a non-nil
invisible property, it uses next-single-char-property-change to find
the new bound.  However, next-single-char-property-change may just
find a bound that still has a _different_ non-nil invisible property.

Reported-by: "Максим Бабушкин" <maxbabushkin@gmail.com>
Link: https://debbugs.gnu.org/49967
2022-02-27 23:43:59 -05:00
David Lukes 83c6eccaee oc-basic: Better handling of CSL-JSON dates
* lisp/oc-basic.el (org-cite-basic--parse-json): Make date-parsing and
year extraction more resilient.  Provide more informative errors when it
fails.

A string-based date is not only indicated by the key 'raw, but also
possibly by the key 'literal.

String-based dates come in various formats, not necessarily yyyy-mm-dd.
So extracting the first sequence of 4 digits is arguably a better
heuristic for getting the publication year than splitting the string on
- and getting the car of that.

On error, include `value' in the message, which contains the original
value with actionable information, whereas the previously included
`date' is always nil in that case.

TINYCHANGE
2022-02-26 10:24:36 +01:00
Kyle Meyer ea6b7451b8 ox: Escape a docstring apostrophe
* lisp/ox.el (org-export-with-smart-quotes): Escape an apostrophe to
prevent it from being displayed as a curved quote in the help buffer.
2022-02-20 13:53:28 -05:00
Nicolas Goaziou 17e4fe9093 lint: Fix false positive with inline footnote definitions
* lisp/org-lint.el (org-lint-invalid-macro-argument-and-template):
Take into consideration inline definitions.
* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
Add test.

Reported-by: Timothy <tecosaur@gmail.com>
2022-02-13 22:13:41 +01:00
Sacha Chua c5ceb6a2c3
org-list-send-item: allow dest to be a buffer position
* lisp/org-list.el (org-list-send-item): Check if dest is a string
before matching it, to allow dest to be a buffer position.
* testing/lisp/test-org-list.el (test-org-list/send-item): Add tests.
2022-02-07 21:07:52 +08:00
Ihor Radchenko 7543da991f
org-bibtex-read: Fix regression from f7d6db1bf
* lisp/ol-bibtex.el (org-bibtex-read): Make sure that the return value
is the updated `org-bibtex-entries'.  Document the return value
requirement.  The assumption about the return value is used by
`org-bibtex-yank'.

Fixes https://list.orgmode.org/86zgn689m5.fsf@krailli2.fritz.box/T/#u
2022-02-05 19:17:58 +08:00
Ihor Radchenko dd6486a070
Make sure that declarative defvars do not set variable value
* lisp/ob-tangle.el (org-id-link-to-org-use-id):
* lisp/org-agenda.el (org-agenda-overriding-header): Do not try set
value of a variable defined elsewhere.  This may interfere with custom
interface.  See
https://list.orgmode.org/orgmode/871r19ryxb.fsf@localhost/

(org-agenda-restrict):
* lisp/ol-bibtex.el (org-bibtex-description): Remove incorrect
comments.
2022-01-30 16:46:12 +08:00
TEC 1b675f0ca8
org-agenda: Make timestamp ordering match docs
* lisp/org-agenda.el: When `org-agenda-sort-notime-is-late' is non-nil,
an absent timestamp is now (correctly) treated as maximal.

Bug reported by: Charles Tam <me@charlest.net> in
https://list.orgmode.org/CAKu+9YVNPSHG4HVtPFa2L2tP6yBdjJ38Teyr8OSDmCg0ZEOe9Q@mail.gmail.com
2022-01-30 15:40:13 +08:00
Ihor Radchenko 5b404a2225
org-dblock-write:clocktable: Fix typo in error string
Reported in https://list.orgmode.org/874k5uu85j.fsf@yandex.com/T/#u
2022-01-23 17:40:25 +08:00
Nicolas Goaziou 23daada78d compat: Prevent spell-checking citation
* lisp/org-compat.el (org--flyspell-object-check-p): Do not
spell-check citation and citation-reference objects.

Reported-by: Rudolf Adamkovič <salutis@me.com>
<http://lists.gnu.org/r/emacs-orgmode/2022-01/msg00434.html>
2022-01-22 15:48:26 +01:00
Ihor Radchenko 7ba24c673b
ob-gnuplot: Fix wrong table conversion when first column has ?-
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Revert to
using ascii exporter.
* lisp/ox-ascii.el (org-ascii-table-cell): Do not throw error when
CONTENTS is wider than initial cell value.
2022-01-14 22:03:38 +08:00
Ihor Radchenko e8d6db540b
org-agenda-get-timestamps: Ignore non-timestamps matching re
* lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm
that object at point is a timestamp.

Fixes https://list.orgmode.org/20220102210433.GC29829@itccanarias.org/T/#m39b80d45d7d6cfc6b713284365c283579ac94cb1
2022-01-12 21:08:49 +08:00
Ihor Radchenko 34b0d95327
org-in-src-block-p: Do not rely on fontification
* lisp/org.el (org-in-src-block-p): New optional argument ELEMENT.
The code now relies on org-element API to check if we are inside
src-block.

Partially fixes https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
2022-01-12 21:08:41 +08:00
Kyle Meyer fe70c4d259 ox-koma-letter: Collapse space in copyright line
Match the space change made in Emacs's 19dcb237b5b (; Add 2022 to
copyright years, 2022-01-01) to avoid noise when syncing to the Emacs
repo.
2022-01-01 17:47:00 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Ihor Radchenko eb9f34222a
ob-gnuplot: Fix regression from 23d8d59df when ox-org is not loaded
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Require
ox-org, making sure that org export backend is available.
2021-12-27 00:46:00 +08:00
Ihor Radchenko c614234688
ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
backend when exporting table data to plain text table.  ascii backend
incorrectly handles quote transcoders that change the column width and
sometimes throws an error.  (ascii backend simply ignores transcoded
table cells and calculates width based on the initial cell text).
2021-12-27 00:45:39 +08:00
Ihor Radchenko 377d6247af
org-clock-timestamps-down: Fix typo in docstring
Reported in https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-12/msg01841.html
2021-12-25 22:25:24 +08:00