Commit Graph

25641 Commits

Author SHA1 Message Date
Sajad Hosseini Balef 36c27f11d9 lisp/ox.el: Add Persian/Farsi translation to `org-export-dictionary'
* lisp/ox.el (org-export-dictionary): Add Persian/Farsi translation.

TINYCHANGE
2022-09-25 09:24:59 +02:00
Ihor Radchenko 3b0c4ad207
lisp/org.el: Do not skip loading org-loaddefs when using `eval-buffer'
* lisp/org.e: Do not skip loading "org-loaddefs.el" when Org mode is
loaded through M-x eval-buffer.

Fixes https://orgmode.org/list/874jwyalo1.fsf@localhost
2022-09-25 11:18:29 +08:00
Daniel Kraus 764642f55b ob-clojure.el: Add support for babashka and nbb backend
* lisp/ob-clojure.el: Add support for babashka and nbb backend.
2022-09-25 05:07:28 +02:00
TEC e8a797e143
ob-core: Display babel execution time
* lisp/ob-core.el (org-babel-execute-src-block,
org-babel-format-result): Record the babel execution time, and then
supplement the "Code block evaluation complete." (etc.) messages with
the execution time when >0.05s.
2022-09-24 17:10:58 +08:00
TEC d1c6d02092
ob-core: Display type of element babel executes
* lisp/ob-core.el (org-babel-execute-src-block): The babel execute
function is run on more than just source blocks, so it makes sense to
note the type of element being executed.  A fourth optional argument is
added to allow for explicit specification of the type of element
responsible for the execution.

* lisp/ob-lob.el (org-babel-lob-execute-maybe): Pass the type of the
execution triggering element to `org-babel-execute-src-block'.

* lisp/org.el (org-ctrl-c-ctrl-c): When executing a babel call, pass the
type of the execution triggering element to
`org-babel-execute-src-block'.
2022-09-24 17:10:46 +08:00
TEC 392ccbbf5d
ob-core: Display position of executed babel blocks
* lisp/ob-core.el (org-babel-execute-src-block): When an unnamed babel
block is executed, show the position of the block.

This makes it easier to track the execution without having to name every
block.

ob-core: point

* lisp/ob-core.el (org-babel-execute-src-block):
2022-09-24 17:10:42 +08:00
Ihor Radchenko 0a6a56c804
org-adapt-indentation: Fix 'headline-data checks
* lisp/org.el (org--at-headline-data-p): New function used to check if
element at point belongs to headline data.
(org--get-expected-indentation):
(org-indent-line): Use `org--at-headline-data-p' instead of
explicit (and inaccurate) condition.
* testing/lisp/test-org.el (test-org/indent-region): Add tests.

Fixes incorrect LOGBOOK drawer indentation when
`org-adapt-indentation' is set to 'headline-data.
2022-09-24 14:07:31 +08:00
Ihor Radchenko 9bd8a99a6e
org-agenda-get-sexps: Avoid excessive calls to `org-agenda-skip'
* lisp/org-agenda.el (org-agenda-get-sexps): Only check if entry
should be skipped on matching sexps, when `org-diary-sexp-entry'
returns non-nil.
2022-09-23 23:34:10 +08:00
TEC f0ff1df486
manual: Note undocumented tangle hooks
* doc/org-manual.org (Tangle hooks): Note that the pre-tangle and
tangle-body hooks are undocumented.
2022-09-23 20:14:52 +08:00
TEC 5a96768dfa
manual: Document org-babel-tangle-finished-hook
* etc/ORG-NEWS: Mention new hook, `org-babel-tangle-finished-hook'.

* doc/org-manual.org (Tangle hooks): Mention new hook,
`org-babel-tangle-finished-hook'.
2022-09-23 20:14:52 +08:00
TEC 6a82d17c89
ob-tangle: New tangle-finished hook
* lisp/ob-tangle.el (org-babel-tangle, org-babel-tangle-finished-hook):
Create a new hook, `org-babel-tangle-finished-hook', and run it at the
end of `org-babel-tangle'.
(org-babel-pre-tangle-hook): Update docstring to mention buffer the hook
is run in, to match the docstring of `org-babel-tangle-finished-hook`.
2022-09-23 20:14:52 +08:00
Ihor Radchenko d240386c10
org-diary-sexp-entry: Re-use cached nil return values
* lisp/org.el (org-diary-sexp-entry): Do not consider cached nil
return values as if they are not cached.
2022-09-23 12:57:13 +08:00
Ihor Radchenko 9dde82411a
org-table: Prevent Emacs from merging displayed separator spaces
* lisp/org-table.el (org-table-separator-space): Remove.
(org-table--separator-space-pre):
(org-table--separator-space-post): Use non-`eq' spaces as table cell
boundaries.  This way, Emacs display engine will not merge the two
spaces with `eq' 'display properties in empty table cells.

(org-table--make-shrinking-overlay):
(org-table--align-field): Use the new constants for table alignment.

Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45915
2022-09-22 20:00:03 +08:00
TEC ae2140b1e6
org-manual: Fix typo in beamer example
* doc/org-manual.org (Beamer specific syntax): Fix closing keyword of
the beamer export example.
2022-09-22 14:48:37 +08:00
Ihor Radchenko 6a5f67567e
fixup! org-agenda-get-sexps: Improve performance 2022-09-22 12:33:59 +08:00
Ihor Radchenko d4fde298b9
org-agenda-get-sexps: Improve performance
* lisp/org-agenda.el (org-agenda-get-sexps): Remove trailing
whitespaces in SEXP-ENTRY via buffer movements.  It is faster than
re-creating string objects in `org-trim'.
2022-09-22 10:57:20 +08:00
Ihor Radchenko 4657cea495
org-agenda-get-timestamps: Improve performance
* lisp/org-agenda.el (org-agenda-get-timestamps): Pass element at
point to `org-agenda-skip'.
2022-09-22 10:56:24 +08:00
Ihor Radchenko 3e3588dc75
org-agenda-skip: Improve performance
* lisp/org-agenda.el: Remove unnecessary variable assignment.  Prefer
checking ELEMENT type over regexp match when checking if we are inside
comment.  Postpone let-binding until it is strictly necessary.
2022-09-22 10:55:05 +08:00
stardiviner 95df82c5fc
org.el: Support subtree-level org-image-actual-width overriding
* lisp/org.el (org-display-inline-image--width): Support new property
"ORG-IMAGE-ACTUAL-WIDTH" overriding global variable
`org-image-actual-width'.
2022-09-21 15:45:30 +08:00
Rudolf Adamkovič c940b460c7
ox-texinfo: Include LaTeX in Texinfo exports
* lisp/ox-texinfo.el (org-texinfo-with-latex): New customize.
* lisp/ox-texinfo.el (org-texinfo-latex-environment): New function.
* lisp/ox-texinfo.el (org-texinfo-latex-fragment): New function.
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): New function.
* lisp/ox-texinfo.el (org-texinfo-supports-math--cache): New variable.
* lisp/ox-texinfo.el (texinfo): Set latex-environment.
* lisp/ox-texinfo.el (texinfo): Set latex-fragment.
* testing/lisp/test-ox-texinfo.el: Add basic tests.
2022-09-21 15:29:50 +08:00
Ihor Radchenko 4075662c29
org-diary-sexp-entry: Cache results
* lisp/org.el (org--diary-sexp-entry-cache): New variable holding
cached return values of `org-diary-sexp-entry'.
(org-diary-sexp-entry): Use `org--diary-sexp-entry-cache'.
2022-09-21 12:42:34 +08:00
Ihor Radchenko c35a856048
org-in-archived-heading-p: Improve performance
* lisp/org.el (org-in-archived-heading-p): Use explicit `while' loop
instead of `org-element-lineage'.
2022-09-21 12:26:53 +08:00
Ihor Radchenko e9bd219e35
org-element--cache-verify-element: Improve performance
* lisp/org-element.el: Remove unconditional checks when verification
is disabled.  Do not call costly `derived-mode-p' and unnecessary
`org-element-property'.
2022-09-21 12:26:49 +08:00
Ihor Radchenko 7e9d927298
org-element--cache-active-p: Improve performance
* lisp/org-element.el (org-element--cache-active-p): Remove expensive
`derived-mode-p' call.  Reshuffle the conditions to avoid costly
`memq' call as much as possible.  Inline the function.
2022-09-21 12:26:43 +08:00
Ihor Radchenko f1a197401c
org-fold-core-regions: Avoid multiple evaluation of argument
* lisp/org-fold-core.el (org-fold-core-regions): Evaluate RELATIVE
once.
2022-09-20 20:01:34 +08:00
Ihor Radchenko 0057cc21e1
Improve agenda performance
* lisp/org-agenda.el (org-agenda-skip): Make use of ELEMENT argument
when calling `org-in-src-block-p'.
(org-agenda-get-sexps): Pass actual element at point to `org-agenda-skip'.
* lisp/org.el (org-end-of-subtree): Avoid unnecessary call to
`org-back-to-heading-or-point-min' when ELEMENT is provided.
2022-09-20 19:19:51 +08:00
Ihor Radchenko a526ea6a3e
Fix compiler warnings
* lisp/oc-basic.el (org-cite-basic--set-keymap): Do not use
`buffer-substring' generalized variable.  It is obsolete in Emacs 29.
Explicitly call `delete-region' + `insert'.
* lisp/org-agenda.el (org-element-lineage): Declare function.
* lisp/org.el (org--align-node-property): Use `delete-region' instead
of `buffer-substring' generalized variable.
2022-09-20 11:26:50 +08:00
TEC be2246a550
ox-latex: Change lost in conflict resolution
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): Amends
795783d644 where the number of arguments
`org-latex-generate-engraved-preamble' takes was reduced to 1, but the
change to the defun line was lost during conflict resolution.
2022-09-18 21:46:04 +08:00
TEC 4d8d7d6cb4
ox-latex: Fix string/symbol engraved-preamble val
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): The type of
engraved-theme could be a string or a symbol, depending on whether the
default value was used.  This can lead to type issue bugs.  It is better
to have the same type, so let's intern as needed to consistantly have
symbols.
2022-09-17 18:29:57 +08:00
TEC 795783d644
ox-latex: Remove unused argument
* lisp/ox-latex.el (org-latex-template,
org-latex-generate-engraved-preamble): The second argument of
`org-latex-generate-engraved-preamble' is only ever t, so there's not
much point in having it.

* lisp/ox-beamer.el (org-beamer-template): Update to not call
`org-latex-generate-engraved-preamble' with the second argument.
2022-09-17 18:29:55 +08:00
TEC 1061db94ac
org: Tweak styling of url in resource prompt
* lisp/org.el (org--confirm-resource-safe): Style domain with a link,
and url with an underline.
2022-09-17 18:26:00 +08:00
TEC 1ae801e9c8
org: Add "mark domain as safe" convenience action
* lisp/org.el (org--confirm-resource-safe): Pick out domains from URLs,
and provide an option of marking that domain as safe.
2022-09-17 18:26:00 +08:00
TEC 62a52b56bc
Update my maintainer email
* lisp/ox-html.el: Update my email.

* lisp/org-plot.el: Update my email.
2022-09-17 18:26:00 +08:00
Ihor Radchenko cb8bf4a0d0
org-babel-expand-references: Fix :noweb-ref expansion
* lisp/ob-core.el (org-babel-expand-noweb-references): Do not rely on
reference cache being populated as a condition that all the references
in buffer have been processed.  Set this information explicitly.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add new test.
2022-09-17 15:52:24 +08:00
Ihor Radchenko 8cc821bda2
org-agenda-get-sexps: Query headline at point once in skip function
* lisp/org-agenda.el (org-agenda-get-sexps): Provide headline at point
for `org-agenda-skip'.
2022-09-16 12:32:34 +08:00
Ihor Radchenko 1de67d0b41
org-element--cache-sync: Quit early when no cache requests are queued
* lisp/org-element.el (org-element--cache-sync): Check
`org-element--cache-sync-requests' value early and quit if there are
none.  This reduces the number of conditions checked when the request
queue is empty.
2022-09-16 12:31:32 +08:00
Max Nikulin 6d8d7fba61
ol.el: Mention that `org-insert-link' may edit existing link
* lisp/ol.el (org-insert-link): Add completion by description and edit
link features to the docstring.
2022-09-16 11:49:06 +08:00
Max Nikulin 69b36beac7
ol.el: Always prompt for description in `org-insert-link'
* lisp/ol.el (org-insert-link): Do not bypass code trying to generated
description and prompt user when link path and description are
identical.  Make behavior of description prompt more consistent.

Remove confusing `auto-desc' local variable.  Originally the variable
was added with implementation of completion of stored link target by the
description in the commit 1e34c5d34 Bastien Guerry, "org.el: Fontify
links to current buffer when inserting a link",
2012-08-03 14:08:20 +0200.  The feature was broken soon by the commit
7f096ad37 Tony Day, "org-insert-link: Use ido when inserting links",
2012-10-12 14:39:53 +1100.  Last decade users were not asked to edit
description in the case of the same link target and description
(a remained side effect of 1e34c5d34).  Recent commit 0432f4fe6 Max
Nikulin, "ol.el: Restore complete by description for insert link",
2022-09-10 17:23:13 +0700 restored completion by description.
Due to the commit 4fc2c8dd8 Ihor Radchenko, "org-store-link: Default to
empty description for target/custom-id links", 2022-08-10 13:25:26 +0800
description identical to link path became a more rare case.

An alternative would be fixing condition to allow users to edit
description when it is the same as the path, but use stored description
without additional interaction when the link is chosen by description
completion.  Despite it was likely the original intention, always asking
the user to confirm or edit description may be more consistent behavior.
2022-09-16 11:49:05 +08:00
Ihor Radchenko e3348ccc03
org-batch-test-init: Remove dead code
* testing/org-batch-test-init.el (lambda): Remove the code that has
never been working.  One could still rewrite the code using
`autoloadp', but it would break things terribly and should not be
needed as autoload does not need to be updated after changing the
`load-path'.  See
https://orgmode.org/list/jwvedwczhbv.fsf-monnier+emacs@gnu.org
2022-09-16 11:33:26 +08:00
Ihor Radchenko 6074a22bcb
testing: Address FIXMEs identified in 1a5e3f931
* testing/lisp/test-ob.el (test-ob/blocks-with-spaces):
(test-ob/specific-colnames):
* testing/lisp/test-oc.el (test-org-cite/export-capability):
* testing/lisp/test-ol.el (test-org-link/store-link):
* testing/lisp/test-org.el (test-org/set-regexps-and-options):
* testing/org-test.el (org-test-base-dir): Address typos and
non-existent variables.

(missing-test-dependency): Use `define-error'.
(org-test-load): Set `org-id-locations-file' when running tests.

* testing/lisp/test-ox.el (test-org-export/bind-keyword): Clarify
about variable symbol defined inside setupfile #+BIND statemtn.
2022-09-16 11:30:16 +08:00
Ihor Radchenko 17b51973bd
* lisp/org.el (org-log-beginning): Fix parens 2022-09-15 19:23:52 +08:00
Stefan Monnier 1a5e3f931c
testing: Make all files use `lexical-binding`
Mainly, add the corresponding cookie, but also add various `require`s
so that the compiler knows which vars should be trated as dynbound.
This does not fix all the warnings, but does try to eliminate
all those about "unused" variables.  For the variables truly unused,
the patch usually adds an underscore to their name to silence the warning.

Some of the fixes affect files which already used `lexical-binding`.
Not sure why the test worked before: maybe because the tests were run
without compiling them first (which could cause some of the
missing `require`d packages to be autoloaded before we got to the
problematic code, thus hiding the problem)?

I found some suspicious code, for which I added FIXMEs.

There are also a few changes to the main files.

* lisp/org-protocol.el (org-protocol-check-filename-for-protocol):
Don't call `server-edit` if it's not yet defined.  [ Needed to get
the tests to pass. ]

* lisp/ob-core.el (org-babel-temporary-directory)
(org-babel-temporary-stable-directory): Always define (and use nil
if we don't want to create a directory for it).  Simplify the code based
on the fact that (defvar V E) only evaluates E if V is not yet `boundp`.
(org-babel-temp-file, org-babel-temp-stable-file)
(org-babel-remove-temporary-directory)
(org-babel-remove-temporary-stable-directory): Adjust accordingly.

* lisp/org.el (org-log-beginning): Add FIXME.

* testing/org-test.el: Require `org` and `org-id`.
(org-id-locations-file): Don't `defconst` it.
(org-test-at-id, org-test-in-example-file, org-test-at-marker)
(org-test-with-temp-text, org-test-with-temp-text-in-file): Move edebug
specs into `declare` (and simplify them).
(org-test-with-tramp-remote-dir--worker): Declare dynbound tramp vars.
(org--compile-when): Fix quoting of `exp`.
(org-test-load): Tweak regexps.

* testing/org-batch-test-init.el: Tweak regexp, remove dead code and
add a FIXME about it.

* testing/lisp/test-ox.el: Require `ox` instead of
erroring out if it's not already loaded.  Also require `org-inlinetask`.
(org-test-with-parsed-data): Silence warnings when `info` is not used.
(test-org-export/bind-keyword): Add FIXME.

* testing/lisp/test-ox-publish.el: Require `org-test` and `ox-publish`.
(test-org-publish/resolve-external-link): Expose lambdas to
the compiler.  Remove unused var `ids`.
(test-org-publish/get-project-from-filename): Remove unused var `file`.

* testing/lisp/test-org.el: Require `org-macs`, `org`,
`org-inlinetask`, `org-refile`, and `org-agenda`.
(test-org/org-read-date): Declare `org-time-was-given` as dynbound.
(test-org/set-regexps-and-options): Add FIXME.

* testing/lisp/test-org-timer.el: Require `org-timer`.

* testing/lisp/test-org-table.el: Require `ox`.

* testing/lisp/test-org-protocol.el: Require `org-protocol` instead of
erroring out if it's not already loaded.  Also require `capture`, and
add missing `provide` statement.

* testing/lisp/test-org-pcomplete.el: Require `org`.

* testing/lisp/test-org-list.el: Require `org-list` and `org`.

* testing/lisp/test-org-lint.el: Require `org-footnote` and `org-lint`.

* testing/lisp/test-org-footnote.el: Require `org-footnote`.

* testing/lisp/test-org-element.el: Require `org-element` instead of
erroring out if it's not already loaded.  Also require `org` and
`org-inlinetask`.

* testing/lisp/test-org-duration.el: Require `org-duration`.

* testing/lisp/test-org-datetree.el: Require `org-datetree`.

* testing/lisp/test-org-colview.el: Require `org-colview`,
`org-duration`, and `org-inlinetask`.

* testing/lisp/test-org-clock.el: Require `org-duration` and `org-clock`.

* testing/lisp/test-org-archive.el: Require `org-archive`.

* testing/lisp/test-org-agenda.el
(test-org-agenda/bulk-custom-arg-func): Add FIXME.

* testing/lisp/test-ol.el: Require `ol` and `org-id`.
(test-org-link/store-link): Declare `org-store-link-props` and add FIXME.

* testing/lisp/test-oc.el (test-org-cite/export-capability): Add FIXME.

* testing/lisp/test-ob.el: Require `ob-core`, `org-src`, `ob-ref`,
and `org-table`.
(test-ob/eval-header-argument): Rename `foo` to `test-ob--foo` and
declare it as dynbound.
(test-ob/blocks-with-spaces, test-ob/specific-colnames): Add FIXME.
(test-ob/noweb-expansions-in-cache):
Declare `noweb-expansions-in-cache-var` as dynbound.

* testing/lisp/test-ob-tangle.el: Require `org` and `ob-tangle`.

* testing/lisp/test-ob-shell.el:
* testing/lisp/test-ob-python.el: Require `ob-core`.

* testing/lisp/test-ob-lob.el: Require `ob-lob`.
(temporary-value-for-test): Declare as dynbound.

* testing/lisp/test-ob-plantuml.el: Require `ob-plantuml` instead of
erroring out if it's not already loaded.
* testing/lisp/test-ob-lilypond.el: Require `ob-lilypond` instead of
erroring out if it's not already loaded.  Use `with-current-buffer`.

* testing/lisp/test-ob-julia.el: Require `ob-core`.

* testing/lisp/test-ob-java.el (org-babel-temporary-directory):
Remove dead code now that `org-babel-temporary-directory` is always bound.

* testing/lisp/test-ob-exp.el: Require `ob-exp`, `org-src`, and `org-test`.
(ob-exp/evaluate-all-executables-in-order):
Declare `*evaluation-collector*` as dynbound.

* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/dynamic-lexical-edit)
(ob-emacs-lisp/dynamic-lexical-execute):
Rename dynbound var to `ob-emacs--x` and declare it as such.

* testing/lisp/test-ob-R.el: Require `ob-core`.
(ess-ask-for-ess-directory, ess-history-file): Declare vars.
2022-09-15 19:17:19 +08:00
Ihor Radchenko 2d38026581
Do not assert Org version in root Org libraries
* lisp/org-compat.el:
* lisp/org-macs.el: Do not check Org version.  These two libraries are
the base libraries required to generate the Org version.  The version
is not yet known when loading them; or, worse, built-in
`org-git-version' may be defined from built-in Org distribution.

Fixes https://orgmode.org/list/cdf0bc7d-3ed1-e1ce-84bb-239575a9c0b9@oracle.com
2022-09-15 12:28:57 +08:00
Ihor Radchenko 86c4635dba
test-org-link/store-link: Update tests for 4fc2c8dd8
* testing/lisp/test-ol.el (test-org-link/store-link): Do not expect
duplicating raw link in the file link description.
2022-09-13 22:11:05 +08:00
Ihor Radchenko f8d740f707
org-log-beginning: Fix edge case when we create logbook at eob
* lisp/org.el (org-log-beginning): Fix edge case when current headline
is the last headline in the buffer and does not have a final newline.

Fixes https://orgmode.org/list/m21qvi8er5.fsf@ntnu.no
2022-09-13 22:02:11 +08:00
Ihor Radchenko 8ec328e827
org-log-beginning: Fix for headline at eob with no trailing newline
* lisp/org.el (org-log-beginning): Fix edge case when there is a
headline at the end of buffer and that headline does not have a
trailing newline.

Fixes https://orgmode.org/list/m24k0ffjyd.fsf@ntnu.no
2022-09-13 21:50:18 +08:00
Ihor Radchenko 4fc2c8dd89
org-store-link: Default to empty description for target/custom-id links
* lisp/ol.el (org-store-link): Use empty description by default (ask user).
2022-09-13 21:05:37 +08:00
Max Nikulin c3d6672cfd
ol.el: Avoid links like "[[target][file:~/org/test.org::target]]"
* lisp/ol.el (org-store-link): Do not set description for "<<target>>"
links to avoid case when it is more detailed than link target.

While inserting to the same file, file part of the link target is
stripped, description is inserted without modification.  I do not think,
file path adds real value in comparison to "[[target]]" link to some
point in the same file.  A side effect is user prompt for description
since link and description are not identical any more.
2022-09-13 20:59:52 +08:00
Max Nikulin f7b8510283
ol.el: Skip #CUSTOM_ID when <<target>> link is stored
* list/ol.el (org-store-link): Suppress storing of
"file:file.org::#custom_id" link when point is <<target>>.

CUSTOM_ID link is stored as additional option, so new chunk of code
introduced by b4b35fc92 is not necessary. It prevented adding of
"file:file.org::*Heading" link and caused duplication of
"file:file.org::#custom_id" link.

Reported-by: Fr Ml <fr_ml@t-online.de>
Link: https://orgmode.org/list/aadb23f3-c0fe-19aa-be79-50e51d16c41a@t-online.de/
2022-09-13 20:59:51 +08:00
Max Nikulin 543a23a57d
Revert "lisp/ol.el: Fix bug when storing links"
This reverts commit b4b35fc92d.

Avoid duplication of CUSTOM_ID links.
2022-09-13 20:59:51 +08:00