Commit graph

17573 commits

Author SHA1 Message Date
Ihor Radchenko 6b175fb227
org-persist-register: Make return value meaningful with :write-immidiately
* lisp/org-persist.el (org-persist-register): Return the return value
of `org-persist-write' when `:write-immediately' is non-nil.
2022-01-29 17:08:40 +08:00
Ihor Radchenko caccec2c54
org-persist: Use symbols as container names
* lisp/org-persist.el: Update commentary.
(org-persist--storage-version): Bump index version.
(org-persist--normalize-container):
(org-persist-read:index):
(org-persist--load-index):
(org-persist--save-index): Use symbol for container names.
2022-01-29 17:08:33 +08:00
Ihor Radchenko 6a5874bb26
org-persist-write: Overwrite existing copy if write is requested 2022-01-29 17:08:23 +08:00
Ihor Radchenko 0e18c617cf
org-persist-write:index: Return index path on write 2022-01-29 17:08:17 +08:00
Ihor Radchenko eca678195b
org-persist-write: Return the written value on success 2022-01-29 17:08:10 +08:00
Ihor Radchenko 0526acd16f
org-persist-register: New optional keyword to force immidiate write
* lisp/org-persist.el: Update commentary.
(org-persist-register): Add new keyword `write-immediately' to write
the newrly registerd container to disk immediately.
2022-01-29 17:08:02 +08:00
Ihor Radchenko 1bc8389871
org-persist-read: Check expiry 2022-01-29 17:07:56 +08:00
Ihor Radchenko f3bd1dcb77
org-persist: Fix compiler warnings 2022-01-29 17:07:48 +08:00
Ihor Radchenko ec787fb218
org-persist: Implement "file" and "url" containers linked to other file
* lisp/org-persist.el: Update commentary.
(org-persist--storage-version): Bump storage version.
(org-persist-write:file):
(org-persist-write:url): Support optional container setting.
2022-01-29 17:07:32 +08:00
Ihor Radchenko fca80139ee
org-persist: Fix compatibility with Emacs 27
* lisp/org-persist.el (org-persist--normalize-associated): Do not
expect that we can bind new vars in pacse forms.
(org-persist-read:elisp):
(org-persist-read:version):
(org-persist-read:file):
(org-persist-read:url): Avoid multiple `_' placeholders.
2022-01-29 17:06:40 +08:00
Ihor Radchenko dc52c0fe99
Fix native-comp warnings 2022-01-29 17:06:32 +08:00
Ihor Radchenko 4ec57a9453
org-persist: Update commentary 2022-01-29 17:06:23 +08:00
Ihor Radchenko d5fc159bf7
Fix compiler warnings 2022-01-29 17:06:14 +08:00
Ihor Radchenko f963d617a4
Fix checkdoc warnings 2022-01-29 17:06:08 +08:00
Ihor Radchenko 9b650938e7
org-persist: Provide human readable access time and make sure it exist
* lisp/org-persist.el (org-persist--storage-version): Bump version.
(org-persist-read:generic):
(org-persist-load:generic):
(org-persist-write:generic): Save access time in human-readable form.
2022-01-29 17:05:33 +08:00
Ihor Radchenko aca62116da
org-persist-write: Update buffer hash on save 2022-01-29 17:05:26 +08:00
Ihor Radchenko 203420504e
org-persist-load:elisp: fix loading 2022-01-29 17:05:13 +08:00
Ihor Radchenko 1869a37a2c
Fix org-persist--remove-from-index 2022-01-29 17:05:05 +08:00
Ihor Radchenko 8821ff5811
org-persist-read: Do not try to read non-existing containers 2022-01-29 17:04:52 +08:00
Ihor Radchenko 1084566322
Fix org-persist-unregister 2022-01-29 17:04:41 +08:00
Ihor Radchenko 703df9310a
org-persist: Cleanup on removal and version mismatch
* lisp/org-persist.el (org-persist--remove-from-index):
(org-persist-load:index): Garbage collect caches.
2022-01-29 17:04:18 +08:00
Ihor Radchenko dafa32da49
org-persist: Update index version 2022-01-29 17:04:11 +08:00
Ihor Radchenko 38a681fdae
org-element-cache-reset: Do not persist caches for non-file buffers 2022-01-29 17:03:54 +08:00
Ihor Radchenko 1c79af13df
org-persist-gc: Fix when expiry is days and data is freshly created 2022-01-29 17:03:46 +08:00
Ihor Radchenko 7c2d93560c
org-persist-default-expiry: Introduce and change default
* lisp/org-persist.el: New customisation controlling default persist
data expiry.  Defaults to 30 days from last access.
(org-persist-register): Change default value of `:expiry' key to
`org-persist-default-expiry'.
2022-01-29 17:03:09 +08:00
Ihor Radchenko 2a4e5a8e58
org-persist--normalize-associated: Use cache to calculate buffer hash 2022-01-29 16:56:14 +08:00
Ihor Radchenko edd7f2962f
org-persist: Reimplement using more generic approach 2022-01-29 16:55:57 +08:00
Samim Pezeshki 22e6ed6b89 agenda: Add header to agenda clock report table
* lisp/org-agenda.el (org-agenda-list): Add header to agenda clock
report table.

TINYCHANGE
2022-01-26 21:07:49 +01:00
Ihor Radchenko 2ae8d6c1cf
org-babel-tangle-collect-blocks: Use cache
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Use element
cache to find the containing headline instead of regexp search.
Direct regexp search sometimes causes quadratic scaling.

See https://lists.gnu.org/r/emacs-orgmode/2022-01/msg00484.html
2022-01-26 19:27:03 +08:00
Ihor Radchenko 70970dff8d
org-before-first-heading-p: Use cache and clarify docstring 2022-01-25 22:53:08 +08:00
Ihor Radchenko e604187779
Merge branch 'bugfix' 2022-01-23 17:41:12 +08:00
Ihor Radchenko 5b404a2225
org-dblock-write:clocktable: Fix typo in error string
Reported in https://list.orgmode.org/874k5uu85j.fsf@yandex.com/T/#u
2022-01-23 17:40:25 +08:00
Ihor Radchenko 1587e445be
org-element-cache: Suggest to share warning text as well in the warnings
Multiple users reported that they saw the warning, but did not
actually report the warning text.  It's better to ask about sharing
explicitly.
2022-01-23 12:06:56 +08:00
Nicolas Goaziou 3154c22559 Merge branch 'bugfix' 2022-01-22 15:51:43 +01:00
Nicolas Goaziou 23daada78d compat: Prevent spell-checking citation
* lisp/org-compat.el (org--flyspell-object-check-p): Do not
spell-check citation and citation-reference objects.

Reported-by: Rudolf Adamkovič <salutis@me.com>
<http://lists.gnu.org/r/emacs-orgmode/2022-01/msg00434.html>
2022-01-22 15:48:26 +01:00
Ihor Radchenko 5ac2b2291b
Make sure that 'inherited text property in tags does not propagate to cache
* lisp/org.el (org--get-local-tags, org-get-tags): Explicitly copy
cached tag strings to make sure that modifications are not propagated
to cached tag values.

Fixes
https://list.orgmode.org/CAFyQvY2HkE5p00wQ1QycQCdtwy3drRB_naK8wenrKwVT-cbH7g@mail.gmail.com/T/#t
2022-01-21 19:47:18 +08:00
Ihor Radchenko 5d05f5911a
org-element-cache: Allow detecting changes from indirect non-Org buffers
* lisp/org-element.el (org-element--cache-before-change):
(org-element--cache-after-change): Do not prevent trigerring if the
current indirect buffer is not in Org mode, but its base buffer is in
Org mode.
2022-01-19 17:37:34 +08:00
Ihor Radchenko 37edef8bbd
org-mode: Initialise cache before initialising file-local regexps
* lisp/org.el (org-mode): Initialise cache earlier, allowing the
file-local settings to be taken from persistent cache when
possible.  Also, bind `org-mode-loading' while org-mode is loading.
* lisp/ol.el (org-update-radio-target-regexp): Do not try to refresh
cache when we are loading file for the first time.
2022-01-19 11:58:17 +08:00
Marco Wahl 0725237eed org: Small simplification
* lisp/org.el (org-metaup, org-metadown): Remove unnecessary min/max computation.
2022-01-18 09:47:53 +01:00
Ihor Radchenko 9b58ead467
org-element-context: Use element cache
* lisp/org-element.el (org-element-context): Use
`org-element-at-point', which makes use of cache.
* testing/lisp/test-org-element.el (test-org-element/lineage): Expect
full lineage up to org-data from `org-element-context'.
2022-01-17 20:20:57 +08:00
Ihor Radchenko f41ba23689
org-colview: Do not remap faces repeatedly
* lisp/org-colview.el (org-columns--display-here):
(org-columns-remove-overlays): Do not call `face-remap-add-relative'
after it is already called.  For large files,
`face-remap-add-relative' can take more than 90% CPU time.  Set
`org-columns-header-line-remap' to nil when we remove the temporary
remapping.
2022-01-17 20:20:44 +08:00
Ihor Radchenko 7ba24c673b
ob-gnuplot: Fix wrong table conversion when first column has ?-
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Revert to
using ascii exporter.
* lisp/ox-ascii.el (org-ascii-table-cell): Do not throw error when
CONTENTS is wider than initial cell value.
2022-01-14 22:03:38 +08:00
Ihor Radchenko 9623da4408
ob-gnuplot: Fix wrong table conversion when first column has ?-
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Revert to
using ascii exporter.
* lisp/ox-ascii.el (org-ascii-table-cell): Do not throw error when
CONTENTS is wider than initial cell value.
2022-01-14 21:56:09 +08:00
Ihor Radchenko 6631b3f7bb
org-element--parse-to: Fix limit when pasting top-comment and no cache
* lisp/org-element.el (org-element--parse-to): Manually parse org-data
and set appropriate parser mode when POS is before first headline and
cache is disabled.
(org-element-org-data-parser--recurse): New variable flagging if
`org-element-data-parser' is called recursively.
(org-element-org-data-parser): Handle recursive calls from inside `org-element-at-point-no-context'.

This also fixes false-positives in `org-element--cache-verify-element'.
2022-01-14 14:29:16 +08:00
Mark A. Hershberger 1537bb4029
Fix signature for org-element-at-point 2022-01-12 22:26:10 +08:00
Ihor Radchenko a9b2e262cd
Merge branch 'bugfix' 2022-01-12 21:11:33 +08:00
Ihor Radchenko e8d6db540b
org-agenda-get-timestamps: Ignore non-timestamps matching re
* lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm
that object at point is a timestamp.

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

Partially fixes https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
2022-01-12 21:08:41 +08:00
Ihor Radchenko 1f48d2d751
org-element-cache-map: Do not byte-compile FUNC
Byte compilation can unpredictably break agenda searches in some Emacs
builds.

See https://list.orgmode.org/PAXPR08MB6640260AFA03FCDFABE245A3A34F9@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#t
2022-01-10 22:32:38 +08:00
TEC 071c5e4bf1
org-entities: Fix LaTeX macron accent
* lisp/org-entities.el: The macron accent should be produced with the
text accent \=, not \bar which is a maths accent.
2022-01-10 00:38:32 +08:00
Ihor Radchenko dc4b2772e3
org-element-cache-map: Fix an edge case with org-element-cache-continue-from
* lisp/org-element.el (org-element-cache-map): Make sure that START is
never set to -1.  It may cause infinite loops in some scenarios.
* testing/lisp/test-org.el (test-org/map-entries): Add a test catching
the reported situation.

Reported in https://list.orgmode.org/CADywB5JHAyPX99Vr02SvAqiMTD+7ss4VWVipOhKfm=iGirDPhA@mail.gmail.com/T/#t
2022-01-07 22:10:22 +08:00
Ihor Radchenko 515ce56d4e
org-element-cache: Fix transforming keywords to affiliated
* lisp/org-element.el (org-element--cache-for-removal): Consider
preceding keywords to be updated unconditionally.
(org-element-cache-map): Fix infinite loop revealed by the new test.

* testing/lisp/test-org-element.el (test-org-element/cache-affiliated):
New test.
2022-01-07 21:24:43 +08:00
Ihor Radchenko a98ae424d2
org-element-cache: Give user more control over silent modificatoin checks
* lisp/org-element.el (org-element--cache-silent-modification-check):
New variable allowing the user to suppress modification checks completely.
* lisp/org-element.el (org-element--cache-sync): Support
`org-element--cache-silent-modification-check'.

The existing heuristics for built-in non-modifying commands that
change `buffer-chars-modified-tick' is not sufficient.  At least
`capitalize-word' changes the tick regardless whether the buffer was
actually modified or not.  Yet, `capitalize-word' does not call
`after-change-functions' if the buffer is not really modified.

Reported in https://list.orgmode.org/2022-01-06T12-13-17@devnull.Karl-Voit.at/T/#mb3771758f81b31721ba2f420878a4d16081dc483
2022-01-06 20:16:00 +08:00
Kyle Meyer fe70c4d259 ox-koma-letter: Collapse space in copyright line
Match the space change made in Emacs's 19dcb237b5b (; Add 2022 to
copyright years, 2022-01-01) to avoid noise when syncing to the Emacs
repo.
2022-01-01 17:47:00 -05:00
Kyle Meyer b8656a2cef Update main-only copyright years 2022-01-01 15:25:06 -05:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Ihor Radchenko 06f58e4759
org-element-cache-map: Fix when FUNC deletes current element
* lisp/org-element.el (org-element-cache-map-continue-from): New
variable forcing `org-element-cache-map' to continue from a custom
point in buffer.
(org-element-cache-map): Add support for
`org-element-cache-map-continue-from'.  Update docstring accordingly.
Also, make sure that mapping terminates correctly when FUNC deletes
all elements in buffer.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Fixes https://orgmode.org/list/CADywB5KOJ1p0NpvA=iX-ybHsO=huGA8qL3xMpUTETmS2qp7_ng@mail.gmail.com
2022-01-01 14:13:26 +08:00
Ihor Radchenko eb9f34222a
ob-gnuplot: Fix regression from 23d8d59df when ox-org is not loaded
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Require
ox-org, making sure that org export backend is available.
2021-12-27 00:46:00 +08:00
Ihor Radchenko c614234688
ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
backend when exporting table data to plain text table.  ascii backend
incorrectly handles quote transcoders that change the column width and
sometimes throws an error.  (ascii backend simply ignores transcoded
table cells and calculates width based on the initial cell text).
2021-12-27 00:45:39 +08:00
Ihor Radchenko d012350dad
org-persist: Report read/write duration
* lisp/org-persist.el (org-persist--report-time): New variable
controlling time reporting.  The default value is to report if
read/write opeartion takes over 0.5 sec.
(org-persist-write):
(org-persist-read): Display message about read/write duration for each
variable according to `org-persist--report-time'.
2021-12-25 23:36:26 +08:00
Ihor Radchenko ecce81dace
Merge branch 'bugfix' 2021-12-25 22:26:48 +08:00
Ihor Radchenko 377d6247af
org-clock-timestamps-down: Fix typo in docstring
Reported in https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-12/msg01841.html
2021-12-25 22:25:24 +08:00
Bastien fbff082f73 Update to version 9.5.2
* lisp/org.el: Update to version 9.5.2.
2021-12-24 21:01:49 +01:00
Ihor Radchenko 8f50ea2d69
org-element--parse-to: Get rid of unnecessary cache lookup
* lisp/org-element.el (org-element--parse-to): Disable cache in
`org-element--current-element'.  When calling it here, we know for
sure that element at point is not yet in cache.
2021-12-24 12:30:09 +08:00
Ihor Radchenko 410afd6f37
Revert "org-do-emphasis-faces: Never treat closing marker as next opening marker"
This reverts commit fa315986a1.

The commit broke fontification of nested emphasis like
/italic *bold* more italic/.
2021-12-22 23:51:51 +08:00
Ihor Radchenko e0b1a05460
org-persist-unregister: Fix when BUFFER is not 'all
* lisp/org-persist.el (org-persist-unregister): Use `string=' instead
of `eq' to compare strings.  `eq' always returns nil here.
2021-12-22 10:22:04 +08:00
Ihor Radchenko 0b670aa8e8
org-persist: Support old Emacs without file-attribute-inode-number
* lisp/org-persist.el (org-persist--get-index): Check is
`file-attribute-inode-number' function exists.  It was not there in
Emacs 25.

Fixes https://list.orgmode.org/CAJcAo8s21R1dRrxpaHV=h68RtWctLd6giFskw1vpt9fQh81dDw@mail.gmail.com/T/#u
2021-12-20 23:00:01 +08:00
Ihor Radchenko 344b99070f
org-persist.el: Make org-persist-directory a custom variable
* lisp/org-persist.el (org-persist): Create org-persist customisation
group.
(org-persist-directory): Convert into defcustom.
2021-12-20 23:00:00 +08:00
Kyle Meyer e26b825e6e Merge branch 'bugfix' 2021-12-18 13:21:14 -05:00
Kyle Meyer a18849b786 org-babel-tangle-file: Revert recent change in return value
* lisp/ob-tangle.el (org-babel-tangle-file): Restore the recently
removed prog1 so that the return value matches the documented one.
2021-12-18 13:20:45 -05:00
Kyle Meyer f4e72ffcd4 org-babel-tangle-file: Fix void variable error from last commit
* lisp/ob-tangle.el (org-babel-tangle-file): Switch let to let* to fix
void variable error.
2021-12-18 13:16:26 -05:00
Nicolas Goaziou 2b7ea20346 Merge branch 'bugfix' 2021-12-18 15:41:13 +01:00
Nicolas Goaziou aabcf9edf2 ob-tangle: Ignore narrowing when tangling a file
* lisp/ob-tangle.el (org-babel-tangle-file): Ignore narrowing in
a buffer visiting the file being tangled.
2021-12-18 15:40:25 +01:00
Ihor Radchenko d45bd627ce
Merge branch 'bugfix' 2021-12-18 21:17:43 +08:00
Ihor Radchenko 1778eb94c5
org-habit: Preserve invisibility when inserting consistency graph
* lisp/org-habit.el (org-habit-insert-consistency-graphs): Inherit
'invisible text property of the habit line when the habit is hidden in
agenda.

Fixes https://orgmode.org/list/PAXPR06MB776069E9085C1CD606156493C6709@PAXPR06MB7760.eurprd06.prod.outlook.com
2021-12-18 21:12:22 +08:00
Ihor Radchenko ed392bc1c9
Merge branch 'bugfix' 2021-12-18 16:12:59 +08:00
Ihor Radchenko 85aaa19908
org-agenda: Make sure that time grid is aligned when hour <10
* lisp/org-agenda.el (org-agenda-format-item): Make sure that hour
part of begin time in time grid always occupy 5 chars

Fixes https://list.orgmode.org/orgmode/3afe1bba.2f48.17c350d0a41.Coremail.tumashu@163.com/
2021-12-18 16:07:58 +08:00
Ihor Radchenko 4426d8009f
org-element-cache: Fix Phase 1 when new parent overlaps future edits
* lisp/org-element.el (org-element--cache-process-request): New OFFSET
argument used to correct newly added parents during Phase 1.  The
`org-element--parse-to' call inside Phase 1 may add new elements to
cache that intersect with future edits.  Boundaries of these elements
may be shifted twice, so we have to offset the future shift.

(org-element--cache-sync): New OFFSET argument providing future change
info to `org-element--cache-process-request'.

(org-element--cache-submit-request): Provide offset value in
`org-elemnt--cache-sync' call.

(org-element--cache-submit-request):
(org-element--cache-process-request):
(org-element--cache-sync): Never use %d format for region boundaries.
It may be a marker and cause error.  Use %S instead.

(org-element--cache-process-request): Use unique symbols for
catch-throw.

Fixes https://list.orgmode.org/CAFyQvY3Qv5xn-ET83L6Rzg-V1zOVu4y1gt+-_CpfaWNAdt87xA@mail.gmail.com/T/#t
2021-12-17 22:48:20 +08:00
Ihor Radchenko e2a8e95576
org-element-cache: Fix when edit extends previous element
* lisp/org-element.el (org-element--cache-after-change): Always extend
changed region to bol.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking the new fix.  Amend some tests around making sure that cache
is active during testing.
2021-12-17 20:23:50 +08:00
Ihor Radchenko d6e6a9a3bc
org-element.el: Silence compiler 2021-12-17 20:23:11 +08:00
Ihor Radchenko 895e0baadf
ob-gnuplot: Fix regression from 23d8d59df when ox-org is not loaded
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Require
ox-org, making sure that org export backend is available.
2021-12-17 10:17:40 +08:00
Ihor Radchenko 092e921423
org-element-cache-map: Fix when start is nil after buffer modification 2021-12-16 23:17:05 +08:00
Ihor Radchenko 3338f37061
org-element--cache-process-request: Fix format specifier allowing marker
Fixes https://list.orgmode.org/CAFyQvY2=M6-JO7k=dF74injM7kHCcGUgdCCZXM6TZPWDTGbR4A@mail.gmail.com/T/#t
2021-12-16 23:16:31 +08:00
Ihor Radchenko de022ed654
Merge branch 'bugfix' 2021-12-16 21:43:56 +08:00
Ihor Radchenko 325b06bde4
org-element-cache: Do not carry over warning after sync
* lisp/org-element.el (org-element--cache-sync): Set
`org-element--cache-warning' to nil at the end of synchronisation.
We do not need to consider that next request might be merged with
existing request in such scenario.
(org-element--cache-before-change): Add comment explaining the use of `org-element--cache-warning'.
2021-12-16 21:39:26 +08:00
Ihor Radchenko d267486002
org-element-cache: Fix some edits right after indent at :begin
* lisp/org-element.el (org-element--cache-after-change): Extend
changed region to bol when we are editing near beginning of an element
within or right after indentation.  Such edits potentially change
:post-blank value of the previous element.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking one of such cases.
2021-12-16 21:39:25 +08:00
Ihor Radchenko 7ec9e37117
org-tree-to-indirect-buffer: Fix when last headline is empty at point-max
* lisp/org.el (org-tree-to-indirect-buffer): Consider scenario when
`org-end-of-subtree' with 't second arg moves to `point-max' at the
end of an empty headline.  We do not need to move back the point then.

Fixes https://orgmode.org/list/CA+AFVDUF3RzA-mnoAp8yFv-bppoYJfJo=Wa8qmNQhV-tfHHB+w@mail.gmail.com
2021-12-16 21:39:24 +08:00
Ihor Radchenko 5840e4d61a
org-element-cache Do not make headline non-robust after changes at :end
* lisp/org-element.el (org-element--cache-for-removal): When changes
involve :end of a headline, allow it to be re-parsed synchronously.
2021-12-16 11:39:23 +08:00
Ihor Radchenko 69985367cd
org-element-cache: Consider non-PROPERTIES drawers robust
* lisp/org-element.el (org-element--cache-for-removal): Drawers are
generally robust elements (they cannot be changed if a non-sensitive
change is made inside their contents).  The only exception is
PROPERTIES drawer that may switch back and forth between ordinary
drawer and properties drawer depending on its contents.  The old code
treated all possible drawer as non-robust for this reason, degrading
performance on large LOGBOOK drawers that are now processed much
faster since they do not need to be removed and re-parsed on every
single change.
2021-12-16 11:26:54 +08:00
Ihor Radchenko 6339c622f8
org-element-cache: Do not consider BEGIN lines of elements sensitive
* lisp/org-element.el (org-element--cache-sensitive-re): Remove
 #+begin_ and \begin{ lines from sensitive regexp.  Such changes can
 be handled without a need to re-parse from earlier position.  If a
 change introduces a new element, the new element will be recognised
 and the unupdated elements not intersecting with the new element will
 be handled during Phase 1.
2021-12-16 11:23:33 +08:00
Ihor Radchenko fd93ad698a
org-element-cache: Do not treat inserting newline at :begin sensitive
* lisp/org-element.el (org-element--cache-before-change): Do not match
`org-element--cache-sensitive-re' against an element starting at END
when END is at bol.  Such changes never break an element structure (as
opposed to inserting non-newline right at :begin of an element).
2021-12-16 11:20:32 +08:00
Ihor Radchenko cfe4b17d96
org-element-cache: Optimise changed property drawer detection
* lisp/org-element.el (org-element--cache-for-removal): Only force
re-parsing headlines when the changed region falls within the headline
before property drawer end position.
2021-12-16 11:18:00 +08:00
Ihor Radchenko 23d8d59df8
ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
backend when exporting table data to plain text table.  ascii backend
incorrectly handles quote transcoders that change the column width and
sometimes throws an error.  (ascii backend simply ignores transcoded
table cells and calculates width based on the initial cell text).
2021-12-16 11:14:59 +08:00
Nicolas Goaziou 8908fba113 compat: Silence byte-compiler 2021-12-12 16:21:04 +01:00
Nicolas Goaziou f8cd8a6645 oc-biblatex: Generate cite styles dynamically
* lisp/oc-biblatex.el (org-cite-biblatex-list-styles): New function.
Use it when registering `biblatex' citation processor.
2021-12-12 16:17:56 +01:00
Nicolas Goaziou cfffdf5e1a oc-biblatex: Add missing shortcut
* lisp/oc-biblatex.el (org-cite-biblatex-style-shortcuts): Add missing shortcut.
2021-12-12 16:09:24 +01:00
Nicolas Goaziou e995e069ca oc-biblatex: Allow style customization
* lisp/oc-biblatex.el (org-cite-biblatex-styles):
(org-cite-biblatex-style-shortcuts): New defcustoms.
(org-cite-biblatex--expand-shortcuts): New function.
(org-cite-biblatex-export-citation): Extract adequate style from
defcustoms above instead of hard-coding all styles.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou 82bb04be22 oc-biblatex: Spell out multicite commands instead of guessing them
* lisp/oc-biblatex.el (org-cite-biblatex-export-citation): Provide
full multicite command name.
(org-cite-biblatex--command): Use name instead of guessing it from
base name.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou 7e2d9091d0 oc: Allow declaring cite styles as a function
* lisp/oc.el (org-cite-register-processor): Allow a function
as :cite-styles value.
(org-cite-supported-styles): Propagate change above.
* testing/lisp/test-oc.el (test-org-cite/supported-styles): Add test.
2021-12-12 15:42:29 +01:00
Ihor Radchenko 798435be85
org-element-cache: Fix merging intersecting Phase 0 requests
* lisp/org-element.el (org-element--cache-submit-request): Extend
calculation of affected parent elements to the full changed region.
The previous behaviour could miss some outer elements to be removed.
2021-12-12 16:13:16 +08:00
Ihor Radchenko 9c7acaa02d
Re-implement 54534eebb more efficiently
* lisp/org-element.el (org-element--cache-sensitive-re): Do not treat
properties inside property drawers as global sensitive change. It can
cause cache drop on large logbook drawers where a new clock entry is
inserted.
(org-element--cache-for-removal): Use the same technique used for
detecting property drawer <-> ordinary drawer changes under headlines
for org-data.
2021-12-12 12:51:56 +08:00
Kyle Meyer 0c9b30e961 Merge branch 'bugfix' 2021-12-11 12:40:39 -05:00
Stefan Kangas 9ca3bc3730 Backport commit 26fb4168b from Emacs
; Prefer HTTPS in more URLs
26fb4168b884eeb910580c42e87efb73399019c9
Stefan Kangas
Thu Dec 9 16:26:04 2021 +0100
2021-12-11 12:26:28 -05:00
Nicolas Goaziou e6c7ea3a36 Merge branch 'bugfix' 2021-12-11 17:21:45 +01:00
TAKAHASHI Yoshio 888689f2ba org-macro: Adjust for compatibility with latest vc (bug#51365)
* lisp/org-macro.el (org-macro--vc-modified-time): Wrap file in a list
when passing to vc-call to avoid a type error starting with Emacs 28.

Before Emacs's 3572613550f (Fix vc-git-state for filenames with
wildcards, 2021-08-15), a string could be given to vc-git-print-log as
the FILES argument because the argument was passed directly as
vc-git-command's FILE-OR-LIST, which as the name suggests, accepts
either a string or a list.  After 3572613550f, passing a string leads
to a type error.

TINYCHANGE
2021-12-11 11:14:03 -05:00
Nicolas Goaziou 41f412f0bc Merge branch 'bugfix' 2021-12-11 14:21:54 +01:00
Nicolas Goaziou 957feb2df4 oc: Fix typo in docstring
* lisp/oc.el (org-cite-make-insert-processor): Fix typo.
2021-12-11 14:21:10 +01:00
Ihor Radchenko edddc7d149
org-element-cache-map: Reduce memory allocation and time re-search
* lisp/org-element.el (org-element-cache-map): Move all possible
let-bindings outside the loop to avoid remory re-allocation on every
iteration.  Track statistics for `re-search-forward' calls.
2021-12-11 10:08:40 +08:00
Ihor Radchenko 0350c7dd71
org.el: Avoid excessive memory usage by effort text properties
* lisp/org.el (org-set-effort):
(org-property-next-allowed-value): Do not use text properties cache
for `effort' and `effort-minutes' when org-element-cache is active.
These text properties are superceded by element cache and their only
effect (when cache is active) is extra load on Emacs garbage collector
leading to overall Emacs slowdown.
* lisp/org-clock.el (org-clock-in): Use `org-element-use-cache'
instead of `org-element--cache-active-p' to check if element cache is
active. The latter is too precise and may trigger
`org-refresh-effort-properties' when cache is temporarily disabled by
internal calls.
2021-12-11 10:08:39 +08:00
Ihor Radchenko 67fb7a4892
org-agenda-get-deadline: Use org-element-cache 2021-12-11 10:08:39 +08:00
Nicolas Goaziou 04f9fa314c Merge branch 'bugfix' 2021-12-10 10:34:43 +01:00
Nicolas Goaziou a957a4c19d keys: Don't bind illegal C-TAB
* lisp/org-keys.el (org-mode-map): Bind `org-force-cycle-archived' to
C-c C-<tab> instead of C-c C-TAB.

Reported-by: Ingo Lohmar <ingo.lohmar@posteo.net>
<http://lists.gnu.org/r/emacs-orgmode/2021-10/msg00048.html>
2021-12-10 10:33:01 +01:00
Nicolas Goaziou 96e022bbe0 Merge branch 'bugfix' 2021-12-10 10:29:41 +01:00
Nicolas Goaziou f0d8041f0c ox: Clarify `org-export-to-(buffer|file)' docstrings
* lisp/ox.el (org-export-to-buffer):
(org-export-to-file): Fix example and add precision about the need for
quoting lambda sexps.
2021-12-10 10:28:58 +01:00
Sébastien Miquel 8d189720b2 ox: Fix async export with native compilation
* lisp/ox-beamer.el (org-beamer-export-to-pdf):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-koma-letter.el (org-koma-letter-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-pdf):
* lisp/ox-texinfo.el (org-texinfo-export-to-info): Quote lambda.

Quote or name lambdas to prevent their compilation into anonymous
functions which cannot be passed to the external async emacs process.
2021-12-10 10:22:53 +01:00
Emmanuel Charpentier c6186be3fd oc-csl: Also look for style files in default directory
* lisp/oc-csl.el (org-cite-csl--style-file): When file name is
relative, look for it in default directory before expanding it against
`org-cite-csl-styles-dir'.
(org-cite-csl-styles-dir): Document change.
2021-12-10 10:17:00 +01:00
Kyle Meyer f1929afc66 Merge branch 'bugfix' 2021-12-09 22:45:02 -05:00
Kyle Meyer 4aca51fcbe org-priority: Fix SPC handling for numeric priorities (bug#52341)
* lisp/org.el (org-priority): When reading numeric priorities, provide
special handling of SPC so that it clears the priority, as advertised.

If the user has configured numeric priorities and tries to clear a
priority by inputting SPC at the prompt, org-priority feeds " " to
string-to-number and ends up with 0 instead of the ?\s (32) that's
used downstream to signal "remove".  Explicitly check for " " and
translate it to ?\s.

Reported-by: "Bruce E. Robertson" <brucer42@gmail.com>
Link: https://list.orgmode.org/877dch89s1.fsf@kyleam.com/
2021-12-09 22:42:56 -05:00
Nicolas Goaziou 14ed651db0 Merge branch 'bugfix' 2021-12-08 12:12:08 +01:00
Nicolas Goaziou a62da701b4 oc-csl: Fix location of \citeprocitem definition
* lisp/oc-csl.el (org-cite-csl-finalizer): Insert \citeprocitem before
"\begin{document}".
2021-12-08 12:09:15 +01:00
Ihor Radchenko 54534eebbb
org-element-cache: Handle some edits in top-level property drawer
* lisp/org-element.el (org-element--cache-sensitive-re): Make proprety
drawer lines sensitive.
(org-element--cache-for-removal): Make sensitive edits inside cache
gap right after org-data re-parse the org-data.  Make sensitive
top-section edits re-parse org-data.

The specific error has been reported in
https://github.com/yantar92/org/issues/40
The recepy involves loading org-contrib:
1. emacs -Q -L ~/.emacs.d/.local/straight/repos/org/lisp -L ~/.emacs.d/.local/straight/repos/org-contrib/lisp -l org
 -l org-eldoc
 2. Create a test.org file with the following content:
 :PROPERTIES:
:ID:       test
:END:

Test.
3.
(goto-char (point-min))
(org-entry-put nil "ID" "test")
(save-buffer)
(org-entry-get nil "ID")
Return value is nil, while should be "test"
2021-12-08 10:31:37 +08:00
Ihor Radchenko 7ac37478ca
org-src.el: Fix nativecomp warnings
* lisp/org-src.el: Declare `org-element--parse-paired-brackets'
function.  Declare `org-src-fontify-natively' variable.
2021-12-08 10:29:39 +08:00
Nicolas Goaziou a78d96ebc0 Merge branch 'bugfix' 2021-12-07 22:52:58 +01:00
Nicolas Goaziou 18d77ac253 oc-basic: Fix completion cache
* lisp/oc-basic.el (org-cite-basic--key-completion-table): Cache
completions per document.  Return nil when no completion is available
so insertion mechanism can properly report the problem.
2021-12-07 22:51:46 +01:00
Nicolas Goaziou a83465add3 oc-basic: Clarify prompt during key completion
* lisp/oc-basic.el (org-cite-basic--complete-key): Clarify prompt
during completion.  Format docstring.
2021-12-07 22:10:39 +01:00
Nicolas Goaziou 2dc4a4da94 Do not require `oc-basic'
Org will take care of loading it when appropriate.
2021-12-05 19:05:49 +01:00
Nicolas Goaziou eaa7817b31 org: Try loading activate processor when initializing fontification
* lisp/org.el (org-set-font-lock-defaults): Try registering activate
processor if appropriate.
2021-12-05 19:04:34 +01:00
Nicolas Goaziou e83a04b5af oc: Make `org-cite-try-load-process' public
* lisp/oc.el (org-cite-try-load-processor): New function.
(org-cite--try-load-processor): Remove function.
(org-cite-store-export-processor):
(org-cite-follow):
(org-cite-insert): Use new function.
2021-12-05 19:02:03 +01:00
Nicolas Goaziou 4f1c878d9a oc: Fix `org-cite--try-load-processor'
* lisp/oc.el (org-cite--try-load-processor): Add missing `intern'
call.
2021-12-05 18:59:24 +01:00
Kyle Meyer ad53c54645 Merge branch 'bugfix' 2021-12-04 21:40:08 -05:00
Stefan Kangas db4805c2d7 Backport commit 50b40e1d4 from Emacs
; * lisp/org/ob-julia.el: Fix Author header for authors.el.
50b40e1d4f0063ac78a53673736a2eaa3ba3287b
Stefan Kangas
Wed Dec 1 17:03:52 2021 +0100
2021-12-04 15:29:43 -05:00
Nicolas Goaziou 191552df35 oc: Fix slowdown on tests
* lisp/oc.el (org-cite--try-load-processor): New function.
(org-cite-store-export-processor):
(org-cite-follow):
(org-cite-insert): Use new function.
(org-cite-get-processor): Do not try to load unknown processor.
Loading now happens at another level.
2021-12-04 18:09:24 +01:00
Ihor Radchenko 9843670d11
org-element--cache-sync: Another take on false positive warnings
* lisp/org-element.el (org-element--cache-sync): Suppress silent edit
warnings for Emacs <28.  In older Emacs, Emacs internal functions can
modify `buffer-chars-modified-tick' and cannot be distinguished from
dangerous edits under `inhibit-modification-hooks'.  Some of the
functions even have the same footprint with the edits we want to
avoid.
2021-12-04 12:52:16 +08:00
TEC 521c534101
org-src: Refactor inline src block fontify lines
* lisp/org-src.el (org-fontify-inline-src-blocks-1): Refactor
`org-fontify-inline-src-blocks-1' to bring down the maximum line
length.  While we're at it, get rid of the debugging `message' call that
somehow made its way in, and an unused variable in the `let' statement.
2021-12-02 19:33:28 +08:00
Ihor Radchenko b59ccbf55b
org-element-at-point: Improve warning message
* lisp/org-element.el (org-element-at-point): Describe warning as
parser error when `org-element--parse-to' throws an error.  The error
may be thrown when parser encounters issue not related to cache.

Fixes confusion in https://list.orgmode.org/871r2vpblx.fsf@yandex.com/T/#u
2021-12-02 18:15:55 +08:00
Ihor Radchenko 328be6df40
org-element--parse-to: Fix skipping sibling optimisation
* lisp/org-element.el (org-element--parse-to): Fallback to normal
parsing when there are no siblings between POS and ELEM-END.

Reported in
https://github.com/yantar92/org/issues/38#issuecomment-982830497
2021-12-02 09:17:51 +08:00
Ihor Radchenko b170b23a5b
Update adadb5b55 for Emacs 26 2021-12-02 08:40:06 +08:00
Nicolas Goaziou ed5335545e lint: Reorder file
Checkers definition are last because this is the part usually expanded.
2021-12-01 16:15:08 +01:00
Nicolas Goaziou b4acde37ba lint: Allow user-defined checkers during linting
* lisp/org-lint.el (org-lint-add-checker): New function.
(org-lint--generate-reports): Checker function now must be specified.
It is not deduced anymore from the name of the checker.
* testing/lisp/test-org-lint.el (test-org-lint/add-checker): New test.
2021-12-01 16:09:13 +01:00
Nicolas Goaziou 6766c45bfd org-lint: Add checkers for citations and related
* lisp/org-lint.el (org-lint--checkers): Register new checkers.
(org-lint-non-existent-bibliography):
(org-lint-missing-print-bibliography):
(org-lint-invalid-cite-export-declaration):
(org-lint-incomplete-citation): New functions.
* testing/lisp/test-org-lint.el (test-org-lint/non-existent-bibliography):
(test-org-lint/missing-print-bibliography):
(test-org-lint/invalid-cite-export-declaration):
(test-org-lint/incomplete-citation): New tests.
2021-11-30 22:21:46 +01:00
Nicolas Goaziou 3744713b8a oc: Make `org-cite-get-processor' public
* lisp/oc.el (org-cite--get-processor): rename to...
(org-cite-get-processor): ... this.
(org-cite-unregister-processor):
(org-cite-processor-has-capability-p):
(org-cite-supported-styles):
(org-cite-activate):
(org-cite-store-export-processor):
(org-cite-export-citation):
(org-cite-export-bibliography):
(org-cite-finalize-export):
(org-cite-follow):
(org-cite-insert): Apply renaming.
2021-11-30 22:21:46 +01:00
Nicolas Goaziou 5d2e2cd1bc oc: Factor out string to cite export processor triplet conversion
* lisp/oc.el (org-cite-read-processor-declaration): New function.
(org-cite-store-export-processor): Use new function.
* testing/lisp/test-oc.el (test-org-cite/read-processor-declaration):
New test.
2021-11-30 22:21:46 +01:00
Ihor Radchenko adadb5b554
org-element--cachy-sync: Add exception for unregistered changes
* lisp/org-element.el (org-element--cache-sync): Another special case
when Emacs <28 silently changes `buffer-chars-modified-tick'.

Fixes https://list.orgmode.org/so53mm$obe$1@ciao.gmane.io/T/#mad982a75885b1eda669d8cf7decee15c3917957b
2021-11-30 20:32:28 +08:00
Ihor Radchenko 8868f0fddd
org-archive-subtree: Speed up archiving
* lisp/org-element.el (org-element--cache-avoid-synchronous-headline-re-parsing):
  New internal variable controlling latency of cache
  `after-change-functions'.

(org-element--cache-for-removal): Use
`org-element--cache-avoid-synchronous-headline-re-parsing' to decide
if we re-parse changed headlines immidiately.
* lisp/org-archive.el (org-archive-subtree): Let-bind
`org-element--cache-avoid-synchronous-headline-re-parsing' to t while
archiving for better speed.
2021-11-30 20:17:56 +08:00
Ihor Radchenko d8a1f34cf6
org-element--current-element: Use explicit regexp to match headline
* lisp/org-element.el (org-element--current-element): Do not call
`org-at-heading-p' to determine if we are at headline element.
`org-at-heading-p' calls `beginning-of-line' and may match
non-headlines as headlines.
2021-11-30 20:17:56 +08:00
Ihor Radchenko 4a2cf81dfb
org-element--cache-for-removal: Fix handling edits before first section
* lisp/org-element.el (org-element--cache-for-removal): Consider edits
within blank before first section destructive and make cache delete
the section even though the edits are technically before its
beginning.
2021-11-30 20:17:55 +08:00
TEC bb6f328847
org-src: Implement native inline src fontification
* lisp/org-src.el (org-fontify-inline-src-blocks,
org-fontify-inline-src-blocks-1): Create a function to search the buffer
up to a limit for inline src blocks.  Light fontification is applied to
matched inline src blocks.  When `org-src-fontify-natively' is
set, `org-src-font-lock-fontify-block' is applied to the content.

* lisp/org.el (org-set-font-lock-defaults): Add
`org-fontify-inline-src-blocks' to `org-font-lock-extra-keywords', which
is locally bound inside `org-set-font-lock-defaults'.

* lisp/org-faces.el: Introduce a new face `org-inline-src-block' which
inherits from `org-block' by default.
2021-11-30 12:14:11 +08:00
Sun Lin f9dcc3d665
ob-plantuml: fix DISPLAY error with html export
* lisp/ob-plantuml.el (org-babel-execute:plantuml): Use headless mode
for Org calling plantuml for exporting to html to avoid issues with
operations that normally try to access the system graphics stack.
2021-11-30 12:14:11 +08:00
Nicolas Goaziou 0bf211a340 oc: Opportunistically load processors
* lisp/oc.el (org-cite--get-processor): Try requiring 'oc-NAME where
name is the name of the processor used.
(org-cite-register-processor): Do not use `org-cite--get-processor' to
avoid circular requires.

Suggested-by: Timothy <tecosaur@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-11/msg00664.html>
2021-11-29 23:46:00 +01:00
TEC 9ce7802b79
ob-tangle: allow ls -l style suid/sgid tangle mode
* lisp/ob-tangle.el (org-babel-interpret-file-mode): Modify the regexp
for the ls -l style tangle file mode to allow for the suid/sgid bits to
be set.  While I was at it I noticed that the a= parameter should have
been o=, and so that has been fixed too.

The sticky bit is ignored, but that is not a concern as it is only
relevant to directories.
2021-11-30 02:48:03 +08:00
Nicolas Goaziou 5e35de34a6 Merge branch 'bugfix' 2021-11-28 20:44:44 +01:00
Rasmus c91271297d ox-latex: Fix asynchronous export
* lisp/ox-latex.el (org-latex-export-to-pdf): Fix "invalid-read-syntax
'#'" when exporting asynchronously with ox-latex.

See also previous bug report: https://lists.gnu.org/archive/html/emacs-orgmode/2021-06/msg00422.html
2021-11-28 20:44:22 +01:00
Stefan Kangas 36086a4f49 Backport commit 1fffe9a21 from Emacs
; * lisp/org/org.el: Fix version header.
1fffe9a210d328559da2af8facbb75286a31c74e
Stefan Kangas
Sun Nov 28 14:54:24 2021 +0100
2021-11-28 10:46:50 -05:00
Ihor Radchenko c84c71b093
org-element-at-point: Report POM when parser throws error
* lisp/org-element.el (org-element-at-point): Mention the value of POM
in warning text when `org-element--parse-to' fails with error.
2021-11-27 12:20:33 +08:00
Ihor Radchenko e1aebc1a41
org-element--cache-for-removal: Error out of irrecoverable failure
* lisp/org-element.el (org-element--cache-for-removal): Consider wrong
parent to be critical failure: reset the cache and abort current
command.
2021-11-27 12:08:45 +08:00
Ihor Radchenko 49df468849
org-element-cache-map: Report pre-process time in statistics
* lisp/org-element.el (org-element-cache-map): Calculate time elapsed
while filling the cache gaps during pre-processing.
2021-11-27 12:08:44 +08:00
Nicolas Goaziou 8ddd95e5a3 Merge branch 'bugfix' 2021-11-26 12:20:59 +01:00
Nicolas Goaziou afc5ec2187 oc-csl: "Barf" functions should actually barf
* lisp/oc-csl.el (org-cite-csl--barf-without-citeproc): Actually raise
an error, as expected from the docstring.
2021-11-26 12:20:36 +01:00
Nicolas Goaziou 25640ace0f Merge branch 'bugfix' 2021-11-26 11:44:30 +01:00
Nicolas Goaziou 2b0007a808 ox: Add autoload cookies
* lisp/ox.el (org-export-derived-backend-p):
(org-export-data):
(org-export-raw-string): Autoload function.

These functions are required at runtime by some other libraries (e.g.,
"oc-basic.el"), which cannot require `ox' because of circular
dependencies.

In particular, this fixes
<http://lists.gnu.org/r/emacs-orgmode/2021-11/msg00594.html>.
2021-11-26 11:40:28 +01:00
Ihor Radchenko 20ed794b92
org-element-parse-buffer: Avoid excessive garbage collection
* lisp/org-element.el (org-element-parse-buffer): Increase
`gc-cons-threshold' to improve performance.  In my tests on large Org
buffers, garbage collection took 50% of the time without increasing
the threshold.
2021-11-25 18:39:24 +08:00
Ihor Radchenko 08e595f312
org-agenda-get-scheduled: Fix wrong matches when WITH-HOUR is non-nil
* lisp/org-agenda.el (org-agenda-get-scheduled): Do not rely on regex
match to judge that current headline is scheduled with time when
WITH-HOUR argument is non-nil.  Limit regexp search when looking for
scheduled timestamp in current headline and intentionally signal
search error if something went wrong (headline without scheduled
timestamp in planning line must not be encountered at this point in
the code).

This commit continues 77a9932b0 and 82197761.
2021-11-25 18:39:11 +08:00
Nicolas Goaziou b3cc2f793b Merge branch 'bugfix' 2021-11-24 22:51:41 +01:00
Nicolas Goaziou 30a6126bb9 oc: Fix `org-cite-fontify-default' docstring and simplify code
* lisp/oc.el (org-cite-fontify-default): We don't need to assume
activate processor may be used on a citation reference: that will not
happen.
2021-11-24 22:50:09 +01:00
Nicolas Goaziou 308f4cb570 oc: Ensure activation returns a non-nil value
* lisp/oc.el (org-cite-activate): Return a non-nil value when
successful, even if citation processor doesn't.
2021-11-24 22:39:50 +01:00
Ihor Radchenko e76c29a586
org-element-cache-map: Update docstring 2021-11-24 20:09:56 +08:00
Ihor Radchenko cc3b468657
org-element-cache: Use 'org-element-cache warning type
* lisp/org-element.el (org-element--cache-log-message):
(org-element--cache-warn): Use special 'org-element-cache warning
type to display warnings.
2021-11-24 20:09:55 +08:00
Bastien 77a9932b03 lisp/org-agenda.el:
* lisp/org-agenda.el (org-agenda-get-scheduled): Don't throw an
error when the search for the regular expression fails.

This completes 82197761.
2021-11-24 09:02:28 +01:00
Ihor Radchenko 4b1def3c5c
org-table.el: Do not create new field when at EOL after table line
* lisp/org-table.el (org-table-justify-field-maybe): Do not treat "|$"
as unclosed table field.

Fixes https://orgmode.org/list/trinity-2561db57-1561-470b-982f-0d91ddf4f145-1629900012884@3c-app-mailcom-lxa06
2021-11-23 21:40:58 +08:00
Ihor Radchenko b5f992b678
org-table.el: Do not create new field when at EOL after table line
* lisp/org-table.el (org-table-justify-field-maybe): Do not treat "|$"
as unclosed table field.

Fixes https://orgmode.org/list/trinity-2561db57-1561-470b-982f-0d91ddf4f145-1629900012884@3c-app-mailcom-lxa06
2021-11-23 21:14:44 +08:00
Ihor Radchenko dd173bf451
org-get-buffer-tags: Use cache 2021-11-23 21:14:43 +08:00
Matt Huszagh 912cf21494
org.el: Fix missing arg in string-match-p call
* lisp/org.el (org-display-inline-image--width): `string-match-p'
requires two arguments, but the second one was missing.
2021-11-23 13:40:40 +08:00
Kyle Meyer 27f26f7829 org-display-inline-image--width: Fix syntax error from last commit
* lisp/org.el (org-display-inline-image--width): Fix unbalanced
parentheses and reference to free variable introduced in last commit.
2021-11-22 23:44:15 -05:00
TEC 4514a324c8
org: More carefully interpret image width attrs
* lisp/org.el (org-display-inline-image--width): Before attempting to
interpret a :width attribute numerically, check that it indeed starts
with a digit and use the default value given by `org-image-actual-width'
if not.  However, if a value of "t" is given, treat this as if
`org-image-actual-width' were "t" and just use the image's pixel width.

This change fixes a strange behaviour where a non-numeric width would
previously display the image with zero width.
2021-11-23 01:52:19 +08:00
Ihor Radchenko 17d4b31a84
org-element--cache-before-change: Make sure that rx expr is always valid
* lisp/org-element.el (org-element--cache-before-change): Make sure
that we never construct (repeat 1 0 "*") rx expr.

Hopefully fixes https://list.orgmode.org/d8749145-29b9-39d6-5bbe-4b7e765792e5@ctpowe.net/T/#u
2021-11-22 19:38:36 +08:00
Ihor Radchenko 7a14d6035c
Fix element property queries for inlinetasks
* lisp/org.el (org-get-tags): Do not ignore local tags in inlinetasks.
(org-in-commented-heading-p): Do not ignore commented inlinetasks.
* testing/lisp/test-org.el (test-org/get-tags): Add tests for
inlinetasks.

Fixes https://list.orgmode.org/CAKJdtO8-KkVvhcviTqhi+DMZmSK=o37jn1jJPM9qxcuXZPnGgw@mail.gmail.com/T/#u
2021-11-22 19:34:21 +08:00
Matt Huszagh cd3e138ee5
org.el: Improve inline image width calculation
* lisp/org.el (org-display-inline-image--width): When
display-line-numbers-width is nil, the width is computed dynamically.
This does not mean that the line number width is necessarily 0.
2021-11-22 03:13:04 +08:00
Ihor Radchenko 54da1d6d7b
org-element--cache-process-request: Fix phase 2 with nil parent field
* lisp/org-element.el (org-element--cache-process-request): Fix
potential error raised when merging phase 2 requests with current
request having nil parent field.

Should help with https://list.orgmode.org/PAXPR08MB664034C85DDC73D21AD1CB0FA39E9@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#t
2021-11-21 17:52:40 +08:00
Ihor Radchenko 28d47cfb82
org-element--cache-sync: Do not show warning on known safe modifications
* lisp/org-element.el (org-element--cache-sync): Do not raise warning
when `buffer-chars-modified-tick' changes safely outside
org-element-cache visibility.  Safe modifications are detected
according to heuristics based on `buffer-chars-modified-tick' and
`buffer-modified-tick'.  Their difference contains footprint for some
known [1,2,3] modifications triggered by Emacs internals.  However,
still reset cache to avoid false-positives for all but one [1] type of
modification.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01069.html
[2] https://list.orgmode.org/YYy9Hx8mNQN08U7e@smoon.bkoty.ru/T/#t
[3] https://list.orgmode.org/87ee7jdv70.fsf@localhost/T/#t
2021-11-21 16:26:00 +08:00
Clément Pit-Claudel ebd06c15b5
org-src: Reset buffer-modified-p after fontifying
* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: "Save buffer *org-src-fontification:...-mode*?".
2021-11-21 14:59:43 +08:00
Kyle Meyer 27edae8ced tangle: Fix :version keyword of org-babel-tangle-default-file-mode
* lisp/ob-tangle.el (org-babel-tangle-default-file-mode): Prefer
":package-version" to ":version".

The :version keyword should correspond to the Emacs version.  Using
the Org version leads to an incorrect help message:

  This variable was introduced, or its default value was changed, in
  version 9.6 of Emacs.

Instead go through :package-version so that the displayed message is

  This variable was introduced, or its default value was changed, in
  version 9.6 of the Org package that is part of Emacs 29.1.
2021-11-20 14:36:21 -05:00
Kyle Meyer 58cc9efd7d Update customize-package-emacs-version-alist
* lisp/org.el (customize-package-emacs-version-alist): Map Org 9.6 to
Emacs 29.1.

Emacs 28.1 is nearing release.  The earliest Emacs version that Org
9.6 would be synced with is 29.1.
2021-11-20 14:36:10 -05:00
TEC e6ae351f96
ob-tangle: Rename org-babel-tangle-default-mode
* lisp/ob-tangle.el (org-babel-tangle-default-mode,
org-babel-interpret-file-mode): Rename `org-babel-tangle-default-mode`
to the slightly more apt `org-babel-tangle-default-file-mode`, and
update `org-babel-interpret-file-mode` accordingly.
2021-11-21 03:06:19 +08:00
Nicolas Goaziou 1db301a758 element: Drop `org-end-of-subtree' use
* lisp/org-element.el (org-element-headline-parser): Implement
a simple end of subtree search instead of relying on
`org-end-of-subtree'.
2021-11-20 19:54:41 +01:00
Kyle Meyer 69dbe86625 org-element: Silence byte-compiler
* lisp/org-element.el (org-element--cache-gapless): Move definition
before first use to remove byte-compiler warning about assignment to
free variable.
2021-11-20 13:52:48 -05:00
Bruce D'Arcus 9b398ba626 oc-basic: Add function to shorten names
* lisp/oc-basic.el (org-cite-basic--shorten-names): new function to
shorten author names

* lisp/oc-basic.el (org-cite-basic--print-entry): shorten author name
list for the "plain" output style
2021-11-20 19:40:36 +01:00
TEC 048f478799
ob-tangle: Make ls-style file mode regex stricter
* lisp/ob-tangle (org-babel-interpret-file-mode): Instead of allowing 9
characters from [rwx-], require [r-][w-][x-] repeated thrice.  This no
longer allows invalid ls-style file modes.
2021-11-20 22:57:20 +08:00
TEC ff6fd93876
ob-tangle: Check that integer file modes are valid
* lisp/ob-tangle.el (org-babel-interpret-file-mode): Check that the
integer as an octal represents a valid file mode, and complain
otherwise.
2021-11-20 22:57:20 +08:00
TEC 3a6686010e
ob-tangle: Use oXXX as file mode octal shorthand
* lisp/ob-tangle (org-babel-interpret-file-mode): Accept "o755" and
similar as octal shorthand. A non-digit character must be included as
otherwise `org-babel-parse-header-arguments' will convert it to a
base-10 integer.
2021-11-20 22:57:20 +08:00
Nicolas Goaziou 26e68816bd element: Integrate some syntax constants
* lisp/org-element.el (org-element-archive-tag):
(org-element-clock-line-re):
(org-element-comment-string):
(org-element-closed-keyword):
(org-element-deadline-keyword):
(org-element-scheduled-keyword):
(org-element-planning-keywords-re):
(org-element-planning-line-re):
(org-element-drawer-re):
(org-element-dynamic-block-open-re):
(org-element-headline-re): New constants.
(org-element-drawer-parser):
(org-element-dynamic-block-parser):
(org-element--footnote-separator):
(org-element--get-node-properties):
(org-element--get-time-properties):
(org-element-headline-parser):
(org-element-headline-interpreter):
(org-element-inlinetask-parser):
(org-element--list-struct):
(org-element-paragraph-parser):
(org-element-planning-parser):
(org-element-planning-interpreter):
(org-element--current-element):
(org-element--cache-for-removal):
(org-element-cache-map):
(org-element-context): Use new constants so as to not use org.el's.
* testing/lisp/test-org-element.el (test-org-element/headline-comment-keyword):
(test-org-element/headline-archive-tag):
* testing/lisp/test-ox.el (test-org-export/handle-options): Fix tests.
2021-11-20 11:37:52 +01:00
Nicolas Goaziou 652e8db821 Merge branch 'bugfix' 2021-11-19 09:53:56 +01:00
Nicolas Goaziou a51e4dc710 ox-icalendar: Fix error dangling footnotes
* lisp/ox-icalendar.el (icalendar): Add an inner-template function so
as to not use "ox-ascii"'s.
(org-icalendar-inner-template): New function.

This fixes <https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg01478.html>
and <http://lists.gnu.org/r/emacs-orgmode/2021-11/msg00395.html>.

Footnote definition is lost, but references are already removed from
the description anyway, so the problem is not worse.
2021-11-19 09:53:13 +01:00
Jeremie Juste 58db28db04
ob-R: Tidy up bits of the async implementation
* ob-R.el (ob-session-async-org-babel-R-evaluate-session): Use
defvaralias for `ess-eval-visibly-p' instead of modifying user-defined
variable.  Remove temporary declaration that silences the byte-compiler.

* ob-R.el (org-babel-R-evaluate,
ob-session-async-org-babel-R-evaluate-session, org-babel-R-evaluate):
Remove mentions of unused argument `result-params'.
2021-11-18 18:42:38 +08:00
TEC fa97f9a395
ob-tangle: Accept more :tangle-mode forms
* lisp/ob-tangle.el (org-babel-tangle): Accept many more forms for
:tangle-mode, including octal strings (#o755, 0755, 755), ls forms (rwx,
rw-r--r--), and chmod forms (a=rw,u+x).  The interpretation of the input
is now handled by the new function `org-babel-interpret-file-mode' which
references the new variable `org-babel-tangle-default-mode' when
considering relative mode forms.
2021-11-18 18:18:00 +08:00
Ihor Radchenko faf8ce7dee
org-element--cache-sync: Ignore some more silent changes
* lisp/org-element.el (org-element--cache-sync): Add heuristics
skipping silent buffer changes made by quail.el when inserting "S-\"
using computer-russian input method.

Reported in https://list.orgmode.org/smre9o$hn1$1@ciao.gmane.io/
2021-11-15 19:39:29 +08:00
Ihor Radchenko bc3f385c97
org-element--cache-diagnostics-modifications: Fix docstring width 2021-11-15 19:39:28 +08:00
Ihor Radchenko fefb867d91
org-persist-write-all: Fix when BUFFER is nil 2021-11-15 19:39:17 +08:00
Nicolas Goaziou 2bbac432a8 org-element: Remove dependency on ’org-emph-re’
* lisp/org-element.el (org-element--parse-generic-emphasis): New fuction.
(org-element-bold-parser):
(org-element-code-parser):
(org-element-italic-parser):
(org-element-strike-through-parser):
(org-element-underline-parser):
(org-element-verbatim-parser): Use new function.

The consequence of this patch is that the syntax does not inherit from
unrelated limitations from ‘org-emph-re’, i.e., the number of lines
allowed in the markup.
2021-11-15 10:47:03 +01:00
Nicolas Goaziou c47b535bbd org-element: Remove dependency on ‘org-emphasis-regexp-components’
* lisp/org-element.el (org-element--set-regexps): Hard-code syntax,
since this is not configurable.
2021-11-14 15:13:41 +01:00