Commit Graph

19658 Commits

Author SHA1 Message Date
Ihor Radchenko 341a01a07d
Work around regexp size limitation for large number of link targets
* lisp/ol.el (org-target-link-regexp-limit): New constant defining
maximum regexp limit where `org-target-link-regexp' is still safe to
use without triggering "Regexp too long" error.
(org-target-link-regexps): New variable holding a series of shorter
regexps to be used instead of too long single
`org-target-link-regexp'.
(org--re-list-search-forward): New function like `re-search-forward',
but accepting a list of regexps.
(org--re-list-looking-at): New function like `looking-at', but
accepting a list of regexps.
(org-update-radio-target-regexp): When `org-target-link-regexp' is too
long, set `org-target-link-regexps', partitioning the link target list
into smaller regexps.
* lisp/org-element.el (org-element-link-parser):
(org-element--object-lex):
* lisp/org.el (org-activate-target-links): Use
`org--re-list-search-forward' and `org--re-list-looking-at' when
`org-target-link-regexps' is non-nil.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
tests.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/orgmode/m2lenax5m6.fsf@me.com/
2024-02-29 13:54:41 +03:00
Olivier Lischer dd4d05a159
ob-tangle: Add flag to optionally remove files before writing
* lisp/ob-tangle.el: Add new custom option
`org-babel-tangle-remove-file-before-write'.
(org-babel-tangle): Remove file before writing according to the value
of `org-babel-tangle-remove-file-before-write'.

The variable `org-babel-tangle-remove-file-before-write' adds support
for the current and old behaviour of `org-babel-tangle'.

Link: https://list.orgmode.org/orgmode/877cjzhjtg.fsf@liolin.ch/
Co-authored-by: Ihor Radchenko <yantar92@posteo.net>

TINYCHANGE
2024-02-29 13:41:34 +03:00
Ihor Radchenko 9029470eb9
fixup! oc-basic.el: Drop {...} when rendering Bibtex entries 2024-02-29 13:02:48 +03:00
Ihor Radchenko ac1ed2bf85
lisp/org-colview.el: Fix computing summary with low-level first child
* lisp/org-colview.el (org-columns--compute-spec): Do not assume that
all the children of an entry have the same LAST-LEVEL.  Handle
situation when the first child has lower level:

* Heading
****** Child 1
** Child 2
** Child 3

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87wn8yj2i5.fsf@localhost
2024-02-29 12:57:24 +03:00
Ihor Radchenko d2df9624ce
oc-basic.el: Drop {...} when rendering Bibtex entries
* lisp/oc-basic.el (org-cite-basic--print-bibtex-string): New function
approximately parsing Bibtex strings and dropping {...}.
(org-cite-basic--print-entry): Use the new function.
* testing/examples/Basic.bib:
*
testing/lisp/test-oc-basic.el (test-org-cite-basic/export-bibliography):
Add test.

Reported-by: Dominik Schrempf <dominik.schrempf@gmail.com>
Link: https://orgmode.org/list/CAF+0kSg8O3RQBG1wXoHjMEHwnGFz0gaDkTTSGv+ZaOt4d4myCA@mail.gmail.com
2024-02-29 12:21:08 +03:00
Ihor Radchenko 286a8fb798
org-element-insert-before: Fix return value when setting plain-text
* lisp/org-element-ast.el (org-element-set-element): When setting
plain-text node, return the new node instead of immutable old one.
* testing/lisp/test-org-element.el (test-org-element/set): Add test.
2024-02-29 11:43:52 +03:00
Ihor Radchenko 755fef38f5
Merge branch 'bugfix' 2024-02-28 10:54:50 +03:00
Ihor Radchenko fe9bc9efd1
Update version number for the 9.6.20 release 2024-02-28 10:53:28 +03:00
Ihor Radchenko 80dff08ed1
Fix unescaped \ in docstrings
* lisp/org-macs.el (org-split-string):
* lisp/ox-latex.el (org-latex-guess-babel-language): Fix docstrings,
as revealed by compiler warnings.
2024-02-28 10:52:58 +03:00
Tim Ruffing 356072c1d6
org-agenda: Make sure skipping warning/delay days never increases their number
* lisp/org-agenda.el (org-agenda-get-deadlines, org-agenda-get-scheduled):
Use minimum of warning/delay days specified in timestamp cookie and the
limit specified by `org-agenda-skip-deadline-prewarning-if-scheduled' or
`org-agenda-skip-scheduled-delay-if-deadline`, respectively.
* testing/lisp/test-org-agenda.el (test-org-agenda/skip-deadline-prewarning-if-scheduled):
New test.

Link: https://orgmode.org/list/59e48dfe744dc9409ff47183255bc64e92d26d88.camel@timruffing.de

TINYCHANGE
2024-02-27 15:40:18 +03:00
Ihor Radchenko 8651c83991
Address Emacs 27 warnings
* lisp/org-entities.el (seq): Require seq.el - it is not preloaded in
Emacs <28.
* lisp/org.el (org--image-yank-media-handler): Suppress warning and
throw an error about `file-name-with-extension'.  This function is not
supposed to be called in older Emacs.
2024-02-27 13:34:07 +03:00
Ihor Radchenko 25a51bad2c
Address Emacs 28 warnings
* lisp/oc-basic.el (org-cite-basic--shorten-names): Provide third
argument for `mapconcat'.  It is mandatory in Emacs <29.
* lisp/org.el (org--image-yank-media-handler): Suppress warning and
throw and error in Emacs <29.
(org--dnd-rmc): Do not try to call `use-dialog-box-p' in Emacs <29.
2024-02-27 13:29:00 +03:00
Ihor Radchenko 87c9f9b5db
org-export: Fix exporting visible when org-fold-core-style is 'text-properties
* lisp/org-fold-core.el (org-fold-core--update-buffer-folds): New
function updating buffer folds in copied text for current buffer.
(org-fold-core-decouple-indirect-buffer-folds): Use the new function.
* lisp/org-element.el (org-element--generate-copy-script): Synchronize
folds.
2024-02-27 13:21:36 +03:00
Ihor Radchenko fef873b1cf
org-agenda-get-restriction-and-command: Do not leave window around
* lisp/org-agenda.el (org-agenda-get-restriction-and-command): When
agenda selection is aborted or completed by any means, quit agenda
command selection window.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://list.orgmode.org/orgmode/87il2ai916.fsf@/
2024-02-27 12:18:34 +03:00
Ihor Radchenko 9f6894c106
org-activate-folds: Do not fontify newline after abbreviated links
* lisp/org.el (org-activate-folds): When a fold is created by link
abbreviation, and a link ends at eol, do not force the newline after
the ]] to have the same face as the link.

Reported-by: Rohit Patnaik <quanticle@quanticle.net>
Link: https://orgmode.org/list/6d440976-6747-4ce6-8913-b63931dd017f@app.fastmail.com
2024-02-26 15:52:25 +03:00
Ihor Radchenko 8bac4d386a
org-fold-core-get-folding-spec: Fix edge case
* lisp/org-fold-core.el (org-fold-core-get-folding-spec): When SPEC is
nil, do not rely upon 'invisible property value to determine the fold.
Examine unique property set by `org-fold-region' instead.
2024-02-26 15:51:31 +03:00
Ihor Radchenko 655e97208c
org-element--generate-copy-script: Copy all the overlay properties
* lisp/org-element.el (org-element--generate-copy-script): In buffer
copy, copy over all the overlay properties, not just 'invisible.  This
is needed to copy folding overlays correctly - they use more than just
'invisible property.
2024-02-26 15:51:04 +03:00
Thierry Banel 407a55c1c0
org-table.el: Enhanced table parsing
* lisp/org-table.el (org-table-to-lisp): Refactored.
* etc/ORG-NEWS: Document changes.

`org-table-to-lisp' is significantly faster.
It no longer uses regexps, nor clobbers the global regexp state.
2024-02-25 14:30:38 +03:00
Ihor Radchenko af9100382c
Never pass error message verbatim as the first argument for `message'/`error'
* lisp/org-capture.el (org-capture-store-last-position):
* lisp/org-crypt.el (org-encrypt-entry):
* lisp/org.el (org-open-file): Avoid (error string) code pattern.
Instead use (error "%s" string).  (error string) is erroneous when
STRING contains %-specs.

Reported-by: Corwin Kerr <corwin@corwinkerr.com>
Link: https://orgmode.org/list/beceaf05-ae15-487b-864b-2e23a33a3884@app.fastmail.com
2024-02-25 13:15:04 +03:00
Ihor Radchenko 9daad41ccf
Re-introduce undocumented fontification of example blocks
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Do not assert
that `org-src-fontify-natively' only applies to code blocks.  Allow
other blocks with language specifier to be fontified, but keep this
behavior undocumented.

Reported-by: Rudi C <rudiwillalwaysloveyou@gmail.com>
Link: https://orgmode.org/list/CAE9z9A3ko27NeN0oYFs_aBWV_cUbNm5YQTLrRux16dHsixsMBA@mail.gmail.com
2024-02-25 13:00:12 +03:00
Martin Kampas 37e468cf16
org-bibtex-yank: Allow to populate existing item
Align with `org-bibtex-create'.

* lisp/ol-bibtex.el (org-bibtex-write):
* lisp/ol-bibtex.el (org-bibtex-yank): New optional argument
UPDATE-HEADING to update heading at point instead of creating a new
heading.
(org-bibtex-create): Rename NONEW argument to UPDATE-HEADING.
* etc/ORG-NEWS (~org-bibtex-yank~ accepts a prefix argument):
(New optional argument =UPDATE-HEADING= for ~org-bibtex-yank~):
Announce the change.

Link: https://list.orgmode.org/orgmode/4868155.GXAFRqVoOG@gt1/
2024-02-25 11:50:38 +03:00
Ihor Radchenko 5d186b499d
org-fold: Refactor fontifying newlines after folds
* lisp/org.el (org-activate-folds): New fontification function to
arrange faces at newlines after folds to be the same as face before
the fold.
(org-set-font-lock-defaults): Add the new fontification function.
* lisp/org-fold-core.el (org-fold-core-region): Refresh fontification
of newlines after folds when folding/unfolding.

Reported-by: StrawberryTea <look@strawberrytea.xyz>
Link: https://orgmode.org/list/87plwoqrfv.fsf@strawberrytea.xyz
2024-02-25 11:42:44 +03:00
Rick Lupton 95554543b9
org-id.el: Add search strings, inherit parent IDs
* lisp/ol.el (org-store-link): Refactor org-id links to use standard
`org-store-link-functions'.
(org-link-search): Create new headings at appropriate level.
(org-link-precise-link-target): New function extracting logic to
identify a precise link target, e.g. a heading, named object, or text
search.
(org-link-try-link-store-functions): Extract logic to call external
link store functions. Pass them a new `interactive?' argument.
* lisp/ol-bbdb.el (org-bbdb-store-link):
* lisp/ol-bibtex.el (org-bibtex-store-link):
* lisp/ol-docview.el (org-docview-store-link):
* lisp/ol-eshell.el (org-eshell-store-link):
* lisp/ol-eww.el (org-eww-store-link):
* lisp/ol-gnus.el (org-gnus-store-link):
* lisp/ol-info.el (org-info-store-link):
* lisp/ol-irc.el (org-irc-store-link):
* lisp/ol-man.el (org-man-store-link):
* lisp/ol-mhe.el (org-mhe-store-link):
* lisp/ol-rmail.el (org-rmail-store-link): Accept optional arg.
* lisp/org-id.el (org-id-link-consider-parent-id): New option to allow
a parent heading with an id to be considered as a link target.
(org-id-link-use-context): New option to add context to org-id links.
(org-id-get): Add optional `inherit' argument which considers parents'
IDs if the current entry does not have one.
(org-id-store-link): Consider IDs of parent headings as link targets
when current heading has no ID and `org-id-link-consider-parent-id' is
set.  Add a search string to the link when enabled.
(org-id-store-link-maybe): Function set as :store option for custom id
link property. Move logic from `org-store-link' here to determine when
an org-id link should be stored using `org-id-store-link'.
(org-id-open): Recognise search strings after "::" in org-id links.
* lisp/org-lint.el: Add checker for "::" in ID properties.
* testing/lisp/test-ol.el: Add tests for
`org-link-precise-link-target' and `org-id-store-link' functions,
testing new options.
* doc/org-manual.org: Update documentation about links.
* etc/ORG-NEWS: Document changes and new options.

These feature allows for more precise links when using org-id to link to
org headings, without requiring every single headline to have an id.

Link: https://list.orgmode.org/118435e8-0b20-46fd-af6a-88de8e19fac6@app.fastmail.com/
2024-02-24 15:56:44 +03:00
Rick Lupton 6e7e0b2cd3
lisp/org.el (org-insert-heading): Allow specifying heading level
* lisp/org.el (org-insert-heading): Change optional argument TOP to
LEVEL, accepting a number to force a specific heading level.
* testing/lisp/test-org.el (test-org/insert-heading): Add tests.
* etc/ORG-NEWS: Document changes.
2024-02-24 15:56:43 +03:00
Ihor Radchenko f90322377c
ox: Fix exporting code blocks with missing language specifier
* lisp/ox-latex.el (org-latex-inline-src-block): Export code blocks
without language as verbatim.
* lisp/ox-man.el (org-man-inline-src-block):
(org-man-src-block): Do not try to call source-highlight executable
when code block language is missing.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-texinfo.el (org-texinfo-src-block): Do not throw error when
code block language is missing.

Reproducer (not available on the list):

  To reproduce my problem you can write create an org-mode buffer (C-x b
  1.org M-x org-mode) with the following content:

  #+begin_src lua :tangle yes  :noweb yes
    aaa
    <<second>>
  #+end_src

  #+name: second
  #+begin_src
   bbb
  #+end_src

  Then enable exporting to texinfo and export the buffer:
    M-: (require 'ox-texinfo)
    C-c C-e i t

  The folllowing backtrace appears (providing you already enabled
  debugging on errors):

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    apply(debug error (wrong-type-argument stringp nil))
    edebug(error (wrong-type-argument stringp nil))
    signal(wrong-type-argument (stringp nil))
    edebug-signal(wrong-type-argument (stringp nil))
    string-match("lisp" nil nil t)
    string-match-p("lisp" nil)
    (edebug-after (edebug-before 1) 5 (string-match-p "lisp" (edebug-after (edebug-before 2) 4
  (org-element-property :language (edebug-after 0 3 src-block)))))

Reported-by: pva-outdoor@yandex.ru
Link: https://list.orgmode.org/orgmode/87jzn7oz1u.fsf@yandex.ru/
2024-02-24 12:52:51 +03:00
Ihor Radchenko 505778950a
org-persist: Disable reporting read/write time by default
* lisp/org-persist.el (org-persist--report-time): This information
might be interesting, but not really necessary for users.  At least
one user also asked to disable the time reporting.
2024-02-24 12:39:59 +03:00
Ihor Radchenko 19db45f2cc
org-agenda-filter-by-category: Fix using truncated category as a filter
* lisp/org-agenda.el (org-agenda-format-item): Do not store truncated
category in 'org-category property when `org-agenda-prefix-format'
causes truncation.  This leads to agenda filters assuming truncated
version of the category as the true value, which is incorrect.

Reported-by: John Mathena <jmmathena@gmail.com>
Link: https://orgmode.org/list/CADywB5Lonxw-t1H7cvK+Au3oWq=EsB=Bthj13pt03MRP-Fn-4w@mail.gmail.com
2024-02-24 12:33:27 +03:00
Ihor Radchenko 4b1399fb21
org-goto-map: Do not treat 0-9 as digital arguments by default
* lisp/org-goto.el (org-goto--set-map): Fix 0-9 being interpreted as
digital arguments when `org-goto-auto-isearch' is non-nil.

Reported-by: Pan Xie <xiepan@skyguard.com.cn>
Link: https://orgmode.org/list/5f491471-af08-49d5-a840-6b2f96be54cf@skyguard.com.cn
2024-02-24 12:07:55 +03:00
Ihor Radchenko bfe253f7eb
org-cycle: Fix "Overwriting value of ... by aliasing" warning
* lisp/org-cycle.el:
* lisp/org.el (org-cycle): Move variable aliases right before new
variable name definitions in org-cycle.el.  Otherwise, if users set
the aliased variable values before loading Org-mode, they might get
overwritten by the default value.

Reported-by: Ruiyang Wu <ywwry66@gmail.com>
Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com
2024-02-23 16:24:19 +03:00
Ihor Radchenko 256caa0823
org-cycle: Fix "Overwriting value of ... by aliasing" warning
* lisp/org-cycle.el:
* lisp/org.el (org-cycle): Move variable aliases right before new
variable name definitions in org-cycle.el.  Otherwise, if users set
the aliased variable values before loading Org-mode, they might get
overwritten by the default value.

Reported-by: Ruiyang Wu <ywwry66@gmail.com>
Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com
2024-02-23 16:21:13 +03:00
Ihor Radchenko 24ce9abce7
org-capture-set-target-location: Fix `pcase' conditions
* lisp/org-capture.el (org-capture-set-target-location): Do not demand
file path to be a string in capture targets.  Other non-string values
are also allowed and checked in `org-capture-expand-file' that is
called later.

This commit fixes the changes introduced in 0a58a53ed.

Reported-by: Derek Chen-Becker <derek@chen-becker.org>
Link: https://orgmode.org/list/CAMbmz5nnXY1V1cPObfdw9wyM_GbiuYQ5_rksJ6gcO3Af+HOmSQ@mail.gmail.com
2024-02-23 15:51:11 +03:00
Ihor Radchenko 67d9372487
org-read-date-display: Fix random overlay priority when selection is at today
* lisp/org.el (org-read-date-display): Assign `org-read-date-overlay'
non-default priority.  This makes sure that the overlay is displayed
over the overlay that calendar.el puts to indicate "today".

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0-xbCc6ayEK3v7tKnuGU7=Npgh3raEjuB13qOTN6Eu07Q@mail.gmail.com
2024-02-21 14:15:24 +03:00
Leo Butler b3b35b03ff
lisp/ox-beamer.el: customize the beamer frame environment name
* lisp/ox-beamer.el (org-beamer-frame-environment): A new customize
variable.  It contains the name of an environment that serves as an
alias for the beamer frame environment.

(org-beamer-template): Insert the `org-beamer-frame-environment'
environment definition into the beamer document.

* lisp/org-lint.el (org-lint-beamer-frame): Check the body of each
frame for an occurrence of \begin{orgframe} or \end{orgframe}, or
whatever environment name is in `org-beamer-frame-environment' [4].
The warning includes advice to see `org-beamer-frame-environment'.

* etc/ORG-NEWS (New option ~org-beamer-frame-environment~): Announce
the new option.

Rationale: Code with \begin{frame} or \end{frame} cannot be embedded
in a verbatim environment inside a beamer frame due to a design
decision made by the beamer developers [1].  As suggested in that
report, defining an alias for the beamer frame environment will allow
such verbatim examples to compile correctly [2].

This solution also works with instances of \againframe.

Refs:
[1] https://github.com/josephwright/beamer/issues/360
[2] https://github.com/josephwright/beamer/issues/360#issuecomment-708705250
[3] https://list.orgmode.org/orgmode/87le8eg1hs.fsf@localhost/T/
[4] https://list.orgmode.org/orgmode/87il38i5tb.fsf@localhost/T/
2024-02-21 13:46:32 +03:00
Ihor Radchenko 0dd2c5ea39
Merge branch 'bugfix' 2024-02-19 13:20:47 +03:00
Ihor Radchenko d5b98bcfb5
org-dynamic-block-define: Clarify that FUNC must accept zero arguments
* lisp/org.el (org-dynamic-block-define): Update the docstring.

Reported-by: chris <inkbottle007@gmail.com>
Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos
2024-02-19 13:19:11 +03:00
Ihor Radchenko d6c3ab08b4
org-dynamic-block-insert-dblock: Do not call non-commands interactively
* lisp/org.el (org-dynamic-block-insert-dblock): When insert command
for a dynamic block is not interactive, do not try to call it
interactively.

Reported-by: chris <inkbottle007@gmail.com>
Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos
2024-02-19 13:18:10 +03:00
Martin Edström a8443f2c79
org-latex-to-html-convert-command: Enhance the docstring
* org.el (org-latex-to-html-convert-command): Add a note in the
docstring about proper shell-quoting.

It can trip you up because wrongly quoted input still works with some
math snippets, so the command may work during testing but not later
when you have different math snippets in play.

TINYCHANGE
2024-02-19 11:28:06 +03:00
Ihor Radchenko d314882301
org-narrow-to-subtree: Fix when current narrowing intersects subtree
* lisp/org.el (org-narrow-to-subtree): Fix error when current
narrowing intersects the current subtree.  When intersection happens,
behave historically, like the previous version of the command (that
did not use org-element).
2024-02-18 17:47:18 +01:00
Ihor Radchenko 7360c6b427
Merge branch 'bugfix' 2024-02-18 17:29:35 +01:00
Ihor Radchenko 85aafac417
ox-md.el: Fix adding blank lines between table rows in derived exporters
* lisp/ox-md.el (org-md-separate-elements): Do not add blank lines
between table cells.  Even though table-cell elements are not exported
by ox-md itself, derived backends do not expect blank lines appearing
there.

Reported-by: Rohit Patnaik <quanticle@quanticle.net>
Link: https://orgmode.org/list/d84d5df0-108f-4a75-b7d2-299392613052@app.fastmail.com
2024-02-18 17:25:27 +01:00
Ihor Radchenko ea487bffb5
org-fold-hide-drawer-all: Do not use point and mark when no region is active
* lisp/org-fold.el (org-fold-hide-drawer-all): Do not unconditionally
use point and mark.  Only use region boundaries when the region is
active.
2024-02-18 11:48:50 +01:00
Ihor Radchenko 388ba5b5c4
org-insert-link: Do not expand path arg when `org-link-file-path-type' is a function
* lisp/ol.el (org-insert-link): Drop `expand-file-name'.
(org-link-file-path-type): Update docstring.
* etc/ORG-NEWS (When ~org-link-file-path-type~ is a function, its
argument is now a filename as it  in the link; not an absolute
path): Announce the change.

Link: https://orgmode.org/list/871qahl0un.fsf@localhost
2024-02-17 16:25:19 +01:00
Ihor Radchenko 1cca1967e9
fixup! ox-org: Do not process citations by default
* lisp/ox.el (org-export-process-citations): Add missing defcustom keywords.
2024-02-14 15:36:51 +01:00
Ihor Radchenko 0e1f0e1605
ox-latex: Make errors/warnings during PDF generation more obvious
* lisp/ox-latex.el (org-latex-compile--postprocess): Display a
warning, not message when there are problems with PDF generation.
2024-02-14 15:34:19 +01:00
Juan Manuel Macias 9eec4af620
lisp/ox-latex.el: Add missing character warnings
* (org-latex-known-warnings): Two missing character warnings are
added: one for LuaLaTeX/XelaTeX and another for pdfLaTeX.
2024-02-14 15:29:30 +01:00
Ihor Radchenko 97cc71b594
lisp/org-element.el, lisp/ox.el: Add Ihor Radchenko as a maintainer
* lisp/org-element.el:
* lisp/ox.el:
2024-02-14 13:41:21 +01:00
Ihor Radchenko fd45bfa648
Acknowledge that Nicolas Goaziou is no longer maintaining Org libraries
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-icalendar.el:
* lisp/ox-md.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el: Remove "Maintainer" line.
2024-02-14 13:41:21 +01:00
Ihor Radchenko b8ee1315a1
ox-org: Do not process citations by default
* lisp/ox.el (org-export-options-alist): Add new export option
:with-cite-processors that allows disabling citation processors.
(org-export-process-citations): New customization (t by default)
defining the default value of :with-cite-processors export option.
(org-export-as):
(org-export--annotate-info): Disable citation processors when
:with-cite-processors is nil.
* lisp/ox-org.el (org-org-with-cite-processors): New custom
option (nil by default) controlling whether to use citation processors
when exporting to Org.
(org): Set :with-cite-processors according to the new option.  Declare
transcoders for citation and citation-reference objects.
* doc/org-manual.org (Summary of the export process): Update the
export flow description.
* etc/ORG-NEWS (Org export backends can now disable citation processors):
(=ox-org= disables citation processors by default):
(New option ~org-export-process-citations~):
(New option ~org-org-with-cite-processors~): Document the changes.

The change in ox-org behavior also fixes citation objects being
removed unconditionally from table src block results.

Reported-by: Stanislav Vlasov <S.Vlasov@tilburguniversity.edu>
Link: https://orgmode.org/list/87edrin6jw.fsf@localhost
2024-02-14 13:16:57 +01:00
Ihor Radchenko 666bd90497
fixup! ox-org: Export special table rows by default
* lisp/ox-org.el (org-org-with-special-rows): Add missing keywords for defcustom.
2024-02-14 12:50:17 +01:00
Ihor Radchenko a250fc745f
org-compile-file: Retain all the logs when PROCESS is a list
* lisp/org-macs.el (org-compile-file): When PROCESS is a list of shell
commands, do not erase logs of all but last commands.
2024-02-13 12:59:38 +01:00
Ihor Radchenko 61c235b778
org-element-paragraph-parser: Fix edge case; fix tests
* lisp/org-element.el (org-element-paragraph-parser): Fix edge case
when 🔚 is in the middle of a paragraph.
*
testing/lisp/test-org-element.el (test-org-element/paragraph-parser):
Fix point position in the tests.  Add test case for ending lines of
incomplete blocks/drawers.  Remove test for incomplete dynamic blocks
- they are keywords.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/87o7hiwzma.fsf@localhost
2024-02-13 12:46:58 +01:00
Martin Marshall 38dd882685
org-ctags: Fix regexp to not break radio-target links
* org-ctags.el (org-ctags-tag-regexp): Add left angle-bracket to
excluded characters for tag text.

Link: https://orgmode.org/list/87frxylw33.fsf@martinmarshall.com

TINYCHANGE
2024-02-12 15:04:41 +01:00
Ihor Radchenko f9fc9d95c7
org-export-as: Add reference to export flow in the manual
* lisp/ox.el (org-export-as): Update docstring.
2024-02-12 14:23:51 +01:00
Ihor Radchenko 6ff0de5c3e
ox-org: Export special table rows by default
* lisp/ox.el (org-export-options-alist): New internal plist option -
:with-special-rows.  Defaults to nil.
(org-export--skip-p): Do not skip special table rows when
:with-special-rows is non-nil.
* lisp/ox-org.el (org-org-with-special-rows): New custom option
controlling whether to export special table rows.  t by default.
(org): Use `org-org-with-special-rows' as the value of
:with-special-rows option.
* etc/ORG-NEWS (=ox-org= now exports special table rows by default):
(New option ~org-org-with-special-rows~): Announce the change.
2024-02-12 12:55:37 +01:00
Ihor Radchenko f4f0fc8bda
lisp/org-colview.el (org-columns--compute-spec): Fix columns in inlinetasks
* lisp/org-colview.el (org-columns--compute-spec): When summarizing
columns, limit the length of LVALS vector to maximum (not minimal!)
possible inlinetask depth.
2024-02-11 16:39:11 +01:00
Ihor Radchenko 807bf95c49
lisp/org-colview.el (org-columns): Avoid calling expensive `move-marker'
Just rely on garbage collector to do the right thing.  `move-marker'
significantly slows down column creation.   More than GC.
2024-02-11 16:34:44 +01:00
Ihor Radchenko 7e547fd3b6
org-columns--display-here: Cache result of `substitute-command-keys'
* lisp/org-colview.el (org-columns--read-only-string):
(org-columns--display-here): Cache return value of
`substitede-command-keys' in a variable.  It is otherwise slow to call
it every time a row is displayed.
2024-02-11 16:25:37 +01:00
Ihor Radchenko 2a999b298f
org-columns--display-here: Avoid calling `face-remap-add-relative' when possible
* lisp/org-colview.el (org-columns--display-here): Do not call
`face-remap-add-relative' multiple times in the same buffer.
2024-02-11 16:24:56 +01:00
Ihor Radchenko 01a074d0b5
fixup! Obsolete `org-icompleting-read' and `org-completing-read-no-i'
* lisp/ol.el (org-insert-link):
* lisp/org-ctags.el (org-ctags-find-tag-interactive):
* lisp/ox-odt.el (org-odt-convert-read-params): Remove the remaining
uses and references to ido-mode.  Rely upon built-in Emacs completion
system using the necessary completion backend rather than directly
calling ido functions.

This commit removes leftovers after
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fdbf441560

Reported-by: Martin Marshall <law@martinmarshall.com>
2024-02-11 15:57:27 +01:00
Ihor Radchenko 5be39ff798
Reapply "lisp/org-element-ast.el (org-element-property-raw): Simplify implementation"
This reverts commit 942b4d97c1.

The cause was not this commit, but missing (require 'subr-x).
2024-02-11 15:11:39 +01:00
Ihor Radchenko 112f1c5fcd
lisp/org-element-ast.el: Fix compilation for Emacs 27 2024-02-11 15:10:55 +01:00
Ihor Radchenko c2a58bbd53
org-startup-folded: Make values consistent with #+STARTUP keyword
* lisp/org.el (org-startup-folded): Document all the allowed values in
the docstring.  Allow symbols named the same as #+STARTUP option.
(org-startup-options): Allow `org-startup-folded' to have values
corresponding to the corresponding #+STARTUP options.
2024-02-11 13:40:17 +01:00
Ihor Radchenko bc0e14a1ab
Update version number for the 9.6.19 release 2024-02-11 12:50:12 +01:00
Ihor Radchenko d3a1394270
fixup! org-ctags.el: Fix use of "ctags" executable
* lisp/org-ctags.el (org-ctags-create-tags): Quote spaces and other
special characters in path.
2024-02-10 22:18:20 +01:00
Ihor Radchenko 8c7313d397
org-babel: New babel backend API function org-babel-session-buffer:<lang>
* lisp/ob-core.el (org-babel-session-buffer): New API function that
return session buffer, if such buffer exists and is live.
(org-babel-execute-src-block): Use `org-babel-session-buffer'.
* lisp/ob-lua.el (org-babel-session-buffer:lua):
* lisp/ob-python.el (org-babel-session-buffer:python): Provide API to
retrieve session buffer name.
(org-babel-python-initiate-session-by-key): Use
`org-babel-session-buffer:python'.
* etc/ORG-NEWS (Org babel backends are now expected to define an
additional API function ~org-babel-session-buffer:<lang>~): Declare
the API addition.

Link: https://orgmode.org/list/87r0hr9f3b.fsf@localhost
2024-02-10 21:57:52 +01:00
Jack Kamm 644bf846d6
ob-comint: Make file results from async sessions respect :dir header
* lisp/ob-comint.el (org-babel-comint-async-filter): Set
default-directory before calling `org-babel-insert-result'

https://list.orgmode.org/875xz9o4nj.fsf@localhost/T/#t
2024-02-10 21:57:13 +01:00
Ihor Radchenko 13d0f8bf8e
org-babel-execute-src-block: Force :dir according to live session
* lisp/ob-core.el (org-babel-execute-src-block): Force eval directory
to follow live session buffer, if any.  This is consistent with what
we promise in the manual section "16.4 Environment of a Code
Block">Choosing a working directory.

Link: https://orgmode.org/list/87mssi8ht2.fsf@gmail.com
2024-02-10 21:57:08 +01:00
Ihor Radchenko cbfe1354b3
org-insert-subheading: Never insert sub-heading above current
* lisp/org.el (org-insert-subheading): When at bol, do not insert
heading above (default behavior of `org-insert-heading').  Instead,
force `org-insert-heading' to insert below.  Improve docstring,
explaining how the prefix arguments are used and the new different
with `org-insert-heading'.
* etc/ORG-NEWS (~org-insert-subheading~ no longer inserts a
sub-heading above current when point is at the beginning of line):
Document the breaking change.

Reported-by: Michael Dauer <mick.dauer@gmail.com>
Link: https://list.orgmode.org/CAP7OBx+whiB8Jo_hEcfL6MajDU1EH=E5j0ZOvHB3dPRK+Aj4mQ@mail.gmail.com/
2024-02-10 16:57:59 +01:00
Ihor Radchenko 9ddfb66996
lisp/org.el (org-insert-subheading): Improve docstring 2024-02-10 16:57:42 +01:00
Ihor Radchenko 942b4d97c1
Revert "lisp/org-element-ast.el (org-element-property-raw): Simplify implementation"
This reverts commit cfb48624f3.

The commit is not compatible with Emacs 27, which is still supported.
2024-02-10 16:39:13 +01:00
Gerard Vermeulen 80e7c9f80f
ox-latex: String variables are not file local safe
* lisp/ox-latex.el (org-latex-default-figure-position):
(org-latex-default-quote-environment, org-latex-image-default-scale):
(org-latex-reference-command): File local safe string variables allow
to write Org files allowing to inject any command.

Link: https://list.orgmode.org/ffa77c01d47b15dfc0ae687cab95fb01@posteo.net/
2024-02-10 15:55:44 +01:00
Martin Marshall 981402a93d
org-ctags.el: Fix use of "ctags" executable
* lisp/org-ctags.el (org-ctags-create-tags): Allow file globbing in
`shell-command' invocation of "ctags".

TINYCHANGE
2024-02-10 15:25:08 +01:00
Ihor Radchenko cfb48624f3
lisp/org-element-ast.el (org-element-property-raw): Simplify implementation 2024-02-10 14:07:52 +01:00
Ihor Radchenko 7319136420
org-element-cache-map: Fix when :next-re is provided
* lisp/org-element.el (org-element-cache-map): Fix searching next-re
in move-start-to-next-match.  The if confition was erroneously always
true due to the last `cl-incf'.  Do not map over failing entry when
next-re did not match and continue-flag is set.  Do not move point to
next entry before calling FUNC.
* testing/lisp/test-org.el (test-org/map-entries): Add new test case.
2024-02-09 21:32:54 +01:00
Ihor Radchenko aa3724dbde
org-capture: Obsolete `org-capture-bookmark' in favor of `org-bookmark-names-plist'
* lisp/org-capture.el (org-capture-bookmark):
* lisp/org-compat.el (org-capture-bookmark): Mark obsolete.
* lisp/org-capture.el (org-capture-store-last-position): Add comment
about obsoletion.
* doc/org-manual.org (Using capture): Mention
`org-bookmark-names-plist' instead of `org-capture-bookmark'.

Reported-by: Tim Wichmann <schwurg@arcor.de>
Link: https://orgmode.org/list/87bk8r2ig1.fsf@localhost
2024-02-09 17:47:57 +01:00
Ihor Radchenko 0d77cf8421
org-latex-headline: Prevent footnotes in TOC/footers
* lisp/ox-latex.el (org-latex-headline): When headline contains
footnotes and does not have ALT_TITLE, arrange alternative title that
will appear in TOC and footers to not have any footnotes.

Reported-by: Eric Anderson <kluwak@gmail.com>
Link: https://orgmode.org/list/691643eb-49d0-45c3-ab7f-a1edbd093bef@gmail.com
2024-02-09 17:38:43 +01:00
Ihor Radchenko 27d6f8305c
lisp/ob-comint.el: Introduce a fallback prompt regexp
* lisp/ob-comint.el (org-babel-comint-prompt-regexp-old): New variable
storing the default value of `comint-prompt-regexp' to be used when
the prompt set by Org mode changes for some reason.
(org-babel-comint-fallback-regexp-threshold): New customization to set
the time Org babel waits for comint command to finish until trying
fallback prompt regexp.
(org-babel-comint--set-fallback-prompt): New internal function that
sets the fallback prompt regexp, if there is any available.
(org-babel-comint-with-output):
(org-babel-comint-wait-for-output): Try fallback prompt regexp when we
cannot find comint command end for too long.
* lisp/ob-haskell.el (org-babel-interpret-haskell):
* lisp/ob-ruby.el (org-babel-ruby-initiate-session):
* lisp/ob-shell.el (org-babel-sh-initiate-session):
* lisp/ob-clojure.el (ob-clojure-eval-with-inf-clojure): Set
`org-babel-comint-prompt-regexp-old' when initializing the inferior
shell.
* etc/ORG-NEWS (New option
~org-babel-comint-fallback-regexp-threshold~): Document the new
customization.

Reported-by: Jack Kamm <jackkamm@tatersworld.org>
Link: https://orgmode.org/list/87sf2q9ubd.fsf@gmail.com
2024-02-09 17:35:58 +01:00
Ihor Radchenko 71fbe92c2e
mk: Allow parallel execution
* lisp/Makefile (.NOTPARALLEL): Do not suppress parallel execution.
(all compile compile-dirty):
(compile-single):
(compile-native):
(compile-source):
(compile-slint1):
(compile-slint2): Explicitly declare prerequisites that must be run
sequentially.
* mk/targets.mk (.NOTPARALLEL): Do not suppress parallel execution.
(uncompiled):
(update update2):
(repro): Explicitly declare prerequisites that must be run
sequentially.
2024-02-09 17:15:53 +01:00
Stefan Monnier ecb5b605d7
lisp/org-element-ast.el: Fix compile-time inline expansion
* lisp/org-element-ast.el (org-element--property-idx): Define inline
expansion within `eval-and-compile' to make sure that the expanded is
available at compile time.

See Emacs bug#68851.
2024-02-09 16:31:10 +01:00
Ihor Radchenko 4797ebf834
lisp/org-crypt.el (org-current-level): Fix compiler warning 2024-02-09 13:44:33 +01:00
Ihor Radchenko ee395b9b8e
Add new make target for native compilation
* lisp/Makefile (LISPN): New variable listing all the valid .eln
targets.
(_ORGCM_):
(compile-native):
(native): New compile target.
(%.eln): Rule how to compile .eln files from .el files.
* mk/default.mk (ELN): Command to perform native compilation of a
single .eln file.
* mk/targets.mk (.PHONY):
(CONF_CALL): List the new targets and variables.
(native): Add target.
2024-02-08 20:16:51 +01:00
Ihor Radchenko bfc0cb3723
lisp/org-num.el: Autoload safe variables
* lisp/org-num.el (org-num-face):
(org-num-max-level):
(org-num-skip-commented):
(org-num-skip-footnotes):
(org-num-skip-tags):
(org-num-skip-unnumbered): Autoload variables with :safe
specification.  Without autoloading, if org-num is not loaded,
unexpected warning may be displayed when opening an Org file.

Reported-by: Chang Xiaoduan <drcxd@sina.com>
Link: https://list.orgmode.org/orgmode/87jznf7gqo.fsf@PWRD-20230207OU./
2024-02-08 16:17:34 +01:00
Ihor Radchenko 62956196d0
org-agenda: Fix entries with timestamps without day name
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress): When matching specific date in timestamp,
do not demand that timestamp to contain day name.

Reported-by: Stephen J. Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/874jejrij6.fsf@localhost
2024-02-08 16:01:29 +01:00
Rick Lupton f016545aa1
org-link-search-must-match-exact-headline: Improve docstring
* lisp/ol.el (org-link-search-must-match-exact-headline): Make the
docstring more accurately describe behaviour.

Link: https://list.orgmode.org/87cytdithi.fsf@localhost/
2024-02-08 15:51:10 +01:00
Ihor Radchenko b26745b985
org-agenda: Fix meaning of 'repeated-after-deadline value of `org-agenda-skip-scheduled-if-deadline-is-shown'
* lisp/org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
Move 'repeated-after-deadline value into a new custom option.
(org-agenda-skip-scheduled-repeats-after-deadline): Create a new
custom option to make agenda hide scheduled entries repeated past
deadline.
* lisp/org-agenda.el (org-agenda-get-scheduled): Use the new custom
option.  Do not demand deadline to be actually shown when deciding
whether to skip scheduled repeats past deadline.  This fixes a bug
when repeats continue to be displayed if past deadline is not
displayed within agenda span.
* doc/org-manual.org (Repeated tasks): Adjust manual entry, mentioning
the new custom option.
* etc/ORG-NEWS (~repeated-after-deadline~ value of
~org-agenda-skip-scheduled-repeats-after-deadline~ is moved to a new
customization): Announce the change.
*
testing/lisp/test-org-agenda.el (test-org-agenda/skip-scheduled-repeats-after-deadline):
Add new test.

Reported-by: Morgan Smith <Morgan.J.Smith@outlook.com>
Link: https://orgmode.org/list/874jft6vpj.fsf@localhost
2024-02-07 13:21:34 +01:00
Sławomir Grochowski 18d98ee655
org-colview: Extract functions `org-columns-move-up' & `org-columns-move-down'
* lisp/org-colview.el (org-defkey): Do not use anonymous function as a
binding.
2024-02-06 20:31:01 +01:00
Ihor Radchenko 8ccda1737b
fixup! org-capture-set-target-location: Improve error reporting for malformed target
Reported-by: Zhitao <zhitaao.gong@gmail.com>
Link: https://orgmode.org/list/CACcmFoCvtyGBKR7mTjdQOd-w82wz-xcavnpEVT=6mFOWpo1T1w@mail.gmail.com
2024-02-06 20:02:40 +01:00
Ihor Radchenko 4254a54f88
org-update-parent-todo-statistics: Do not modify buffer unnecessarily
* lisp/org.el (org-update-parent-todo-statistics): When the updated
statistics cookie is unchanged, do not modify buffer.  This prevents
unnecessary queries to element cache.
2024-02-05 22:12:03 +01:00
Pedro A. Aranda Gutiérrez 10d2868c58
org-footnote-new: Add an option to create new anonymous labels
* lisp/org-footnote.el (org-footnote-new, org-footnote-auto-label):
Add symbol `anonymous' to `org-footnote-auto-label'.  With this,
anonymous footnotes will be created.  This is sometimes useful in long
texts.  Mimics \footnote{} in LaTeX.  Modify `org-footnote-new' to
generate anonymous footnotes directly.

* lisp/org.el (org-startup-options): Add `fnanon' to startup options.

* testing/lisp/test-org-footnote.el (test-org-footnote/new-anon): Add
a test for creation of anonymous footnotes.

* etc/ORG-NEWS:
(~org-footnote-new~ can be configured to create anonymous footnotes):
Announce new anonymous footnote support.

* doc/org-manual.org (Summary of In-Buffer Settings): Document
"fnanon" startup option.
2024-02-05 15:38:48 +01:00
Ihor Radchenko 7f5e085cad
org-decrypt-entry: Adjust headline levels in decrypted subtree
* lisp/org-crypt.el (org-decrypt-entry): When decrypted subtree
contains headings with levels below the containing heading, demote
that subtree, so that originally encrypted text remains under the same
parent heading.  This is useful when encrypted heading is promoted.
2024-02-05 14:04:52 +01:00
Ihor Radchenko f4414f5dbb
ox-latex: Fix references to src block results without #+name
* lisp/ox-latex.el (org-latex--label): Consider :results property in
addition to :name property of the datum.  For datums that are results
of evaluation, the label may not only come from #+name keyword, but
can also be duplicated from the generating src block.
(org-latex--wrap-label): Do not limit label to elements with #+name.
Rely on `org-latex--label' to return appropriate label (or nil).

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/6d9db4be5d42236391d5c4e530250ee1@posteo.net
2024-02-05 13:29:05 +01:00
Sławomir Grochowski 0938795fd7
org-colview: Replace anonymous function with `forward-char'
* lisp/org-colview.el (org-defkey): Do not use anonymous function as a
binding.
2024-02-04 17:48:04 +01:00
Ihor Radchenko 0a58a53eda
org-capture-set-target-location: Improve error reporting for malformed target
* lisp/org-capture.el (org-capture-set-target-location): Tighten
matching the template target location when the location value is not
properly formatted.
2024-02-04 14:47:23 +01:00
Ihor Radchenko b2ee10545e
Merge branch 'bugfix' 2024-02-04 14:31:31 +01:00
Ihor Radchenko 1abff38597
org-fontify-extend-region: Fix edge case
* lisp/org.el (org-fontify-extend-region): Extend region for an extra
character, just as `font-lock-extend-jit-lock-region-after-change'
does.  This fixes a reported edge case.

Also, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68849

Reported-by: Kostas Papadakis <papadakis.k@yandex.com>
Link: https://orgmode.org/list/c5fb9f63-185c-4e36-b13f-e887a4a29aae@yandex.com
2024-02-04 14:29:23 +01:00
Ihor Radchenko 97f4ae0c2d
Update version number for the 9.6.18 release 2024-02-04 13:53:02 +01:00
Ihor Radchenko 7a6bb0904d
org-table-justify-field-maybe: Do not leak alignment data from other tables
* lisp/org-table.el (org-table-justify-field-maybe): Make sure that
`org-table-last-alignment' and `org-table-last-column-widths' do not
lea from another table that was re-aligned recently.

Link: https://old.reddit.com/r/emacs/comments/10gegwa/recalculating_an_orgmode_table_causes/
2024-02-03 15:58:41 +01:00
Ihor Radchenko 09ced6d2c2
org-link-plain-re: Improve regexp heuristics
* lisp/ol.el (org-link-make-regexps): Match <...> and <...> balanced
brackets.

This change detects plain links like
http://dx.doi.org/10.1002/(SICI)1521-396X(199901)171:1<239::AID-PSSA239>3.0.CO;2-M
2024-02-03 15:15:46 +01:00
Ihor Radchenko 5cb52f379b
org-html-example-block: Combine :class attributes using space
* lisp/ox-html.el (org-html-example-block): Avoid creating duplicate
class= attributes when example block has #+ATTR_HTML: :class foo.

Multiple class attributes must be combined with space, as per
https://www.w3schools.com/html/html_classes.asp

Reported-by: Joshua Honeycutt <joshua.honeycutt@gmail.com>
Link: https://orgmode.org/list/87fsfxfzex.fsf@localhost
2024-02-03 15:09:11 +01:00
Ihor Radchenko 3f4bdf80cb
Merge branch 'bugfix' 2024-02-02 21:01:30 +01:00
Ihor Radchenko 56748ea4e2
org: Fix security prompt for downloading remote resource
* lisp/org.el (org--confirm-resource-safe): Do not assume that
resource is safe when user replies "n" (do not download).

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/upj6uk$b7o$1@ciao.gmane.io
2024-02-02 20:59:41 +01:00
Ihor Radchenko 844bd9f1f1
lisp/org.el (org-copy-visible): Fix when using overlays for folding 2024-02-02 16:24:16 +01:00
Ihor Radchenko 83bc81b750
lisp/org-list.el (org-list-swap-items): Fix re-folding after swap 2024-02-02 16:23:50 +01:00
Ihor Radchenko 96944e8d43
org-fold-core--process-delayed: Fix delayed folding in killed buffers
* lisp/org-fold-core.el (org-fold-core--process-delayed): Do not fold
when markers point to killed buffers.
2024-02-02 16:23:05 +01:00
Gerard Vermeulen 71fa0014db
lisp/ox-latex.el: make org-latex-prefer-user-labels safe file local
* lisp/ox-latex.el (org-latex-prefer-user-labels): make it a safe file
local variable for consistency with `org-latex-reference-command' and
`org-html-prefer-user-labels' being also safe file local variables.
2024-02-02 14:50:33 +01:00
Ihor Radchenko 344d4624e1
lisp/org-compat.el: Fix compiler warning when make single
* lisp/org-compat.el (org-switch-to-buffer-other-window): Do not use
obsolete macro.  Even with `with-no-warnings', a warning is emitted.
2024-02-02 14:33:01 +01:00
Ihor Radchenko 62c6d5668d
org-fold-core-style: Use 'overlays in Emacs >=29
* lisp/org-fold-core.el (org-fold-core-style): Set default value to
'overlays in newer Emacs versions.  Newer Emacs does not have
performance issues with overlays and using text-properties there is
not beneficial due to numerous issues with most of Emacs code and
third-party packages that assume overlay-based folding.
2024-02-02 14:21:31 +01:00
Ihor Radchenko 40d1352b29
org-babel: Declare :async header argument in the backends that support it
* lisp/ob-R.el (org-babel-header-args:R):
* lisp/ob-python.el (org-babel-header-args:python): Declare async
header argument.
* lisp/ob-shell.el (org-babel-header-args:shell): Add variable.
(org-babel-shell-initialize): Propagate base
`org-babel-header-args:shell' to `org-babel-header-args:<shell-name>'.

Without declaration, org-lint would not recognize :async argument.
2024-02-01 16:15:50 +01:00
Ihor Radchenko 14acf626fe
org: Fontify whole table rows with `org-table-row' face
* lisp/org-faces.el (org-table-row): New face.
* lisp/org.el (org-set-font-lock-defaults): Use ~org-table-row~ face
to fontify the whole table rows, including indentation and newlines.
* etc/ORG-NEWS (Org mode now fontifies whole table lines (including
newline) according to ~org-table~ face): Announce the change.
2024-02-01 15:30:18 +01:00
Ihor Radchenko 402643f194
Merge branch 'bugfix' 2024-02-01 12:45:32 +01:00
Gerard Vermeulen 84f56c47f2
lisp/ox-latex.el: improve org-latex-toc-command docstring
* lisp/ox-latex.el (org-latex-toc-command): specify clearer which
option settings use `org-latex-toc-command'.  This shows also how
to specify a table of contents depth.
2024-02-01 12:44:41 +01:00
Ihor Radchenko 5f22a1be40
org-table-header-set-header: Fix header calculation
* lisp/org-table.el (org-table-header-set-header): Make sure that
Emacs finishes any queued redisplay before calculating window
boundaries.  Do not make assumptions about the same character width of
table lines.
(org-table-row-get-visible-string): Refactor calculation of the visual
text representation.  Inherit all the text properties - in particular,
composition.  Collect non-intersecting overlays into text properties.

Reported-by: Ypo <ypuntot@gmail.com>
Link: https://orgmode.org/list/87a605oyht.fsf@localhost
2024-01-31 15:56:26 +01:00
Eric S Fraga c9ed0388e7
lisp/ox-beamer.el: Add BEAMER_ACT to column definition
* ox-beamer.el (org-beamer--format-block): Process BEAMER_ACT if given
for column block.
2024-01-31 15:26:48 +01:00
Ihor Radchenko d4eaf8fe5f
org-publish-sitemap-file-entry-format: Do not refer to non-existing symbol
* lisp/org-compat.el (org-publish-sitemap-file-entry-format): Update
the docstring.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:07:18 +01:00
Ihor Radchenko f1978ede29
org-odt-get-table-cell-styles: Fix reference to obsolete text property
* lisp/ox-odt.el (org-odt-get-table-cell-styles): Remove reference to
long-obsolete text property used to store table alignment info.
Instead, refer to table alignment cookies described in the manual.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:06:50 +01:00
Ihor Radchenko ad90ff7cb2
lisp/org-table.el: Fix reference to non-existing function
* lisp/org-table.el (org-table--read-column-selection): Fix the
docstring, pointing to the right function that explains the format of
SELECT argument.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:06:30 +01:00
Ihor Radchenko 75b6f2712a
lisp/org-table.el (org-table-copy-down): Fix typo 2024-01-31 14:06:16 +01:00
Ihor Radchenko a5e84c2fb8
org-link-translation-function: Remove reference to removed function
* lisp/ol.el (org-link-translation-function): Remove reference to
no-longer-available `org-translate-link-from-planner' from the
docstring.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:06:03 +01:00
Ihor Radchenko 4aced687b8
lisp/org-tempo.el: Do not refer to removed function in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:05:46 +01:00
Ihor Radchenko ede8294cf7
lisp/ox.el: Fix removed variable in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:05:30 +01:00
Ihor Radchenko fe663b6c80
lisp/org-element-ast.el (org-element--property-idx): Simplify implementation
Reported-by: Stefan Monnier <monnier@iro.umontreal.ca>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68818#11
2024-01-31 14:01:33 +01:00
Ihor Radchenko 03b383df8b
ox-latex: Remove org-latex-line-break-safe
This reverts commit 3f60acff77 and
subsequent relevant comments.

* lisp/ox-latex.el (org-latex-line-break-safe): Remove constant.  The
\\[0pt] is actually not safe to use in some scenarios. We use a
different approach to avoid plain text [...] being interpreted as
LaTeX optional argument - we escape [ like {[}; that's what pandoc
does.
(org-latex-clock):
(org-latex-line-break):
(org-latex-plain-text):
(org-latex-planning):
(org-latex--org-table):
(org-latex--math-table):
(org-latex-table-row):
(org-latex-verse-block):
* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse):
(test-ox-latex/longtable): Remove references to
`org-latex-line-break-safe'.
* etc/ORG-NEWS (=ox-latex=: ~org-latex-line-break-safe~ is removed):
Announce removal.
* lisp/org-compat.el (org-latex-line-break-safe): Make obsolete.

Link: https://orgmode.org/list/878r4jg37s.fsf@posteo.net
2024-01-31 12:35:29 +01:00
Ihor Radchenko bd305ecdf6
ox-latex: Make sure that [text] is not misinterpreted as LaTeX argument
* lisp/ox-latex.el (org-latex-plain-text): Protect plain text starting
from [.  It might be misinterpreted as optional command argument if
previous exported fragment ends with a command accepting such.
*
testing/lisp/test-ox-latex.el (text-ox-latex/protect-square-brackets):
Add new test.

Link: https://orgmode.org/list/87o7dju9vn.fsf@posteo.net
2024-01-31 12:34:21 +01:00
Ihor Radchenko 15e51d7083
lisp/org-persist.el (and): Fix typo
Use `unless' instead of erroneous `when' in the test whether to run
lockfile timer.

Reported-by: Karthik Chikmagalur
2024-01-31 12:18:54 +01:00
Ihor Radchenko afc529b4a0
lisp/org-element-ast.el (org-element-type-p): Simplify implementation
Reported-by: Stefan Monnier <monnier@iro.umontreal.ca>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68818#11
2024-01-30 17:19:05 +01:00
Hunter Jozwiak 86c4038da6
ob-scheme: Allow ob-scheme to accept a remote connection
* lisp/org/ob-scheme.el (org-babel-scheme-get-repl): Introduce two
optional arguments: host and port.  If these are not given, just run
Geiser as before.  In the case when both are given, connect to the
remotely running Scheme process.
* lisp/org/ob-scheme (org-babel-scheme-execute-with-geiser,
org-babel-execute:scheme): Take these  optional arguments into account.
* lisp/org/ob-scheme.el (org-babel-header-args:scheme): Define host
and port header arguments for completion.

TINYCHANGE
2024-01-30 16:42:23 +01:00
Ihor Radchenko da9ac6da1d
Merge branch 'bugfix' 2024-01-30 15:28:02 +01:00
Ihor Radchenko 7de8b3917c
org-todo: Fix tag alignment when title contains a folded link
* lisp/org.el (org-todo): When title contains link, we cannot use
`org-fold-region' to unfold everything - this may cause unexpected tag
alignment when the link is revealed and font-locking is not yet
triggered.  Instead of unfolding everything, just remove outline folds.

Reported-by: Peter Solodov <solodov@gmail.com>
Link: https://orgmode.org/list/413C89C3-25DB-425B-A367-FA683E7ADD05@gmail.com
2024-01-30 15:25:00 +01:00
Ihor Radchenko a5c977b43e
org-cycle-set-visibility-according-to-property: Honor inner VISIBILITY settings
* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Do not ignore :VISIBILITY: properties when parent also has
:VISIBILITY:.
*
testing/lisp/test-org-fold.el (test-org-fold/set-visibility-according-to-property):
Add new test.

Similar to how :VISIBILITY: overrides #+STARTUP folding settings,
child :VISIBILITY: should override parent :VISIBILITY:.

The previous version of the code was skipping child VISIBILITY
property to address
https://lists.gnu.org/r/emacs-orgmode/2019-01/msg00402.html
However, that problem in that bug report was not with child VISIBILITY
property, but rather with previous implementation detail that
`org-reveal' was called prior to setting VISIBILITY. That affected
parent headings as well and no longer a problem.

Reported-by: John Mathena <jmmathena@gmail.com>
Link: https://orgmode.org/list/87tucu99od.fsf@localhost
2024-01-30 14:43:08 +01:00
Ihor Radchenko e2144f5f32
org-publish-sitemap-file-entry-format: Do not refer to non-existing symbol
* lisp/org-compat.el (org-publish-sitemap-file-entry-format): Update
the docstring.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-30 13:41:42 +01:00
Andrew Hyatt f490c1548a
org-agenda: New customization `org-agenda-start-with-archives-mode'
* lisp/org-agenda.el: Add `org-agenda-start-with-archives-mode'.
(org-agenda-mode): Set value of `org-agenda-archive-mode' according to
value of new variable `org-agenda-start-with-archives-mode'.

* doc/org-manual.org: Note new variable in the documentation of
`org-agenda-archives-mode'.

* etc/ORG-NEWS: Note change to add
`org-agenda-start-with-archives-mode'.
2024-01-29 17:56:42 +01:00
Gerard Vermeulen 813614cff4
lisp/org-src.el: complete `org-src-preserve-indentation' docstring
* lisp/org-src.el (org-src-preserve-indentation): Add that this
option is also honored by `org-indent-block'. Remove \\<org-mode-map>
since such forms serve for major mode documentation strings.
2024-01-29 16:50:53 +01:00
Ihor Radchenko 22050243b8
org-update-parent-todo-statistics: Use parser to match statistics cookie
* lisp/org.el (org-update-parent-todo-statistics): Ignore text
matching statistics cookie that is inside verbatim environments or
otherwise not detected by parser.  Leave a single exception for
headline properties for backwards compatibility.
2024-01-29 16:38:07 +01:00
Ihor Radchenko 522d7d0afe
org-odt-get-table-cell-styles: Fix reference to obsolete text property
* lisp/ox-odt.el (org-odt-get-table-cell-styles): Remove reference to
long-obsolete text property used to store table alignment info.
Instead, refer to table alignment cookies described in the manual.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-29 14:38:01 +01:00
Ihor Radchenko 107cbc74a9
ob-python: Set Python shell in Org edit buffer
* lisp/ob-python.el (org-babel-python-associate-session): New function
setting `python-shell-buffer-name' in *Org Src* buffer according to
source block's :session parameter.  This function will be triggered by
`org-src-associate-babel-session'.
* etc/ORG-NEWS (ob-python now sets ~python-shell-buffer-name~ in Org
edit buffers): Announce the change.

Co-authored-by: Liu Hui <liuhui1610@gmail.com>

Link: https://orgmode.org/list/CAOQTW-MdC=jiGf+3bEVtfww+izSZix7csBJ+mZ4eZ2BQHDR42w@mail.gmail.com
2024-01-29 14:29:45 +01:00
Pedro A. Aranda Gutierrez a4a880d1f9
org-latex-default-packages-alist: Refine packages for font management
* lisp/org.el (org-latex-default-packages-alist): Change to refine
font management depending on the latex compiler.

Differentiate between pdflatex and lualatex/xetex
packages for font management.  lualatex/xetex should use
fontspec instead of fontenc/inputenc.  When using
fontspec, you need to load amsmath before fontspec
and you don't need amssymb.
2024-01-29 14:26:30 +01:00
Detlef Steuer da2b61b09e lisp/ox-icalendar.el: Add time-to-live functionality to ox-icalendar
This commit adds functionality for ox-icalendar to set X-PUBLISHED-TTL
in the exported ICS, which advises a subscriber to the exported ICS
file to reload after the given time interval.

* lisp/ox-icalendar.el (org-icalendar-ttl): New option to set
X-PUBLISHED-TTL in exported ICS
(icalendar): Add ICAL-TTL export keyword
(org-icalendar--vcalendar): Add argument for TTL
(org-icalendar-template, org-icalendar-export-current-agenda,
org-icalendar--combine-files): Pass TTL to `org-icalendar--vcalendar'

Co-authored-by: Ihor Radchenko <yantar92@posteo.net>
Co-authored-by: Jack Kamm <jackkamm@gmail.com>
2024-01-28 13:45:41 -08:00
Ihor Radchenko e24ca9fa05
org-switch-to-buffer-other-window: Suppress compiler warning
* lisp/org-compat.el (org-switch-to-buffer-other-window): Suppress
compiler warning - we are using obsolete macro instead obsolete
function.  They will be removed together.
2024-01-28 20:08:53 +01:00
Ihor Radchenko 319563cef7
ob-R, ob-julia: Do not force-start session in Org Src buffers
* lisp/ob-R.el (org-babel-R-associate-session): Set
`ess-gen-proc-buffer-name-function' to associate the right session
buffer if user requests session interaction from inside Org Src edit
buffer.
(org-babel-edit-prep:R): Remove in favor of
`org-babel-R-associate-session'.
* lisp/ob-julia.el (org-babel-julia-associate-session): Implement
analogous functionality.
(org-babel-edit-prep:julia): Remove in favor of
`org-babel-julia-associate-session'.
* etc/ORG-NEWS (~org-edit-special~ no longer force-starts session in R
and Julia source blocks): Document the change.
* lisp/org-src.el (org-src-associate-babel-session): Run
org-babel-<lang>-associate-session even when session is not yet
initiated.

Link: https://orgmode.org/list/87r0ir2ln8.fsf@gmail.com
2024-01-28 20:04:31 +01:00
Ihor Radchenko 5e98599f50
lisp/org-table.el: Fix reference to non-existing function
* lisp/org-table.el (org-table--read-column-selection): Fix the
docstring, pointing to the right function that explains the format of
SELECT argument.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-28 14:50:30 +01:00
Ihor Radchenko ef23b4706b
org-babel-tangle: Do not allow tangling into self
* lisp/ob-tangle.el (org-babel-tangle): Throw an error when trying to
tangle into the org file we tangle from.
* etc/ORG-NEWS (It is no longer allowed to tangle into the same file
as Org source): Document the breaking change.
* testing/lisp/test-ob-tangle.el (ob-tangle/tangle-to-self): New test.
2024-01-26 16:54:04 +01:00
Ihor Radchenko 13bbe6743d
lisp/org-table.el (org-table-copy-down): Fix typo 2024-01-26 15:04:19 +01:00
Jack Kamm 44385f5bc4 lisp/ox-icalendar.el: Add Jack Kamm as maintainer
Link: https://list.orgmode.org/87fryllemw.fsf@localhost/T/#m1d51f9256be03ba0e77256c8442e0ce6776aff1e
2024-01-25 21:01:02 -08:00
Ihor Radchenko 19c90dd947
org-link-translation-function: Remove reference to removed function
* lisp/ol.el (org-link-translation-function): Remove reference to
no-longer-available `org-translate-link-from-planner' from the
docstring.

Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-25 15:22:22 +01:00
Ihor Radchenko 8ec89c53ca
ox-icalendar: Add support for multi-line SUMMARY, LOCATION, and DESCRIPTION
* lisp/ox-icalendar.el (org-icalendar-entry): Use `org-entry-get' to
account for both PROP and PROP+ in SUMMARY, LOCATION, and DESCRIPTION
properties.  Use newline as accumulated value separator.
* etc/ORG-NEWS (iCalendar export now supports multiline =SUMMARY=,
=LOCATION=, and =DESCRIPTION= properties): Announce the breaking
change.
* doc/org-manual.org (iCalendar Export): Add an example in the manual.

Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87o821dv7o.fsf@localhost
2024-01-25 14:20:22 +01:00
Ihor Radchenko 46b9769a02
org-attach-store-link-p: Change default value to 'attached
* lisp/org-attach.el (org-attach-store-link-p): Change the default
value.
* etc/ORG-NEWS (The default value of ~org-attach-store-link-p~ is now
~attached~): Announce the change.
2024-01-25 13:59:58 +01:00
Ihor Radchenko ea529007d7
ox-html: Fix links to targets that do not have a number
* lisp/ox.el (org-export-get-ordinal): Return nil when ELEMENT does
not match PREDICATE.  `ox-html-link' expects this behavior when a link
refers to target that does not have a caption.
* testing/lisp/test-ox.el (test-org-export/get-ordinal): Fix tests.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/7bf1f79071a714750634e76130fe5963@posteo.net
2024-01-25 13:30:35 +01:00
Ihor Radchenko d2986be076
lisp/org-lint.el (org-lint-named-result): Improve accuracy and message
Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/b3dc0bd4368f3db0c7afe136d9f9ca97@posteo.net
2024-01-24 16:47:20 +01:00
Ihor Radchenko 78dc58508d
Obsolete org-switch-to-buffer-other-window and org-no-popups
* lisp/org-compat.el (org-switch-to-buffer-other-window):
(org-no-popups): Move from org-macs.el and mark obsolete.
* lisp/ob-lilypond.el (org-babel-lilypond-execute-tangled-ly):
(org-babel-lilypond-mark-error-line):
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-prepare-window):
(org-agenda-goto):
(org-agenda-open-link):
(org-agenda-clock-goto):
(org-agenda-diary-entry-in-org-file):
(org-agenda-add-entry-to-org-agenda-diary-file):
(org-agenda-show-the-flagging-note):
* lisp/org-attach.el (org-attach):
* lisp/org-capture.el (org-capture-place-template):
(org-capture-fill-template):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-mks):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org-table.el (org-table-edit-field):
(org-table-edit-formulas):
(org-table-show-reference):
* lisp/org.el (org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
* lisp/ox.el (org-export-stack-view):
(org-export--dispatch-ui): Use `switch-to-buffer-other-window'.
* etc/ORG-NEWS (Org mode no longer disallows configuring
~display-buffer-alist~ to open Org popups in other frame): Document
the breaking change.

Reported-by: Jan Seeger
Link: https://orgmode.org/list/87pmr3mfq3.fsf@localhost
2024-01-24 15:00:26 +01:00
Ihor Radchenko b980f7abb8
lisp/org-tempo.el: Do not refer to removed function in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-24 13:24:14 +01:00
Ihor Radchenko 9ef18956bd
org-element: Allow more objects inside citations
* lisp/org-element.el (org-element-object-restrictions): Allow all but
citation, citation-reference, line-break, table-cell, link and
footnote-reference objects inside citations.

Reported-by: M. ‘quintus’ Gülker <post+orgmodeml@guelker.eu>
Link: https://orgmode.org/list/87tu425pla.fsf@guelker.eu
2024-01-24 12:27:15 +01:00
Ihor Radchenko 793cdbea68
fixup! org-fold: Honor :extend face property in folded headings/blocks/drawers 2024-01-22 16:27:06 +01:00
Ihor Radchenko 2ade16bbc2
org-fold: Honor :extend face property in folded headings/blocks/drawers
* lisp/org-fold-core.el (org-fold-core-region): When folding, when the
fold ends at a newline, copy 'face property from the beginning of the
fold, so that the trailing newline after ellipsis does not appear
with different face.  This fixes :extend t in headlines, blocks, and
drawers not being honored when the headlines are folded.

* etc/ORG-NEWS (Folded lines can now extend their face beyond
ellipsis): Announce the change.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65896
2024-01-22 15:43:29 +01:00
Ihor Radchenko dd4fd02995
Allow per-buffer setting of org-link-descriptive via #+STARTUP options
* lisp/org.el (org-startup-options): Add new startup options to set
`org-link-descriptive'.
(org-mode): Move #+startup keyword parsing before setting up link
visibility.
* doc/org-manual.org (Link Format):
(Summary of In-Buffer Settings): Document the new startup option.
* etc/ORG-NEWS (~org-link-descriptive~ can now be set per-buffer via
=#+STARTUP= options): Announce the new feature.

Link: https://orgmode.org/list/87bkst1nfl.fsf@ucl.ac.uk
2024-01-22 13:58:30 +01:00
Ihor Radchenko 6dab5c317d
lisp/ox.el: Fix removed variable in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-22 12:25:04 +01:00
Ihor Radchenko 83696bf21f
org-export-activate-smart-quotes: Fix edge case with multiple secondary strings
* lisp/ox.el (org-export--smart-quote-status): Do not hash quote
status by parent syntax node - it will create clashes when parent has
multiple secondary strings.  Instead, hash by parent + secondary
string property.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
new test case.

Reported-by: William Denton <william@williamdenton.org>
Link: https://orgmode.org/list/TarY7-tR4TEmIu8jawOtTyyi03K93WIg7DsS1eXNylelCy2Hv-6OFNKOMQMukf70Tzf3uO_2F1Qe7xwrzb43SpJc4jxJZLN3W0MioKYbgzI=@williamdenton.org
2024-01-21 13:44:50 +01:00
Ihor Radchenko ac1c72376c
org-open-at-point-global: Match multiline links
* lisp/org.el (org-open-at-point-global): Match multiline links
spanning up to a paragraph.

Reported-by: Omar Antolín Camarena <omar@matem.unam.mx>
Link: https://orgmode.org/list/87o7df7psx.fsf@localhost
2024-01-21 13:17:12 +01:00
Kyle Meyer 6e17ddd334 Merge branch 'bugfix' 2024-01-20 21:33:37 -05:00
Kyle Meyer de060c36d4 Merge branch 'km/from-emacs-29' into bugfix 2024-01-20 21:27:59 -05:00
Stefan Kangas 50183ada86 Backport commit 725a3f32f from Emacs
; Fix typos in symbol names
725a3f32f8ba78ac5fffcd03be5b82cbc2c1b275
Stefan Kangas
Sun Jan 14 15:16:54 2024 +0100
2024-01-20 21:25:59 -05:00
Stefan Kangas 6e0fdd1714 Backport commit 6653ee66c from Emacs
* lisp/ox-latex.el (org-latex-src-block-backend)
(org-latex-engraved-theme): Improve docstring; mention that
engrave-faces is a GNU ELPA package.

Improve two docstrings in ox-latex
6653ee66ca5ebd42322613a09d4c0d2e35af924b
Stefan Kangas
Sun Jan 14 14:52:17 2024 +0100
2024-01-20 21:24:44 -05:00
Ihor Radchenko 037e3b3eb7
lisp/ob-tangle.el (org-babel-detangle): Improve docstring 2024-01-20 19:35:34 +01:00
Ihor Radchenko 92c53f23d3
org-get-outline-path: Drop COMMENT keywords from the outline path
* lisp/org.el (org--get-outline-path-1): Remove comment keyword from
title when current heading is commented.
* testing/lisp/test-org.el (test-org/get-outline-path): Add test.
2024-01-18 15:13:04 +01:00
Ihor Radchenko a19a72f7d3
org-agenda: Fix grid lines when `org-agenda-default-appointment-duration' is non-nil
* lisp/org-agenda.el (org-agenda-add-time-grid-maybe): Let-bind
`org-agenda-default-appointment-duration' to nil when formatting the
grid lines.  Otherwise, `org-agenda-format-item' logic fails to
produce the expected result.
* testing/lisp/test-org-agenda.el (test-org-agenda/time-grid): Add new
test set covering the bug and several simpler cases.
* testing/examples/agenda-file2.org (two): New test file example.

Reported-by: Detlef Steuer <steuer@hsu-hh.de>
Link: https://orgmode.org/list/87edv5fv1w.fsf@localhost
2024-01-17 15:40:24 +01:00
Ihor Radchenko 4ce2ad4eb1
lisp/org.el (org-agenda-files): Avoid duplicates
Duplicate entries in agenda files cause scanning the same file
twice, producing duplicates in the agenda.

Reported-by: Christopher M. Miles <numbchild@gmail.com>
Link: https://orgmode.org/list/65a75fd3.170a0220.be4f3.67c9@mx.google.com
2024-01-17 12:52:37 +01:00
Joseph Turner 0254854eea
lisp/ol.el (org-link-open): Use let-bound :follow function
TINYCHANGE
2024-01-16 14:38:43 +01:00
Ihor Radchenko 87da1ff15b
org-cite-basic-export-citation: Fix prefix/suffix being ignored
* lisp/oc-basic.el (org-cite-basic-export-citation): Honour prefix and
suffix in citation references and citations.
* testing/examples/Basic.bib: New example bibliography used by tests.
* testing/lisp/test-oc-basic.el:
(test-org-cite-basic/parse-bibliography):
(test-org-cite-basic/export-citation): New file, adding tests for
oc-basic processor.

Reported-by: William Denton <william@williamdenton.org>
Link: https://orgmode.org/list/FMaPNvYf_8jqVxcU2L5kgiMuejm0NqK3e9D7CzhSzG-fmESTZKgtAJy1LG_zNDLS6o_oQ-gF_G-6DXlXA2iQ_yAjNjLgeB86JTU46Sv8Wec=@williamdenton.org
2024-01-16 13:38:27 +01:00
Ihor Radchenko e6e8f0933a
org-cite-basic-export-citation: Fix suffix inside brackets (year suffix)
* lisp/oc-basic.el (org-cite-basic-export-citation): Fix formatting
citation reference with brackets.  When year is placed inside
brackets, put the reference suffix outside.
2024-01-16 13:36:18 +01:00
Ihor Radchenko d51723102a
lisp/ox-latex.el: Honor non-list value of `org-latex-caption-above'
* lisp/ox-latex.el (org-latex-generate-engraved-preamble):
(org-latex-latex-environment):  Use
`org-latex--caption-above-p' to query whether an element should have
its caption above.

Reported-by: Mads Bach Villadsen <mbvilladsen@pm.me>
Link: https://orgmode.org/list/m2zfx69uhb.fsf@pm.me
2024-01-16 12:33:01 +01:00
Matthew Trzcinski b79d9dd604 lisp/ob-shell.el: Remove unnecessary prompt template
(org-babel-shell-set-prompt-commands): "posh" is POSIX complaint and
uses PS1 and PS2 to define the shell prompt.  A separate template is
not needed.

Link: https://list.orgmode.org/18cfa388d12.f0069ffe919377.6846036599039377431@excalamus.com/
2024-01-15 20:57:20 +01:00
Ihor Radchenko 38c6eb2b72
ox-latex: Do not use float for inline images inside links
* lisp/ox.el (org-export-insert-image-links): Fix call to
`org-element-set-contents' - setting "nil" literally would put an
actual nil element into contents.
* lisp/ox-latex.el (org-latex--inline-image): Do not use float
environment unless the inline image is a single image inside
paragraph.  The code is adapted with simplifications from
`org-html-standalone-image-p'.
* testing/lisp/test-ox-latex.el (test-ox-latex/inline-image): New
test.

Reported-by: Dr. Arne Babenhauserheide <arne_bab@web.de>
Link: https://orgmode.org/list/878rest3qv.fsf@localhost
2024-01-15 13:52:43 +01:00
Ihor Radchenko 25c786f0fb
Update version number for the 9.6.17 release 2024-01-14 12:50:34 +01:00
Ihor Radchenko c41a89676e
org-next-visible-heading: Fix when moving over non-descriptive link
* lisp/org.el (org-next-visible-heading): Really test for visibility;
not folding.  Some folds may not be invisible - when
`org-link-descriptive' is nil, links are folded yet visible.
* testing/lisp/test-org.el (test-org/next-visible-heading): Add new
test case.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2bk9q7adw.fsf@me.com
2024-01-13 13:35:52 +01:00
Ihor Radchenko 1aa4552e5c
org-indent-drawer, org-indent-block: Update docstring
* lisp/org.el (org-indent-drawer):
(org-indent-block): Document that an error is signaled when not at a
drawer/block.

Reported-by: gerard.vermeulen@posteo.net
Link: https://list.orgmode.org/orgmode/abc9e25cebcba21d941435e5f39e72d9@posteo.net/
2024-01-12 20:17:12 +01:00
Ihor Radchenko 77a1ddd39f
lisp/org-element-ast.el: Fix typos in top comment 2024-01-12 16:23:23 +01:00
stardiviner dea7780d6d
org-fast-tag-selection: Limit the number of displayed tags
* lisp/org.el (org-fast-tag-selection): Do not print tags without
explicit bindings and tags outside groups when the number of displayed
tags exceeds new customization.
* lisp/org.el (org-fast-tag-selection-maximum-tags): Add new custom
option to set maximum tags number for fast tag selection.
(org--fast-tag-selection-keys): New internal variable holding keys
available for auto-assigning tag bindings.
* doc/org-manual.org (org-fast-tag-selection-maximum-tags): Add new
custom option documentation.
* etc/ORG-NEWS: Declare this new custom option.

Co-Authored-by: Ihor Radchenko <yantar92@posteo.net>
Link: https://list.orgmode.org/orgmode/CAL1eYuK7GUx_=47e8+N5Jh+ZJnDexY+CDMUjPjJHNmcMiVVRrQ@mail.gmail.com/
2024-01-12 12:58:46 +01:00
Ihor Radchenko 2708a63714
Merge branch 'bugfix' 2024-01-11 16:34:59 +01:00
Ihor Radchenko 4145ee4211
fixup! org-man-open: Fix shell expansion vulnerability (Emacs bug#66390)
The escaped string is not necessary "\\;id" on Windows/DOS.
2024-01-11 16:34:17 +01:00
Ihor Radchenko fad90df535
Revert "org-table-make-reference: Disable compiler warning"
This reverts commit bdc60fb936.

Apparently, the branch of if used sometimes and that sometimes is
covered by tests.  Strange.  Leave it be for now.
2024-01-11 15:45:09 +01:00
Ihor Radchenko bdc60fb936
org-table-make-reference: Disable compiler warning
* lisp/org-table.el (org-table-make-reference): Comment out the code
that always returns nil, replacing it with explicit nil.  This line is
certainly a fault in logic, but we do not know of any associated bugs.
So, just leave a FIXME to potential future refactoring and avoid the
compiler complaining about this code every time.
2024-01-11 14:18:35 +01:00
Ihor Radchenko d8b0c23d5c
Merge branch 'bugfix' 2024-01-11 14:15:48 +01:00
Ihor Radchenko 6b60b5ac12
fixup! org-man-open: Fix shell expansion vulnerability (Emacs bug#66390) 2024-01-11 14:15:19 +01:00
Ihor Radchenko 6592c766d2
org-agenda-bulk-mark: Fix mark not being visible when column view is active
* lisp/org-agenda.el (org-agenda-bulk-mark): Use 'before-string in the
mark overlay to make sure that higher-priority Org agenda columns
overlay is not making the mark completely invisible.

Link: https://old.reddit.com/r/orgmode/comments/13jbjep/is_it_possible_to_show_a_selection_mark_in/
2024-01-11 14:12:32 +01:00
Ihor Radchenko 8f7efd9d7d
Merge branch 'bugfix' 2024-01-11 13:06:31 +01:00
Ihor Radchenko bc3caa8f90
org-man-open: Fix shell expansion vulnerability (Emacs bug#66390)
* lisp/ol-man.el (org-man-open): Work around Emacs bug#66390.
Implement fix on org side before Emacs commit that fixes the bug.

Link: https://yhetil.org/emacs-bugs/CADwFkmnTMsOM+z0x8FGPGguMtoD9hLrNt9YfbaJ08KPNKW3EbQ@mail.gmail.com/
2024-01-11 13:04:23 +01:00
Ihor Radchenko f22be2878f
org-agenda: Fix hard-coded day lengths when calculating timestamp regexp
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress): Do not assume that all the timestamps have
length of exactly 12 (English).  Use options argument for
`org-time-stamp-format' instead to drop brackets from the timestamp.
2024-01-10 16:07:11 +01:00
Ihor Radchenko d0a917ab23
org-agenda-get-progress: Fix detecting time when todo keyword contains ]
* lisp/org-agenda.el (org-agenda-get-progress): Improve accuracy
matching time inside state note.

The old code failed to match time in
- State "[X]"        from "[ ]"        [2022-10-25 Tue 10:00]

Link: https://old.reddit.com/r/orgmode/comments/ycshlg/orgagendalogmode_does_not_display_time_for/
2024-01-10 16:07:06 +01:00
Ihor Radchenko f9702a09e7
org-fold: Fix edge case when revealing fragile folds breaks some Emacs commands
* lisp/org-fold-core.el (org-fold-core--fix-folded-region): Delay
revealing fragile regions to until the current command is executed.
(org-fold-core--region-delayed): New function to postpone folding to
the time when `post-command-hook' is executed.
(org-fold-core--region-delayed-list): New internal variable holding
delayed fold requests.
(org-fold-core--process-delayed): New function to be used to process
the delayed folds and cleanup `post-command-hook'.
*
testing/lisp/test-org-fold.el (test-org-fold/org-fold-reveal-broken-structure):
Update tests to account for the delayed unfolding.

Reported-by: Sebastian Miele <iota@whxvd.name>
Link: https://orgmode.org/list/875y04yq9s.fsf@localhost
2024-01-09 16:42:42 +01:00
Ihor Radchenko c9e5270bf1
lisp/org.el (org-self-insert-command): Do not skip fragility checks
* lisp/org-fold-core.el (org-fold-core--suppress-folding-fix):
(org-fold-core-suppress-folding-fix): New macro suppressing re-folding
checks.
(org-fold-core--fix-folded-region): Skip re-folding checks when
`org-fold-core--suppress-folding-fix' is non-nil.
* lisp/org.el (org-self-insert-command): Use
`org-fold-core-suppress-folding-fix' to bypass re-folding checks, but
not fragility checks.
*
testing/lisp/test-org-fold.el (test-org-fold/org-fold-reveal-broken-structure):
New test.
2024-01-09 16:40:22 +01:00
Ihor Radchenko 0773f4980c
org-cycle: Throw an error when `org-cycle-max-level' is not positive
* lisp/org-cycle.el (org-cycle): Avoid cryptic regexp error when
`org-cycle-max-level' is not set to positive integer.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25496.14797.512207.593382@gargle.gargle.HOWL
2024-01-09 15:25:50 +01:00
Ihor Radchenko 97951352bb
Fix [[* completion when there is text after point
* lisp/org-pcomplete.el (org-parse-arguments): Parse text between [[*
and point as a single "argument" for pcomplete.  This avoid weird
breakage when treating every space-separated text in the line as an
argument.
(pcomplete/org-mode/searchhead): Do not alter `pcomplete-stub' - it is
no longer necessary as `org-parse-arguments' now takes care about not
including * and ] into the stub.

Warning! pcomplete code is rather tricky and it is not always clear if
Org's approach is not overusing internals of pcomplete.

Reported-by: Ignacio Casso <ignaciocasso@hotmail.com>
Link: https://orgmode.org/list/87ils0lut8.fsf@localhost
2024-01-07 16:50:40 +01:00
Ihor Radchenko 804d032685
Update version number for the 9.6.16 release 2024-01-07 12:25:20 +01:00
Kyle Meyer aab2c94531 Update copyright years for main-only files 2024-01-06 16:06:47 -05:00
Kyle Meyer 72a2db86d9 Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
Kyle Meyer 54acceb971 Merge branch 'km/from-emacs-29' into bugfix 2024-01-06 15:52:07 -05:00
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Ihor Radchenko fa198cbbe4
org-agenda-search-headline-for-time: Ignore all the timestamps in headings
* lisp/org-agenda.el (org-agenda-format-item): When
`org-agenda-search-headline-for-time' is non-nil, exclude timestamps
in headings from searching the time.
(org-agenda-search-headline-for-time): Remove warning about timestamps
in headings from the docstring.
* etc/ORG-NEWS (~org-agenda-search-headline-for-time~ now ignores all
the timestamp in headings): Announce the change.

Reported-by: rameiko87@posteo.net
Link: https://orgmode.org/list/dc5c0aa3748f5d7ad8b79bea674266e7@posteo.net
2024-01-06 13:29:43 +01:00
Ihor Radchenko b6643884cb
ob-R, ob-julia: Use `ess-gen-proc-buffer-name-function' to control session buffer name
* lisp/ob-R.el (org-babel-R-initiate-session):
* lisp/ob-julia.el (org-babel-julia-initiate-session): Do not use the
hack with renaming ESS buffer and instead indicate the session buffer
name to ESS appropriately through `ess-gen-proc-buffer-name-function'.

Link: https://orgmode.org/list/871qb21bp7.fsf@gmail.com
2024-01-05 14:56:21 +01:00
Ihor Radchenko c10a079a2c
org-edit-src-code: Setup Org Src buffer context before running `org-src-mode-hook'
* lisp/org-src.el (org-edit-src-code): Make sure that
`org-coderef-label-format' and `org-src--babel-info' are set before
`org-src-mode-hook' is executed.  Earlier,
`org-src-babel-configure-edit-buffer' that is by default present in
the hook would do nothing as it relies upon `org-src--babel-info'
being set.
2024-01-05 14:33:42 +01:00
Ihor Radchenko b4687fcd69
Revert "lisp/org-src.el: Suppress compiler warnings for obsolete code"
This reverts commit 3b71939903.
2024-01-05 14:31:31 +01:00
Ihor Radchenko 99c9cae25c
Revert "Obsolete `org-src-associate-babel-session' and related functionality"
This reverts commit 7926045ff5.

`org-src-associate-babel-session' is still useful because:

1. It indicates the need to implement session association to babel
   backend (although we still need to make it more clear for backend
   authors in future).

2. It provides infrastructure for more granular control over session
   association for third-party packages.  For example, we might want
   to disabled session association when it can cause unwanted side
   effects, like starting comint process unconditionally (looking at
   ob-R and other ess-based backends).
2024-01-05 14:20:14 +01:00
Ihor Radchenko aeebac3780
lisp/org-id.el: Fix inaccuracy in the commentary
Reported-by: Stephen J. Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/m234vceq40.fsf@cam.ac.uk
2024-01-05 13:31:27 +01:00
Nafiz Islam a27a1b87b5
lisp/org-agenda.el (org-todo-list): Rename variables and format
* lisp/org/org-agenda.el
(org-todo-list): Use `org-today' directly for `calendar-gregorian-from-absolute'.
(org-todo-list): Replace `date' with `today' (`date' is no longer used).
(org-todo-list): Replace `kwds' with `todo-keywords'.
(org-todo-list): Replace `rtn' with `todo-entries'.
(org-todo-list): Replace `rtnall' with `all-todo-entries'.
(org-todo-list): Replace some `and' with `when' and `cond'.
(org-todo-list): Some whitespace changes.

TINYCHANGE
2024-01-04 16:00:07 +01:00
Ihor Radchenko 6d1c1721e3
Merge branch 'bugfix' 2024-01-04 15:15:18 +01:00
Ihor Radchenko 4279b84a1f
org-lint-invalid-cite-export-declaration: Do not warn about not-yet-loaded processors
* lisp/org-lint.el (org-lint-invalid-cite-export-declaration): Fix
false-positive warning when cite processor is not yet loaded.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/a142147a781384402547d49859fa3287@posteo.net
2024-01-04 15:14:19 +01:00
Ihor Radchenko d6117f895c
org-element-cache: Provide Elisp API to store user data inside the cache
* lisp/org-element.el (org-element-cache-store-key):
(org-element-cache-get-key): New functions to store and retrieve data
associated with cached nodes.  The data is stored inside
:fragile-cache and :robust-cache node properties.
(org-element--cache-shift-positions): Clear :fragile-cache when the
contents boundaries are changed.  Optimize when OFFSET is 0.
* lisp/org-element.el (org-element--cache-process-request): Call
`org-element--cache-shift-positions' even for 0 offset to account for
:fragile-cache.
* etc/ORG-NEWS (New API functions to store data within
~org-element-cache~): Announce the new API.
* testing/lisp/test-org-element.el (test-org-element/cache-get-key):
New test.
2024-01-04 14:23:08 +01:00
Alexandre Avanian 3aac00e45d
lisp/org-indent.el: Add hook to run after it initializes a buffer
* lisp/org-indent.el (org-indent-initialize-buffer): Define and call
hook after it initializes a buffer.
* etc/ORG-NEWS: Announce new custom option.

This will allow to enrich org-indent properties without requiring
hacks to detect initialization.
See https://list.orgmode.org/orgmode/5f4cdb77-8f43-4f2d-91a7-bc4ce57df8ad@app.fastmail.com/#r

TINYCHANGE
2024-01-03 16:34:59 +01:00
Ihor Radchenko dfeff03c5a
lisp/org-element-ast.el (org-element-copy): Fix altering source element
* testing/lisp/test-org-element.el (test-org-element/copy): Add new
test case.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/e0252d664af25728243734d67432ad64@posteo.net
2024-01-03 15:57:01 +01:00
Jack Kamm d57d3bd9bb ob-python: Remove :version from variables with :package-version 2023-12-31 10:32:55 -08:00
Jack Kamm 9239b0e8d1 ob-python: Changed options for default Python command
ob-python will now use the same settings as `run-python' when starting
interactive sessions, by default.

* lisp/ob-python.el (org-babel-python-command): Changed to have
additional `auto' option, which is the new default value.
(org-babel-python-command-session): New option to control default
session Python command.
(org-babel-python-command-nonsession): New option to control default
nonsession Python command.
(org-babel-python--command): New function to determine the command to
run Python.
(org-babel-python-initiate-session-by-key): Call `run-python' without
CMD arg.  Instead, set `python-shell-interpreter' and
`python-shell-interpreter-args' from `org-babel-python--command' when
needed.
(org-babel-python-evaluate-external-process): Use
`org-babel-python--command' to start Python.
2023-12-31 08:29:20 -08:00
Ihor Radchenko 478b40d99e
Update version number for the 9.6.15 release 2023-12-31 12:59:12 +01:00
Kyle Meyer f348adce0d Merge branch 'km/from-emacs-29' into bugfix 2023-12-30 22:34:57 -05:00
Stefan Kangas 38ccb77196 Backport commit 55555a6a0 from Emacs
* lisp/org-protocol.el: Minor copy-edits to Commentary.

org-protocol: Minor copy-edits to Commentary
55555a6a0d1d76468f8327972b3cb067b9e35f24
Stefan Kangas
Sat Dec 30 17:53:53 2023 +0100
2023-12-30 22:33:14 -05:00
Jack Kamm d526ab5388 fixup! ob-python: Test and improve robustness for externally started python
*
lisp/ob-python.el (org-babel-python--python-util-comint-end-of-output-p):
Backport python-util-comint-end-of-output-p for emacs28.
(org-babel-python-initiate-session-by-key): Use backported version of
python-util-comint-end-of-output-p.
2023-12-29 08:44:17 -08:00
Jack Kamm d0d838b02e ob-python: Test and improve robustness for externally started python
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Wait
for first prompt for pre-existing python processes.  Document behavior
for pre-existing python processes.
(org-babel-python-initiate-session): Document behavior for
pre-existing python processes.
*
testing/lisp/test-ob-python.el (test-ob-python/session-with-existing-inferior-python):
New test for working with existing python processes.
2023-12-29 07:46:49 -08:00
Ihor Radchenko 996441fd56
lisp/ox-odt.el: Do not alter `auto-mode-alist'
Reported-by: Peter Prevos <peter@prevos.net>
Link: https://orgmode.org/list/87wmtoosru.fsf@prevos.net
2023-12-29 16:33:54 +01:00
Ihor Radchenko 69e746c1e4
lisp/ox-odt.el: Do not open the generated exported file in the background
* lisp/ox-odt.el (org-odt--export-wrap): Do not open the exported file
in the background.  Such behavior is not consistent with the other
export backends and is not documented (users don't know about it).
* etc/ORG-NEWS (ODT export no longer opens the exported file in the
background): Document the breaking change.
2023-12-29 16:33:54 +01:00
Ihor Radchenko d15e52fef4
org-element: Distinguish between [[/path/to]] and [[file:/path/to]] links
* lisp/org-element.el (org-element-link-parser): Record information
whether link type: is implicit or explicitly provided in the input
text.  The information is saved into new link object property
`:type-explicit-p'.
(org-element-link-interpreter): Take into account `:type-explicit-p'
when interpreting link object.
(org-element-cache-version): Bump AST version.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add new test.

Reported-by: Joseph Turner <joseph@ushin.org>
Link: https://orgmode.org/list/87o7e9ei3p.fsf@ushin.org
2023-12-29 15:44:10 +01:00
Justin Vallon 684aff8eeb
org-persist--gc-orphan-p: Fix Emacs 26.1 compatibility
* lisp/org-compat: Add org-assoc-delete-all from compat/compat-27.el.
* lisp/org-persist.el (org-persist--gc-orphan-p): Use
org-assoc-delete-all.

TINYCHANGE
2023-12-28 23:57:02 +01:00
Ihor Radchenko 80ce6152ba
lisp/org-table.el: Improve cell alignment accuracy
* lisp/org-macs.el (org-string-width): Add new optional argument
providing reference face to be used for relative width calculation.
Use `ceiling' when the total string width is a fraction of "a" width.
* lisp/org-table.el (org-table-blank-field):
(org-table-clean-line):
(org-table--shrink-field):
(org-table--align-field):
(org-table-align):
(org-table-justify-field-maybe): Use org-table face as reference for
width calculation.

When org-table face is not default, `org-string-width' may not return
correct width as " " and "-" in the table may not have the same width
as "a" with default face used as reference in `org-string-width'.
With this patch, the width calculation becomes more accurate, although
may still be off if the table faces are customized to be more
piece-mill.

Reported-by: ltmsyvag
Link: https://emacs-china.org/t/org-9-6-5-org/24484
2023-12-28 16:17:03 +01:00
Ihor Radchenko 4ad7ae2520
lisp/org-element-ast.el: Add a comment why no `org-element-properties' 2023-12-25 15:56:03 +01:00
Ihor Radchenko bd9dc32178
org-assert-version: Disable version check in .elc files for built-in Org mode
* lisp/org-macs.el (org-assert-version): Record
`org--inhibit-version-check' during compile time inside
`org-assert-version'.  This way, .elc files generated when compiling
built-in Org mode in Emacs git tree never trigger version mismatch
warning.

Link: https://yhetil.org/emacs-devel/87zfxzdbna.fsf@yahoo.com
2023-12-25 15:50:08 +01:00
Ihor Radchenko 3afae6690f
org-element-with-buffer-copy, org-export-with-buffer-copy: Fix expansion
* lisp/org-element.el (org-element-with-buffer-copy):
* lisp/ox.el (org-export-with-buffer-copy): Make sure that keyword
arguments in the macro are not duplicated into BODY, which happens for
&rest body + &allow-other-keys in `cl-defmacro'.

Reported-by: João Távora <joaotavora@gmail.com>
Link: https://yhetil.org/emacs-devel/CALDnm53p7nXdnbA2PuH-VHL7EeGQUXYy3x_87hp3oj2pkyWS9Q@mail.gmail.com/
2023-12-25 15:50:04 +01:00
Ihor Radchenko f59ac10257
lisp/org-clock.el: Improve some docstrings
* lisp/org-clock.el (org-clock-save-markers-for-cut-and-paste):
(org-clock-select-task):
2023-12-25 10:42:33 +01:00
Ihor Radchenko eadeaa8533
org-assert-version: Disable version check in .elc files for built-in Org mode
* lisp/org-macs.el (org-assert-version): Record
`org--inhibit-version-check' during compile time inside
`org-assert-version'.  This way, .elc files generated when compiling
built-in Org mode in Emacs git tree never trigger version mismatch
warning.

Link: https://yhetil.org/emacs-devel/87zfxzdbna.fsf@yahoo.com
2023-12-24 13:47:04 +01:00
Ihor Radchenko e9ae9dbc54
org-lint.el: Add linter checking for independent keywords prior affiliated
* lisp/org-lint.el (org-lint-regular-keyword-before-affiliated):
(combining-keywords-with-affiliated):

Link: https://orgmode.org/list/87ilpj9lv1.fsf@localhost
2023-12-24 12:43:26 +01:00
Ihor Radchenko b8b02e3da3
org-lint: New linter for named results of evaluation
* lisp/org-lint.el (org-lint-named-result):
(named-result):

Link: https://orgmode.org/list/87ilpj9lv1.fsf@localhost
2023-12-24 12:35:34 +01:00
Ihor Radchenko 52a836b40d
lisp/oc-basic.el (org-element-contents): Add missing declare 2023-12-24 12:24:06 +01:00
Ihor Radchenko cee9b6abc6
Revert "lisp/oc.el (org-cite-parse-elements): Use org-mode buffer for parsing"
This reverts commit 36f61a9c8b.

Because of complex dependencies, it is not easy to properly "require"
`org-element-with-buffer-copy' in oc.el.  So, reverting for now.
2023-12-24 12:18:52 +01:00
Morgan Smith 11e16e5f9e
lisp/org-agenda.el: Check agenda type earlier
lisp/org-agenda.el (org-agenda-goto-date): Check agenda type earlier.
Also remove redundant error.

When this function is run on a todo agenda the user is given the
undescriptive error "(wrong-type-argument listp "todo")" because we
attempt to parse the 'org-last-args text-property prematurely.  With
this change users will get the much better error "Not allowed in
'todo'-type agenda buffer or component".
2023-12-24 12:11:16 +01:00
Ihor Radchenko 7440911e49
Merge branch 'bugfix' 2023-12-24 11:58:52 +01:00
Ihor Radchenko 58c91cbf9f
Update version number for the 9.6.14 release
* lisp/org.el:
2023-12-24 11:57:35 +01:00
Ihor Radchenko af18216738
org-assert-version: Convert to warning. Add info when building Emacs git
* lisp/org-macs.el (org-assert-version): Do not throw an error - it is
preventing Org loading and creating more breakage than the problem it
is trying to solve (the version mismatch is problematic occasionally,
while the error was thrown every single time).  Document what to do
when version mismatch is encountered for Org mode built inside Emacs
git repository.

Link: https://yhetil.org/emacs-devel/83frzsccuy.fsf@gnu.org/T/#t
2023-12-24 11:53:39 +01:00
Sébastien Miquel f280b2178c lisp/ob-python.el (org-babel-python-table-or-string): Small fix
Check for empty results.
2023-12-23 21:19:54 +01:00
Ihor Radchenko 539728840f
ox-latex: Fix exporting longtable with multiline header
* lisp/ox-latex.el (org-latex-table-row): Use all the rows when
constructing header definition.
* testing/lisp/test-ox-latex.el (test-ox-latex/longtable): Add new
test.

Reported-by: Brett Presnell <presnell@member.fsf.org>
Link: https://orgmode.org/list/87mt9zywco.fsf@localhost
2023-12-23 12:03:36 +01:00
Karthik Chikmagalur 6011e7a489
org: Add image alignment
* lisp/org.el (org-image--align, org-image-align,
org-toggle-inline-images): Add the ability to left-align, center
or right-align inline image previews in the Emacs window. This is
controlled globally using the new user option `org-image-align'.
Alignment can be specified per image using the `#+ATTR.*'
affiliated keywords.  The function `org-image--align' determines
the kind of alignment for its argument link.

* lisp/org-lint.el (org-lint-invalid-image-alignment): Add an
org-lint checker to catch invalid ":align" and ":center"
attributes in `#+attr_org' keywords.

* doc/org-manual.org: Document the new feature under the Images
section.
2023-12-21 14:38:06 +01:00
Ihor Radchenko e6bfe3caa8
lisp/org-persist.el: Honor org-persist--disable-when-emacs-Q for gc-lock
Do not run `org-persist--refresh-gc-lock-timer' for emacs -Q.
2023-12-21 11:40:00 +01:00
Ihor Radchenko e469636a6d
org-element-plain-list-interpreter: Do not run mode hooks
* lisp/org-element.el (org-element-plain-list-interpreter): Use
`org-element-with-buffer-copy' and make sure that we do not run user
hooks.  User hooks are often not designed to work in temporary
buffers.  The changed approach also follows similar code elsewhere in
Org code.
2023-12-21 11:39:59 +01:00
Ihor Radchenko 571186631a
lisp/org-macs.el (org-current-text-column): Improve error message
The previous version is apparently not clear enough for some people.

Link: https://list.orgmode.org/412FBC9A-3DA2-48A7-A57F-AA90A40B5BEA@gmail.com/T/#t
2023-12-19 12:51:04 +01:00
Ihor Radchenko e3abcdbf01
lisp/oc-csl.el: Fix some checkdoc warnings
* lisp/oc-csl.el (org-cite-csl-latex-label-separator): Make first line
of the docstring full sentence.  Fix double space between sentences.
(org-cite-csl--create-structure-params): re-fill.
(org-cite-csl--no-citelinks-p): Document the function arguments.
2023-12-19 12:03:16 +01:00
Ihor Radchenko 41726d408b
lisp/oc-basic.el (org-cite-basic--shorten-names): Fix typo
Use normalized NAMES-STRING to shorten names.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2312181114040.123851@shell3.miskatonic.org
2023-12-18 18:13:15 +01:00
Ihor Radchenko 1d72973efa
org-clock-history-push: Improve docstring. Raise error for illegal args
* lisp/org-clock.el (org-clock-history-push): Document all the
function arguments.  Throw an error when BUFFER is provided, but POS
is not.
2023-12-18 11:37:35 +01:00
Ihor Radchenko 5a5ec1b320
lisp/org-persist.el: Do not GC orphan files when another Emacs is running
* lisp/org-persist.el (org-persist-gc-lock-file): New constant naming
the lock file to store active sessions in.
(org-persist-gc-lock-interval): New variable defining session lock
refresh frequency.
(org-persist-gc-lock-expiry): New variable defining which sessions are
considered expired.
(org-persist--refresh-gc-lock): New function refreshing session
timestamp in `org-persist-gc-lock-file'.
(org-persist--gc-orphan-p): New function checking whether orphan files
should be garbage collected.
(org-persist-gc): Use `org-persist--gc-orphan-p'.
(org-persist--refresh-gc-lock-timer): New variable holding timer
refreshing GC lock file.  Run the timer every
`org-persist-gc-lock-interval'.

This patch prevents files created in the other running Emacs sessions
from being garbage-collected.
2023-12-18 11:32:54 +01:00
Ihor Radchenko 2df9642f1d
lisp/ob-maxima.el (org-babel-header-args:maxima): Fix value
The value should be a lists, as in
`org-babel-common-header-args-w-values'.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/3e1e1479365794e2cb3b6d1979e6c98c@posteo.net
2023-12-17 21:03:25 +01:00
Ihor Radchenko 92fec81e2e
lisp/org.el (org-sort-entries): Fix sorting partially selected subtree
* lisp/org.el (org-sort-entries): Make sure that we extend sorted
region to the full subtree if it spans beyond end of region.
* testing/lisp/test-org.el (test-org/sort-entries): Add test.
2023-12-17 14:58:44 +01:00
Ihor Radchenko 67ce9386ad
lisp/org.el (org-sort-entries): Fix when end of region is not a bol
* lisp/org.el (org-sort-entries): Avoid putting a heading not at bol
when end of selected region is not at bol.

Reported-by: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Link: https://orgmode.org/list/8d637a8a-6cbc-4158-bded-f9182716a1fc@posteo.de
2023-12-17 14:57:11 +01:00
Ihor Radchenko bf1d45f9ba
org-lint: Remove checker for #+name with colon
* lisp/org-lint.el (org-lint-colon-in-name):
(colon-in-name): Remove the checker.  It is no longer a problem after
b5cfc311d that allows referring to named elements with name containing
colon.
* testing/lisp/test-org-lint.el (test-org-lint/colon-in-name): Remove
test.
2023-12-17 14:57:03 +01:00
Ihor Radchenko de9f1169d2
lisp/org-element.el (org-src-preserve-indentation-p): Fix declare form 2023-12-16 18:42:23 +01:00
Ihor Radchenko d2ce1c6ec1
lisp/ox-texinfo.el: Fix @menu in headlines without contents
* lisp/ox-texinfo.el (org-texinfo--normalize-headlines): Do not rely
upon undocumented implementation side-effects in `org-element-create'
that have been changed.

*
testing/lisp/test-ox-texinfo.el (test-ox-texinfo/normalize-headlines):
New test.

Reported-by: Jonas Bernoulli <jonas@bernoul.li>
Link: https://orgmode.org/list/87zfybnqwf.fsf@bernoul.li
2023-12-16 15:10:29 +01:00
Ihor Radchenko 8fd21d04ce
lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar): Improve docstring 2023-12-16 12:47:54 +01:00