Commit Graph

18871 Commits

Author SHA1 Message Date
Ihor Radchenko 6954fe93ed
org-store-link: Never allow link duplicates in `org-stored-links'
* lisp/ol.el (org-link-store-existing): Remove the previously added
custom option.
(org-store-link): Do not use `org-link-store-existing' removing all
the code branches for values other than 'move-to-front.
* etc/ORG-NEWS (~org-store-link~ now moves an already stored link to
front of the ~org-stored-links~): Remove reference to the removed
custom option.

Link: https://orgmode.org/list/87leeffd1z.fsf@localhost
2023-08-15 13:48:55 +03:00
Ihor Radchenko 1c00632f11
org-latex-compile--postprocess: Fix when OUTFILE has no directory
* lisp/ox-latex.el: Make sure that we do not pass nil to
`directory-files'.  Use `default-directory' when OUTFILE is like
"file.foo" without any directory component.
2023-08-15 13:13:44 +03:00
Ihor Radchenko 572d01ab7e
Merge branch 'bugfix' 2023-08-15 12:59:18 +03:00
Ihor Radchenko 561c1d0db0
org-element-at-point: Fix cache initialization in indirect buffer
* lisp/org-element.el (org-element-at-point): Always check cache
variable in base buffer.

Reported-by: Adam Beckmeyer <adam_git@thebeckmeyers.xyz>
Link: https://orgmode.org/list/E1qVc9n-0006Ti-92@rmmprod06.runbox
2023-08-15 11:52:26 +03:00
Ihor Radchenko e340dde63e
org-element-export-snippet-parser: Fix when no closing @@
* lisp/org-element.el (org-element-export-snippet-parser): Return nil
when there is no closing @@.
* testing/lisp/test-org-element.el (test-org-element/context): Add
test.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/fb61ea28-f004-4c25-adf7-69fc55683ed4@app.fastmail.com
2023-08-15 11:37:37 +03:00
Ihor Radchenko b89bc55867
org-babel-insert-header-arg: Describe arguments in the docstring
* lisp/ob-core.el (org-babel-insert-header-arg): Fix the docstring,
describing when the arguments do.
2023-08-14 14:59:11 +03:00
Ihor Radchenko 34ee6f1a21
Merge branch 'bugfix' 2023-08-13 19:24:50 +03:00
Ihor Radchenko 99cc9619c5
org-bibtex-yank: Fix bibtex parser not initialized in temp buffer
* lisp/ol-bibtex.el (org-bibtex-yank): Make sure that we parse bibtex
entry from the kill ring in a `bibtex-mode' buffer.  Otherwise,
calling `org-bibtex-read' (that calls `bibtex-parse-entry') may err
because some Bibtex parser variables are not initialized.

Reported-by: J. G. <jerzor@pacbell.net>
Link: https://orgmode.org/list/1939460027.3272000.1691771671040@mail.yahoo.com
2023-08-13 19:21:48 +03:00
Ihor Radchenko 36dcb2a23c
org-babel-combine-header-arg-lists: Describe arguments in the docstring
* lisp/ob-core.el (org-babel-combine-header-arg-lists): Describe all
the header arguments in the docstring.
2023-08-13 13:35:53 +03:00
Ihor Radchenko 70a082c9fb
org-babel-expand-src-block: Mention all the header arguments in the docstring
* lisp/ob-core.el (org-babel-expand-src-block): Explain all the header
arguments in the docstring.
2023-08-12 12:06:12 +03:00
Ihor Radchenko b5aaefb551
org-babel-variable-assignments:eshell: Prevent leaking values into results
* lisp/ob-eshell.el (org-babel-variable-assignments:eshell): Wrap
`setq' eshell call into `ignore' to prevent the variable assignment
values leaking into block output.  Fixes
`ob-eshell/variables-assignment'.
2023-08-12 11:17:15 +03:00
Rudolf Adamkovič 68aa438857
ob-sqlite: Use a transient in-memory database by default
* etc/ORG-NEWS (New features): Add a news entry.
* lisp/ob-sqlite.el (org-babel-execute:sqlite): Default ':db' to
":memory:" instead of throwing an error.
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-file): Test the old behavior.
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-memory): Test the new behavior.
2023-08-12 11:00:48 +03:00
Max Nikulin 2f79c63c2c
org-macs.el: Fix Emacs-26 compatibility
lisp/org-macs.el (org-string-width): Avoid multiple variables in
`setq-local' since it is not supported by Emacs-26.

The code caused the issue was added in 0c29f53ab8723.
2023-08-11 19:24:36 +03:00
Ihor Radchenko cfea24dc15
org-babel-expand-body:generic: Document all the arguments in the docstring
* lisp/ob-core.el (org-babel-expand-body:generic): Document VAR-LINES
in the docstring.
2023-08-11 14:22:28 +03:00
Ihor Radchenko 1c7444dc3a
org-element: Bump AST version
* lisp/org-element.el (org-element-cache-reset): Bump AST version to
avoid clashes with previous caches after bfe1179dc.
2023-08-11 12:48:24 +03:00
Ihor Radchenko bfe1179dcb
org-element: Fix consistency between incremental and recursive parsers
* lisp/org-element.el (org-element--parse-to): Remove numerous special
conditions added to satisfy tests in `test-org-element/at-point'.
They create divergence with `org-element-parse-buffer' by sometimes
parsing inner elements up to beyond parent's :contents-end.  Instead,
modify org-data, section, and headline parsers to make their contents
include trailing blank lines.  This way, `org-element-at-point' will
naturally transcend inside section at the end of a heading.
(org-element-headline-parser):
(org-element-org-data-parser):
(org-element-section-parser): Span :contents-end all the way up to
:end.  Set :post-blank to 0 all the time.  Adjust :robust-end.
(org-element--open-end-p): Remove no longer used function.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/6dd08eb7-9468-402d-bf88-eefb01442b99@app.fastmail.com
2023-08-11 12:09:36 +03:00
Ihor Radchenko 0eb9aa798c
* lisp/ob-R.el: Fix some checkdoc warnings
(org-babel-execute:R):
(org-babel-variable-assignments:R):
(org-babel-R-initiate-session): Mention all the argument in the
docstring.
2023-08-10 13:58:14 +03:00
Ihor Radchenko 6c40983e86
org-with-remote-undo: Update docstring
* lisp/org-macs.el (org-with-remote-undo): Mention all the arguments.
Document that function is not useful outside agenda.
2023-08-09 11:47:07 +03:00
Ihor Radchenko f159adc269
org-element-property: Improve docstring
* lisp/org-element-ast.el (org-element-property): Clarify the meaning
of FORCE-UNDEFER argument.
2023-08-09 10:26:11 +03:00
Ihor Radchenko a18ebc7893
Revert "Avoid creating ID property during tangling"
This reverts commit 0b4e357d62.

The original bug report actually does not need special handling
because (1) some people actually want the "fixed" behavior with IDs
being created; (2) people who don't can set org-id-link-to-org-use-id
to 'create-if-interactive.

See https://orgmode.org/list/87v8e3p5fv.fsf@localhost
2023-08-08 15:54:56 +03:00
Ihor Radchenko 3780948905
lisp/ob-ditaa.el: Fix checkdoc warnings
* lisp/ob-ditaa.el (org-babel-execute:ditaa): Mention all the
arguments in the docstring.  Start error message from capital letter.
2023-08-08 12:38:14 +03:00
Jens Schmidt f689eb44f1
org-make-tags-matcher: Add starred property operators, fix quoting
* lisp/org.el (org-make-tags-matcher): Add starred property operators.
Recognize additional operators "==", "!=", "/=".  Clean up and
document match term parsing.  Remove needless and buggy unquoting of
minus characters in property and tag names.
(org-op-to-function): Recognize additional inequality operator "/=".

* doc/org-manual.org (Matching tags and properties): Add documentation
on starred and additional operators.  Document allowed characters in
property names and handling of minus characters in property names.

* testing/lisp/test-org.el (test-org/map-entries): Add tests for
starred and additional operators.  Add tests for property names
containing minus characters.

* etc/ORG-NEWS: (~org-tags-view~ supports more property operators):
Add announcement on starred and additional operators.

Link: https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a2367d2@vodafonemail.de
2023-08-08 10:01:00 +03:00
Ihor Radchenko 30b747b86d
org-babel-execute:css: Mention arguments in the docstring
* lisp/ob-css.el (org-babel-execute:css): Fix docstring.
2023-08-06 12:10:21 +03:00
Ihor Radchenko da8fabf464
org-delete-indentation: Fix Emacs 26 compatibility
* lisp/org.el (org-delete-indentation): `delete-indentation' in Emacs
26 does not yet accept region boundaries.  Provide compatibility
fallback.
2023-08-06 10:22:18 +03:00
Roshan Shariff 4ea9a98f85
org-macs: Fix incorrect use of relative paths in org-compile-file
* org-macs.el (org-compile-file, org-compile-file-commands): Resolve
symlinks in default-directory before computing relative source path

Commit 5a8a1d4ff [1] changed org-compile-file to use
`file-relative-name` for the SOURCE argument.  This was intended to
fix bug [2] by expanding ~ directories, like a shell.  Unfortunately,
this breaks when DEFAULT-DIRECTORY is a symlink and SOURCE has an
absolute path.

For example, on macOS Ventura, ~/Dropbox is a symlink to
~/Library/CloudStorage/Dropbox.  Suppose DEFAULT-DIRECTORY is
/Users/username/Dropbox and SOURCE is /var/tmp/test.org, so its
relative path is ../../../var/tmp/test.org.  But the working directory
of a compilation process is actually ~/Library/CloudStorage/Dropbox,
relative to which the source path resolves to
/Users/username/var/tmp/test.org.  The process thus cannot find the
source file.

This commit changes `org-compile-file` and its helper function
`org-compile-file-commands` to resolve symlinks in DEFAULT-DIRECTORY
before computing the relative path of SOURCE.  If SOURCE is already
relative, it is used as-is.  The absolute path is processed by
`expand-file-name`, avoiding bug [1].

[1] https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5a8a1d4ff
[2] https://orgmode.org/list/25528.42190.53674.62381@gargle.gargle.HOWL

TINYCHANGE
2023-08-06 09:44:13 +03:00
Ihor Radchenko 8dfd8c987c
org-format-latex: Add FIXME
* lisp/org.el (org-format-latex): Mark `overlay-recenter' call for
removal after Emacs 28 support is dropped.
2023-08-05 16:14:25 +03:00
Ihor Radchenko 0a5dd8cf68
org-babel--file-desc: Update docstring
* lisp/ob-core.el (org-babel--file-desc): Describe all the argument in
the docstring and clarify what the function returns.
2023-08-05 15:09:59 +03:00
Ihor Radchenko 222fdf9c57
Merge branch 'bugfix' 2023-08-05 14:00:18 +03:00
Ihor Radchenko 87b4de9617
org-publish-resolve-external-link: Fix links to non-Org files
* lisp/ox-publish.el: Do not try to call `org-at-heading-p' when not
in Org file.  `org-at-heading-p' and `org-entry-get' may err unless
inside Org buffer.
2023-08-05 13:57:45 +03:00
Ihor Radchenko 453c47b57d
fixup! org-element--cache-for-removal: Fix changing heading granularity
* lisp/org-element.el:
(org-element--cache-for-removal): Explicitly assign :granularity to
not deceive parser when parsing for different granularity than cache.
Cache is always using 'element granularity.

This commit is only needed on bugfix.  On main, :granularity is set
correctly.
2023-08-05 11:14:26 +03:00
Ihor Radchenko 5e378a6e13
org-capture-template-contexts: Improve docstring
* lisp/org-capture.el (org-capture-templates-contexts): Clarify that
function context definition is not a cons cell using example.
2023-08-05 09:53:13 +03:00
Ihor Radchenko 8d6ec48b84
org-end-of-subtree: Fix when inside inlinetask
* lisp/org.el (org-end-of-subtree): Do not consider inlinetasks as
dedicated subtrees.
* testing/lisp/test-org.el (test-org/end-of-subtree): New test.
2023-08-05 09:48:10 +03:00
Bastien 73cb528c24 Merge branch 'bugfix' 2023-08-04 13:08:25 +02:00
Juan Manuel Macias 07f099f84e lisp/ox.el: Fix inner smart quotes in French
* (org-export-smart-quotes-alist): Add correct French second level
quotation marks.
2023-08-04 13:03:03 +02:00
Ihor Radchenko 8dc71d915e
lisp/ob-core.el: Fix some checkdoc warnings
* lisp/ob-core.el (org-babel-where-is-src-block-head): Quote
`match-data'.
(org-babel-insert-result): Ensure two spaces between sentences.
(org-babel-temp-file): Clarify that `temporary-file-directory' refers
to a function.
2023-08-04 11:33:33 +03:00
Ihor Radchenko 6eb117da06
* lisp/ob-core.el (org-babel--expand-body): Document all the arguments 2023-08-04 11:33:18 +03:00
Ihor Radchenko 4fb8ad9990
lisp/ob-core.el: Add some missing docstrings
* lisp/ob-core.el (org-babel-execute-safely-maybe):
(org-babel-execute-maybe):
(org-babel-active-location-p): Add docstrings.
2023-08-04 11:33:01 +03:00
Ihor Radchenko 47b04383e7
fixup! org-id-update-id-locations: Optimize performance
Avoid modifying FILES by side effect.
2023-08-04 10:54:19 +03:00
Ihor Radchenko 11ce194dcf
org-string-width: Fix Emacs <29 compatibility
* lisp/org-compat.el (org-buffer-text-pixel-width): New function using
`buffer-text-pixel-size' in Emacs >=29 and falling back to
`window-text-pixel-size' in older Emacs.
* lisp/org-macs.el (org-string-width): Use the new function.
2023-08-04 10:53:17 +03:00
Ihor Radchenko f5467b53ec
lisp/ob-shell.el: Fix sessions for generic "shell" blocks
* lisp/ob-shell.el (org-babel-prompt-command): Remove variable.
(org-babel-sh-initiate-session): Set prompt according to
`shell-file-name' - either the value set in let-binding provided by
`org-babel-shell-initialize' or using the default Emacs value of
`shell-file-name'.
(org-babel-shell-initialize): Do not set `org-babel-prompt-command'.
Only let-bind `shell-file-name' according to shell variant in src
block.
2023-08-04 09:30:47 +03:00
Ihor Radchenko 5ed2763b15
org-id-update-id-locations: Optimize performance
* lisp/org-id.el (org-id--locations-checksum): New internal variable
holding list of files and their modification times for the last known
ID list.
(org-id-update-id-locations): Do nothing when the ID locations
correspond to the same ID file list and modification times.  Convert
SEEN-IDS to hash table for faster lookup of the duplicates.  Re-enable
element cache.  Avoid queries to heading properties that would force
full parsing.
2023-08-03 16:52:04 +03:00
Ihor Radchenko b11894aa55
org-lint: Use markers instead of line number to track report positions
* lisp/org-lint.el (org-lint--generate-reports): Store marker to
reports as text property in the Line field.
(org-lint--current-marker): New function retrieving marker
corresponding to current report.
(org-lint--jump-to-source): Jump using marker, not line number.

This fixes *Org Lint* report jumping to wrong location when the Org
buffer is edited while going through the report.
2023-08-03 16:03:56 +03:00
Ihor Radchenko 8b9e3be9a9
* lisp/ob-comint.el (org-babel-comint-async-dangling): Fix docstring
Make first line a complete sentence.
2023-08-03 11:45:15 +03:00
Ihor Radchenko 2c4c5fdd8b
Merge branch 'bugfix' 2023-08-03 08:29:54 +03:00
Ihor Radchenko bf45090f4c
org-element--cache-for-removal: Fix changing heading granularity
* lisp/org-element.el (org-element--cache-for-removal): Do not update
heading using object granularity.  `org-element-at-point' parses
headings without :title objects and cache updates should not change
this.
2023-08-03 08:28:01 +03:00
Ihor Radchenko 63e8cac2ca
org-goto-sibling: Fix when called from inlinetask
* lisp/org.el (org-goto-sibling): Do not try to find inlinetask
siblings.  Clarify the docstring.
* testing/lisp/test-org.el (test-org/goto-sibling): New test.
2023-08-02 16:06:02 +03:00
Ihor Radchenko 345d4e09b5
org-insert-drawer: Make sure that point is left inside drawer
* lisp/org.el (org-insert-drawer): Leave and reveal point inside
drawer even when we insert property drawer or drawer around region, as
advertised by the docstring.
2023-08-02 15:42:53 +03:00
Ihor Radchenko 83575624ab
Ensure that clocking drawer is inserted before point
* lisp/org-clock.el (org-clock-find-position): Insert before point
when creating drawers.  This makes sure that newly inserted drawer do
not interfere with user typing.  See f993ecd67.
* lisp/org-clock.el (org-clock-in): Add commentary.
2023-08-02 15:23:06 +03:00
Ihor Radchenko 28b6a231e9
org-element-normalize-contents: Fix when ELEMENT is anonymous
* lisp/org-element.el (org-element-normalize-contents): Use
`org-element-set-contents' to set contents instead of assuming
(TYPE PROP CONTENTS) structure.
2023-08-02 12:04:30 +03:00
Ihor Radchenko 8e2f6d94e9
ob-C: Fix docstrings
* lisp/ob-C.el (org-babel-execute:cpp):
(org-babel-expand-body:cpp):
(org-babel-execute:C++):
(org-babel-expand-body:C++):
(org-babel-execute:D):
(org-babel-expand-body:D):
(org-babel-execute:C):
(org-babel-expand-body:C):
(org-babel-C-execute):
(org-babel-C-expand-C++):
(org-babel-C-expand-C):
(org-babel-C-expand-D):
(org-babel-C-val-to-base-type):
(org-babel-C-var-to-C): Mention all the arguments.
(org-babel-prep-session:C):
(org-babel-load-session:C): Make first line a proper short description
consisting of a single sentence.
2023-08-02 10:42:39 +03:00