Commit Graph

26840 Commits

Author SHA1 Message Date
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 c7e1f78326
Merge branch 'bugfix' 2023-08-05 16:17:35 +03:00
Ihor Radchenko e4f1274378
test-org-export/activate-smart-quotes: Update tests
* testing/lisp/test-ox.el: Fix inner French quotes.  See f099f84.
2023-08-05 16:16:31 +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 764a306cae
Merge branch 'bugfix' 2023-08-05 11:16:01 +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
Ihor Radchenko 7b80334fda
org-lint-timestamp-syntax: Improve lint message
* lisp/org-lint.el (org-lint-timestamp-syntax): Mention the original
timestamp in the link message.

Reported-by: Fraga, Eric <e.fraga@ucl.ac.uk>
Link: https://orgmode.org/list/87y1iuyb3m.fsf@ucl.ac.uk
2023-08-02 09:31:44 +03:00
Ihor Radchenko 20d90b9790
org-lint-export-option-keywords: Improve message and ignore `org-default-properties'
* lisp/org-lint.el (org-lint-export-option-keywords): Mention which
backends the suspicious properties may belong to.  Avoid triggering on
`org-default-properties'.

Reported-by: Fraga, Eric <e.fraga@ucl.ac.uk>
Link: https://orgmode.org/list/87y1iuyb3m.fsf@ucl.ac.uk
2023-08-02 09:31:21 +03:00
Ihor Radchenko f9d2d92f42
Merge branch 'bugfix' 2023-08-02 08:18:15 +03:00
Ihor Radchenko 6c1ff952fe
Make transient overlay lists permanent-local
* lisp/org-clock.el (org-clock-overlays):
* lisp/org-colview.el (org-columns-overlays):
* lisp/org-num.el (org-num--overlays):
* lisp/org-table.el (org-table-header-overlay):
(org-table-coordinate-overlays):
* lisp/org.el (org-custom-properties-overlays):
(org-occur-highlights):
(org-inline-image-overlays): Mark as permanent-local to not lose track
of the overlays when changing major modes.

Reported-by: Eli Qian <eli.q.qian@gmail.com>
Link: https://orgmode.org/list/871qgmeleu.fsf@gmail.com
2023-08-02 08:16:47 +03:00
Ihor Radchenko 8aa6e8125d
lisp/ob-cal.el: Fix docstrings
* lisp/ob-calc.el (org-babel-execute:calc): Mention all the args.
(org-babel-calc-maybe-resolve-var): Add docstring.
2023-08-02 08:05:29 +03:00
Ihor Radchenko 323a669921
org-string-width: Remove unnecessary dedicated window check
* lisp/org-macs.el (org-string-width): Do not handle dedicated
selected window specially.  The bug fixed by 946abeb49 is no
longer reproducible using the release version of Emacs 29 and other
Emacs versions.  Apparently, it was caused by now-fixed Emacs bug
specific to Emacs 29.

Also, use `buffer-text-pixel-size' as in `string-pixel-width' from
Emacs master.  Using `window-text-pixel-size' requires setting buffer
to window, which is tricky when selected window is dedicated (see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64986).
2023-08-02 08:04:56 +03:00
Ihor Radchenko 884b84f7ad
org-string-width: Adapt Emacs commit 0c29f53ab8723
* lisp/org-macs.el (org-string-width): Make sure that default values
of `line-prefix' and `wrap-prefix' do not affect width calculation.

Link: https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=0c29f53ab8723dd5a9f31ce8a6e913cc08132e56
2023-08-01 10:06:01 +03:00
Ihor Radchenko f03b839530
lisp/ob-awk.el: Fix docstrings
* lisp/ob-awk.el (org-babel-execute:awk):
* lisp/ob-awk.el (org-babel-awk-var-to-awk): Detail all the argument
in the docstring.
2023-07-31 14:17:22 +03:00
Ihor Radchenko f409cb4e52
ox: New option `org-export-expand-links'
* lisp/ox.el (org-export-options-alist): New export option toggling
environment variable expansion in link paths.
(org-export-expand-links): New customization.
(org-export--expand-links): New function expanding environment
variables all the link paths in AST.
(org-export-expand-include-keyword):
(org-export--blindly-expand-include): Add new optional arguments to
expand environment variables in INCLUDE file paths.  Update
docstrings.
(org-export--annotate-info): Call `org-export--expand-links' during
export and pass :expand-links parameter to
`org-export-expand-include-keyword'.
* doc/org-manual.org (Export Settings): Document the new option.
* etc/ORG-NEWS (New export option ~org-export-expand-links~): Announce
new option.

Link: https://list.orgmode.org/orgmode/87pm6fbnlo.fsf@localhost/
2023-07-31 11:24:40 +03:00
Ihor Radchenko 7151481313
org-manual: Automatically generate export option list
* mk/org-fixup.el (org-make-manual):
(org-make-guide):
(org-make-manuals): Allow code evaluation when exporting manuals.
* doc/org-manual.org (Generic properties):
(ASCII specific properties):
(Beamer specific properties):
(HTML specific properties):
(LaTeX specific properties):
(Markdown specific properties):
(ODT specific properties):
(Texinfo specific properties): Build property tables programatically,
from a code block.
2023-07-31 11:23:33 +03:00
Ihor Radchenko 68ba286fee
org-lint-link-to-local-file: Expand environment variables in path
* lisp/org-lint.el (org-lint-link-to-local-file): Try to expand
environment variables in file paths before testing if the linked file
exists.
2023-07-31 11:20:26 +03:00
Kyle Meyer d3f587fadf org-find-open-clocks: Fix recent bug in handling of match data
* lisp/org-clock.el (org-find-open-clocks): Prevent clock match data
from being clobbered by downstream org-element-at-point call.
2023-07-30 17:56:54 -04:00
Jens Schmidt eabc9bfecf
ol-gnus.el: Fix issue when storing links from Gnus article buffers
* lisp/ol-gnus.el (org-gnus-store-link): Switch to
`gnus-summary-buffer' when calling functions that are intended to be
called only there.

Link: https://list.orgmode.org/orgmode/2fa5914d-2cbf-f41f-8be6-e79e77794140@vodafonemail.de
2023-07-30 19:31:58 +03:00
Ihor Radchenko a6f3b24a67
Merge branch 'bugfix' 2023-07-30 12:30:40 +03:00
Ihor Radchenko d1d0c30e65
org-property-value: Define face as non-nil
* lisp/org-faces.el (org-property-value): Set default value to inherit
from `font-lock-string-face' instead of using invalid face value of
nil.

Reported-by: Mauro Aranda <maurooaranda@gmail.com>
Link: https://orgmode.org/list/41956a5a-44c2-c1ea-e1e5-d018a8656e48@gmail.com
2023-07-30 12:29:17 +03:00
Ihor Radchenko dd586c5f42
* lisp/org-macs.el (org-time-convert-to-list): Provide declaration
Update obsolete declaration using the function that is used now.
This fixes native-comp warning.
2023-07-30 12:27:21 +03:00
Ihor Radchenko 01bf57488c
lisp/org.el: Define `org-rear-nonsticky-at' defsubst before its first usage
This fixes compiler warning.
2023-07-30 12:26:49 +03:00
Ihor Radchenko d5006e195a
Merge branch 'bugfix' 2023-07-30 12:22:09 +03:00
Ihor Radchenko da1bc002f2
Backport Emacs commit 670174a6d5f
* lisp/org-macs.el (org-replace-escapes): Suppress byte-compiler
warning about modifying constant string.

Unlike, 39786a8dbf, this commit does not
create merge conflicts.
2023-07-30 12:21:37 +03:00
Ihor Radchenko d38ca59230
ob-gnuplot: Fix links and verbatim when converting tables
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Use custom
backend to export table data.  The backend will export links verbatim,
without trying to resolve them and drop verbatim markers from data
fields.

Reported-by: Paul Stansell <paulstansell@gmail.com>
Link: https://orgmode.org/list/CAMJKaZzHuLxPoTg6FWUgt-U8QSHmuB3Kdqmk_E_0GH+jUZMSag@mail.gmail.com
2023-07-29 11:26:39 +03:00