* lisp/org-element.el (org-element-headline-parser): Store :true-level
property.
(org-element--parse-to): Call `org-get-limited-outline-regexp'
directly rather than via `org-with-limited-levels'. Avoid moving
point unnecessarily. Prefer `org-headline-re' to generate regexps.
* lisp/org-macs.el (org-headline-re):
(org-skip-whitespace): Inline.
* lisp/org-element.el (org-element--current-element): Try hard
spending minimal amount of time in testing which parser to call.
Prefer `look-at-p' that does not modify match data and thus save us
significant amount of time. Do not call `org-with-limited-levels' and
instead use the simplest possible tests with all unnecessary branches
removed. Add commentary explaining the importance of writing fast
core when adding new elements.
(org-inlinetask-min-level): Declare variable.
* lisp/org-list.el (org--item-re-cache):
(org-item-re): Cache results rather than calculating regexp every time
the parser is invoked.
* lisp/org-macs.el:
(org--headline-re-cache):
(org--headline-re-cache-no-bol):
(org--headline-re-cache-bol):
(org-headline-re): Prefer plists to store headline regexp cache - the
number of items tends to be within 10-20 and hence hash table is an
overkill and will be slower.
* lisp/org-macs.el (org-headline-re): New function to retrieve cached
or get a new regexp for headline of level TRUE-LEVEL.
(org-get-limited-outline-regexp): Use `org-headline-re'. Add new
optional argument WITH-BOL.
* lisp/org.el (org-time-stamp-formats):
(org-timestamp-formats):
(org-time-stamp-rounding-minutes):
(org-timestamp-rounding-minutes):
(org-time-stamp-custom-formats):
(org-timestamp-custom-formats):
(org-time-stamp):
(org-timestamp):
(org-time-stamp-inactive):
(org-timestamp-inactive):
(org-insert-time-stamp):
(org-insert-timestamp):
(org-toggle-time-stamp-overlays):
(org-toggle-timestamp-overlays):
(org-time-stamp-to-now):
(org-timestamp-to-now):
* lisp/ox.el (org-export-time-stamp-file):
(org-export-timestamp-file): Rename using "timestamp" term, keeping
the old name as alias.
* doc/org-manual.org: Update all the uses, adding #+findex and
#+vindex entries. Keep the alias names for searchability.
Adjust all the callers.
The following "time-stamp" uses are unchanged:
1. `org-time-stamp-format' where obsolete and _different_ function
`org-timestamp-format' still exists.
2. :time-stamp-file property in export INFO plist. Changing this
would be breaking.
3. ORG-NEWS remains unchanged.
* lisp/org-macs.el (org-id-uuid): Use built-in `time-convert' instead
of function defined in org-compat. `time-convert' can already be used
as it is available in Emacs 26.
Fix build when Org's version changes
* lisp/org/org-macs.el (org--inhibit-version-check): Rename from
'org--built-in-p' and make it a defvar. All users changed.
(Bug#62762)
62e4eb8fcf71a852117b372809bd4a7953f9b679
Eli Zaretskii
Mon Apr 24 14:16:05 2023 +0300
* lisp/org-macs.el (org--built-in-p): New constant indicating if Org
source is a part of Emacs source tree.
(org-assert-version): Skip check when Org is built-in.
* lisp/org-macs.el (org-sxhash-safe): New function to calculate object
hashes. Unlike `sxhash', the new function ensures that
if (= (org-sxhash-safe A) (org-sxhash-safe b)) then (equal A B)
Not just the opposite.
* lisp/ob-core.el (org-babel-temp-stable-file): Use the new function.
Reported-by: Thomas Worthington <thomas.worthington@cosector.com>
Link: https://orgmode.org/list/877cwrcdh2.fsf@localhost
* org-id.el (org-id-uuid): Move to org-macs.el.
* org.el (org-uuidgen-p): Move to org-macs.el. Expose regexp used to
match UUID.
* org-macs.el (org-uuid-regexp): Refactor `org-uuidgen-p' to expose
regexp used to match UUID.
* lisp/org-macs.el (org-assert-version): Explicitly state that Org
loading is aborted. Some users otherwise assume that the warning can
be ignored. Also, remove sentence about `load-path' as it is
explained later in the warning text.
* lisp/org-macs.el (org-compile-file, org-compile-file-commands):
Pull out the logic transforming process descriptions to commands to be
executed into a new function, `org-compile-file-commands'.
`org-compile-file' is now solely concerned with running the commands and
reporting the result.
* lisp/org-macs.el (org-assert-version): Make quoting "'" in the
message more readable.
Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for the
suggestion.
* lisp/org-macs.el (org-string-width): Do not err when current window
is dedicated. Force-remove dedicated status temporarily during the
call. This should be safe as we only need to take over the window
temporarily to hook into Emacs display and calculate the string
width.
Reported-by: Bruno BARBIER <brubar.cs@gmail.com>
Link: https://orgmode.org/list/63662793.5d0a0220.62647.3003@mx.google.com
* lisp/org-macs.el (org-with-base-buffer): New macro to run code in
base buffer of current or given buffer.
* lisp/org-element.el (org-element-org-data-parser):
(org-element--cache-find):
(org-element--cache-sync):
(org-element--cache-before-change):
(org-element--cache-after-change):
(org-element--cache-submit-request):
(org-persist-after-read-hook): Use the new macro.
* lisp/org-macs.el (org-file-newer-than-p): Recommend passing file
modification time instead of wall time to avoid truncation of timestamp
precision for the sake of filesystems with coarse time resolution.
(org-compile-file): Store file modification time instead of system clock
for later comparison by `org-file-newer-than-p'.
* lisp/org.el (org-babel-load-file): Use `file-newer-than-file-p'
instead of `org-file-newer-than-p' since the former is more suitable
for target-prerequisite relation in the case of equal timestamps.
Improve error reporting when source file does not exist.
Update timestamp after tangling of an org file, not before it.
This is assumed to be a better fix of the problem with change of time
representation in Emacs-29. The problem was reported by Mark Barton
<mbarton98@gmail.com> in
https://list.orgmode.org/BF5B9308-3FEF-4DC6-98C9-BFF36F19D36C@gmail.com
Paul Eggert <eggert@cs.ucla.edu> committed another variant to Emacs
as 3abb3681b5. It was ported to Org as commit 56ba22b9df several months
later.
Unchanged timestamp of a file means failure of `org-compile-file' but in
`org-babel-load-file' the target may be considered as up to date if its
timestamp is equal to the one for the prerequisite.
So `org-file-newer-than-p' is not suitable for both cases. The
difference matters for filesystems with coarse timestamp resolution, for
example HFS+.
Earlier call of `org-babel-load-file' for a non-existing .org file
caused "Bad bounding indices: 0, 2" error.
Update file timestamp (introduced by the commit 1525a5a64e)
after tangling of the file. Change caused by conflict resolution during
rebasing of the initial version of the patch. See
https://list.orgmode.org/t75efi$9pv$1@ciao.gmane.io for an argument
in support of such change.
Move org-current-text-indentation upstream of first use to avoid 'make
single' (and the Emacs repo) reporting
org-macs.el:1106:11: Warning: macro ‘org-current-text-indentation’ defined too
late
Make point-at-eol and point-at-bol obsolete
b7e867b841f47dcff3aeaef9b5608a237386ce70
Stefan Kangas
Tue Aug 23 04:54:57 2022 +0200
[ km: This was independently covered on the main branch with
e73c5b7d0. I'm applying it here too for bookkeeping/traceability
purposes. ]
Byte-compiler problem reported by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg01256.html
* lisp/org-compat.el (org-at-table.el-p):
Now declared in org-table, not org.
(org-string-collate-lessp): Define the ersatz
org-string-collate-lessp with the same API as the primary form, to
pacify check-declare-file when run on org-macs.
* lisp/org-macs.el (org-time-convert-to-integer): Declare.
Pacify byte compiler etc. on org-compat, org-macs
fa1a7ac617619ef015e02e72950eef219ec62336
Paul Eggert
Thu Apr 28 13:41:35 2022 -0700
* lisp/org-macs.el (org-file-newer-than-p):
Don’t assume list-format timestamps, by using
org-time-convert-to-integer instead of doing it by hand.
Use org-time-convert-to-integer instead of by hand
3abb3681b57d7c8ca7fa808addb0a10b6b109cab
Paul Eggert
Wed Apr 27 00:30:25 2022 -0700
* lisp/ol.el (org-store-link):
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-2ft, org-matcher-time):
* lisp/org-table.el (org-table-eval-formula):
* lisp/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Don’t assume Emacs 27 encode-time, since standalone Org still
works with Emacs 25 and it’s easier if we minimize differences
from standalone Org. Problem reported by Max Nikulin (Bug#54731).
This reverts much of 2021-12-16T17:40:21Z!eggert@cs.ucla.edu.
Port Org encode-time usage back to Emacs 25
8ef37913d3be5ff518018acb6b0144d6e559b5ba
Paul Eggert
Tue Apr 5 17:52:34 2022 -0700
[ km: See main's 8908a1bda (org-macs.el: Introduce a helper for
`encode-time', 2022-07-17). ]
* lisp/ol.el (org-store-link):
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-2ft, org-matcher-time):
* lisp/org-table.el (org-table-eval-formula):
* lisp/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Prefer (encode-time L) to (apply #'encode-time L) where either will do.
* lisp/org-clock.el (org-clocktable-steps):
Prefer (encode-time S M ...) to (apply #'encode-time (list S M ...)).
encode-time simplifications
dd0727e1ec1f535b9b06be88173b4d3ccd55abcb
Paul Eggert
Thu Dec 16 11:17:25 2021 -0800
[ km: Note that these changes will be reverted by the port of Emacs's
8ef37913d. ]
* lisp/org-macs.el (org-current-text-indentation): New macro
calculating the real text indentation disregarding buffer visibility.
(org-do-remove-indentation):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-indent-line):
(org-indent-region):
(org-toggle-fixed-width):
(org-comment-or-uncomment-region):
* lisp/ox.el (org-export-expand-include-keyword): Use
`org-current-text-indentation' instead of `current-indentation' and
`org-current-text-column' instead of `current-column' when we need
real text values but not visible values.
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56837
Reported-by: tony aldon <tony.aldon.adm@gmail.com>
Link: https://orgmode.org/list/87k0h49s7z.fsf@localhost
* 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
* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Do not use
obsolete `buffer-file-name' generalized variable. Prefer
`set-visited-file-name'.
* lisp/ol-bibtex.el (org-indent-region): Declare function.
(org-bibtex-import-from-file): Remove unused variable.
* lisp/ol.el (org-link--decode-compound): Use `ash' instead of
obsolete `lsh'.
* lisp/org-macs.el: Do no use obsolete generalized variable
`buffer-string'.
* lisp/org-plot.el (org-plot/redisplay-img-in-buffer):
* lisp/org.el (image-flush):
(org-display-inline-images): Use `image-flush' instead of obsolete
`image-refresh'.
* lisp/ox.el (org-export-to-file): Quote ' in the docstring.
All other changes are changing obsolete `point-at-bol' and
`point-at-eol' to `line-beginning-position' and `line-end-position'.
* lisp/org-macs.el (org-unbracket-string): Handle empty suffix string.
* lisp/ol-info.el (org-info--link-file-node):
(org-info-description-as-command): Use `org-trim' and
`org-unbracket-string' instead of `string-trim' and
`string-remove-prefix' from the subr-x package.
* lisp/org-fold-core.el: Remove the code overriding
`font-lock-default-fontify-region'. Emacs itself is skipping
fontification of invisible text and doing it more efficiently. The
org-fold fontification overrides are redundant, except when some
poorly written third-party code is forcing fontification inside folded
regions. However, Org does not need to entertain poorly written third
party code, especially when the required supporting code is reducing
font-lock performance and is complicating the maintenance.
(org-fold-core--specs):
(org-fold-core-add-folding-spec): Remove `:font-lock-skip' spec.
(org-fold-core-initialize):
(org-fold-core--fontifying):
(org-fold-core-region):
(org-fold-core--force-fontification):
(org-fold-core-fontify-region): Remove custom fontification.
* lisp/org-fold.el (org-fold-initialize): Remove `:font-lock-skip'
spec.
* lisp/org-macs.el (org-fold-core--force-fontification):
(org-with-forced-fontification):
(org-buffer-substring-fontified):
(org-looking-at-fontified): Remove org-fold's font-lock logic.