summaryrefslogtreecommitdiff
path: root/lisp/org-list.el
AgeCommit message (Collapse)Author
2024-05-28Merge branch 'km/from-emacs-master'Kyle Meyer
2024-05-28Backport commit 0f3be9596 from EmacsStefan Kangas
; Prefer finder keyword "text" to deprecated keyword "wp" 0f3be9596fb3cf2f5e8f10fe2b3ef59546de98bb Stefan Kangas Sat Dec 30 18:14:40 2023 +0100
2024-05-11org: New Org-wide custom option `org-sort-function'Ihor Radchenko
* lisp/org-macs.el (org-sort-function): New customization defining how Org mode should sort headlines, table lines, agenda lines, etc. (org-string<): (org-string<=): (org-string>=): (org-string>): Use the new customization. (org-string<>): Add docstring. (org-sort-function-fallback): New helper function to help users on MacOS where `string-collate-lessp' is not reliable. * lisp/oc-basic.el (org-cite-basic--field-less-p): * lisp/org-agenda.el (org-cmp-category): (org-cmp-alpha): * lisp/org-list.el (org-sort-list): * lisp/org-mouse.el (org-mouse-list-options-menu): * lisp/org-table.el (org-table-sort-lines): * lisp/org.el (org-tags-sort-function): (org-sort-entries): * lisp/ox-publish.el (org-publish-sitemap): Honor the new customization. * lisp/org-mouse.el (org-mouse-tag-menu): (org-mouse-popup-global-menu): * lisp/org-agenda.el (org-cmp-tag): Honor `org-tags-sort-function' and falling back to `org-string<' if note set. * etc/ORG-NEWS (New option controlling how Org mode sorts things ~org-sort-function~): Announce the change. This change aims to standardize the way Org mode performs sorting of user data. In particular, it addresses issues with oddities of string collation rules on MacOS and tricky language environments like Turkish. Link: https://orgmode.org/list/87jzleptcs.fsf@localhost
2024-02-02 lisp/org-list.el (org-list-swap-items): Fix re-folding after swapIhor Radchenko
2024-01-06Merge branch 'bugfix'Kyle Meyer
2024-01-06Backport commit 8e1c56ae4 from EmacsPo Lu
; Add 2024 to copyright years 8e1c56ae46754dd7baedff49a464f078f0e9912d Po Lu Tue Jan 2 09:47:10 2024 +0800
2023-10-05org-reset-checkbox-state-subtree: Do not reset outside the subtreeIhor Radchenko
* lisp/org-list.el (org-update-checkbox-count): Allow ALL argument to have a value `narrow', meaning "update in accessible portion of the buffer". Update the docstring accordingly. (org-update-checkbox-count-maybe): Document the special value of ALL argument passed to `org-update-checkbox-count'. (org-reset-checkbox-state-subtree): Update checkbox count within subtree only. Reported-by: J. G. <jerzor@pacbell.net> Link: https://orgmode.org/list/1700336757.1605468.1695739462846@mail.yahoo.com
2023-07-01Prefer `forward-line' over `beginning-of-line'Ihor Radchenko
The latter is much slower. Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01org-item-re: Convert into defsubstIhor Radchenko
* lisp/org-list.el (org-item-re): Use faster `defsubst'. This function is called very frequently when parsing Org buffers by `org-element--current-element'.
2023-07-01org-at-item-p: Use org-element APIIhor Radchenko
2023-07-01org-element: New `org-element-*property*' functionsIhor Radchenko
* lisp/org-element.el (org-element-begin): (org-element-end): (org-element-contents-begin): (org-element-contents-end): (org-element-post-affiliated): (org-element-post-blank): New functions for fast access to frequently used element properties. The functions are `setf'-able. Update all the relevant code in Org to use the new functions instead of genetic property queries.
2023-07-01org-element-lineage: Allow TYPES to be a symbolIhor Radchenko
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument to be a symbol. * lisp/ox-ascii.el (org-ascii--current-text-width): (org-ascii-format-inlinetask-default): (org-ascii-section): * lisp/ox-beamer.el (org-beamer--format-block): * lisp/ox-html.el (org-html-section): (org-html-table-cell): (org-html-table-row): * lisp/ox-latex.el (org-latex-table-cell): (org-latex-table-row): * lisp/ox-odt.el (org-odt-headline): (org-odt-table-style-spec): (org-odt-get-table-cell-styles): (org-odt-table-cell): (org-odt-table-row): * lisp/ox-org.el (org-org-section): * lisp/ox-publish.el (org-publish-collect-index): * lisp/ox-texinfo.el (org-texinfo--get-node): (org-texinfo-section): (org-texinfo-table-row): * lisp/ox.el (org-export--skip-p): (org-export-get-node-property): (org-export-table-cell-borders): (org-export-table-row-in-header-p): (org-export-table-row-number): (org-export-collect-headlines): Update all the callers.
2023-07-01Rename `org-export-get-parent' to `org-element-parent'Ihor Radchenko
2023-07-01org-element-parse-buffer: New optional argument to not force undeferIhor Radchenko
* lisp/org-element.el (org-element-parse-buffer): Do not force-undefer when new optional argument is provided. * lisp/org-lint.el (org-lint--generate-reports): * lisp/org.el (org-unindent-buffer): * lisp/ox.el (org-export--missing-definitions): (org-export--annotate-info): Do not undefer when unnecessary. Adjust all the declare forms.
2023-07-01Use `org-element-type-p'Ihor Radchenko
Use `org-element-type-p' across Org source, except some tests, where `eq' can produce more meaningful failure explanations.
2023-07-01Use new function names `org-element-extract' and `org-element-set'Ihor Radchenko
2023-05-18org-element--current-element: Micro optimizationsIhor Radchenko
* 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.
2023-05-14org-update-checkbox-count: Disable fold modification checkIhor Radchenko
2023-04-30Prefer "timestamp" over "time-stamp"Ihor Radchenko
* 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.
2023-04-20Prefer "backend" over "back-end"Ihor Radchenko
* doc/org-manual.org (Exporting): Add cindex entry for both "backend" and "back-end" for better searchability. All other changes are trivial. Note that `org-element-export-snippet-parser' will still use :back-end property. So will ox.el in INFO channel.
2023-02-04Preserve active region after structure editsIhor Radchenko
* lisp/org-list.el (org-list-indent-item-generic): * lisp/org.el (org-do-promote): (org-do-demote): Do not deactivate mark after edits. (org-metadown): (org-metaup): Do not deactivate mark and do not exchange point and mark in region. * etc/ORG-NEWS (Datetree structure headlines can now be complex): Announce the change.
2023-01-01Backport commit cae528457 from EmacsEli Zaretskii
; Add 2023 to copyright years. cae528457cb862dc886a34240c9d4c73035b6659 Eli Zaretskii Sun Jan 1 05:31:12 2023 -0500
2022-11-13Silence byte-compiler under 'make single'Kyle Meyer
The org-list and org-priority warnings would show up when these changes made their way to the Emacs repo. (The ob-eval warning wouldn't because string-empty-p has been moved to simple.el in Emacs's master branch.)
2022-11-11org-toggle-item: Move footnote-definitions out of the listsIhor Radchenko
* lisp/org-list.el (org-toggle-item): When headings contain footnote-definitions, move them out of the list. Footnote-definitions must not be indented and hence cannot belong to the list. Ensure that definitions do not slurp the following element after the list. Consider when the list created by `org-toggle-item' is continued by an existing list. * testing/lisp/test-org-list.el (test-org-list/toggle-item): Add tests. Reported-by: Ypo <ypuntot@gmail.com> Link: https://orgmode.org/list/877d3k70lu.fsf@localhost
2022-10-04Merge branch 'km/from-emacs-master'Kyle Meyer
2022-10-04Backport commit b7e867b84 from EmacsStefan Kangas
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. ]
2022-10-04Do not use visual `current-indentation' when we need real valuesIhor Radchenko
* 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
2022-09-06Fix Emacs 29 compiler warningsIhor Radchenko
* 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'.
2022-09-04Assert all the Org files to load the same Org versionIhor Radchenko
* lisp/org-compat.el (org-assert-version): New macro comparing Org version at compile time and laod time. Add `org-assert-version' call to all files: * lisp/org-macs.el: * lisp/org-crypt.el: * lisp/org-ctags.el: * lisp/org-cycle.el: * lisp/org-datetree.el: * lisp/org-duration.el: * lisp/org-element.el (avl-tree): * lisp/org-entities.el: * lisp/org-faces.el: * lisp/org-feed.el: * lisp/org-fold-core.el: * lisp/org-fold.el: * lisp/org-footnote.el: * lisp/org-goto.el: * lisp/org-habit.el: * lisp/org-id.el: * lisp/org-indent.el: * lisp/org-inlinetask.el: * lisp/org-keys.el: * lisp/org-lint.el: * lisp/org-list.el: * lisp/org-macro.el: * lisp/org-mobile.el: * lisp/org-mouse.el: * lisp/org-num.el: * lisp/org-pcomplete.el: * lisp/org-persist.el: * lisp/org-plot.el: * lisp/org-protocol.el: * lisp/org-refile.el: * lisp/org-src.el: * lisp/org-table.el: * lisp/org-tempo.el: * lisp/org-timer.el: * lisp/org.el: * lisp/ox-ascii.el: * lisp/ox-beamer.el: * lisp/ox-html.el: * lisp/ox-icalendar.el: * lisp/ox-koma-letter.el: * lisp/ox-latex.el: * lisp/ox-man.el: * lisp/ox-md.el: * lisp/ox-odt.el: * lisp/ox-org.el: * lisp/ox-publish.el: * lisp/ox-texinfo.el: * lisp/ox.el:
2022-08-13Use the full org-fold-core API when `org-fold-core-style' is `overlays'Ihor Radchenko
The old fallback folding mechanism was re-using old function versions to work with overlay folds directly. Switch to using org-fold-core API instead. This avoids code duplication. * lisp/ol.el (org-toggle-link-display--overlays): Merge overlay and text-property versions. (org-toggle-link-display--text-properties): (org-toggle-link-display): * lisp/org-cycle.el (org-cycle-overview--overlays): (org-cycle-overview--text-properties): (org-cycle-overview): (org-cycle-content--text-properties): (org-cycle-content): (org-cycle-content--overlays): * lisp/org-element.el (org-element-swap-A-B--overlays): (org-element-swap-A-B): (org-element-swap-A-B--text-properties): * lisp/org-fold.el (org-fold-save-outline-visibility--overlays): (org-fold-save-outline-visibility--text-properties): (org-fold-save-outline-visibility): (org-fold-region--overlays): (org-fold-region): (org-fold-show-all--text-properties): (org-fold-show-all--overlays): (org-fold-show-all): (org-fold-show-branches-buffer--text-properties): (org-fold-show-branches-buffer): (org-fold-show-branches-buffer--overlays): (org-fold--hide-drawers--overlays): (org-fold--hide-drawers--text-properties): (org-fold--hide-drawers): (org-fold-show-set-visibility--overlays): (org-fold-show-set-visibility--text-properties): (org-fold-show-set-visibility): (org-fold-check-before-invisible-edit--overlays): (org-fold-check-before-invisible-edit--text-properties): (org-fold-check-before-invisible-edit): (org-fold--hide-wrapper-toggle): * lisp/org-inlinetask.el (org-inlinetask-toggle-visibility--text-properties): (org-inlinetask-toggle-visibility): (org-inlinetask-toggle-visibility--overlays): * lisp/org-list.el (org-list-swap-items--text-properties): (org-list-swap-items): (org-list-swap-items--overlays): * lisp/org-macs.el (org-invisible-p--text-properties): (org-invisible-p): (org-invisible-p--overlays): (org-find-visible--overlays): (org-find-visible--text-properties): (org-find-visible): (org-find-invisible--overlays): (org-find-invisible--text-properties): (org-find-invisible): * lisp/org.el (org-next-visible-heading--overlays): (org-next-visible-heading--text-properties): (org-next-visible-heading): (org--forward-paragraph-once--overlays): (org--forward-paragraph-once--text-properties): (org--forward-paragraph-once): (org--backward-paragraph-once--overlays): (org--backward-paragraph-once--text-properties): (org--backward-paragraph-once): * testing/lisp/test-org.el (test-org/drag-element-backward): (test-org/drag-element-forward): Update tests.
2022-07-11org-list-struct-apply-struct: Do not rely on `match-data' after editsIhor Radchenko
* lisp/org-list.el (org-list-struct-apply-struct): Refresh `org-list-full-item-re' match data if we edit the bullet. Fixes https://orgmode.org/list/62cbc0f3.1c69fb81.13d5e.e250SMTPIN_ADDED_BROKEN@mx.google.com * testing/lisp/test-org-list.el (test-org-list/indent-item): Add test checking for the reported bug.
2022-06-26Prefer "website" to "homepage"Stefan Kangas
Emacs now advises using "website" (instead of "homepage") and consequently to use the "URL" comment header instead of "Homepage". * README: * README_ELPA: * doc/org-guide.org (Creating Footnotes): * doc/org-manual.org (Creating Footnotes): * etc/styles/README (URL): Prefer "website" to "homepage". * lisp/*.el: * mk/org-fixup.el: Replace the "Homepage" header comment with "URL".
2022-06-16org-cycle-list-bullet: Preserve relative point positionIhor Radchenko
* lisp/org-list.el (org-cycle-list-bullet): Keep point position relative to bullet beginning/end when changing the list bullet. * testing/lisp/test-org-list.el (test-org-list/cycle-bullet): Add tests. Fixes https://orgmode.org/list/m2wndjfi32.fsf@gmail.com
2022-06-14Use `set-default-toplevel-value' in `defcustom' settersIgnacio Casso
* lisp/ob-lilypond.el (org-babel-lilypond-commands): * lisp/ob-shell.el (org-babel-shell-names): * lisp/org-capture.el (org-capture-templates): * lisp/org-clock.el (org-clock-ask-before-exiting): * lisp/org-duration.el (org-duration-units): * lisp/org-faces.el (org-set-tag-faces): * lisp/org-footnote.el (org-footnote-section): * lisp/org-list.el (org-plain-list-ordered-item-terminator): (org-list-allow-alphabetical): * lisp/org.el (org-babel-do-load-languages): (org-set-modules): (org-export-backends): (org-use-fast-todo-selection): (org-enforce-todo-dependencies): (org-enforce-todo-checkbox-dependencies): (org-display-custom-times): (org-set-packages-alist): (org-set-emph-re): * lisp/ox-odt.el (org-odt-schema-dir): Use `set-default-toplevel-value' instead of `set' or `set-default' in `defcustom' :set argument. This commit fixes a bug that occurred when using an autoload function inside a let-binding for a custom variable when the feature defining both the function and the custom variable had not been loaded yet. See bug#54399 and https://lists.gnu.org/archive/html/emacs-orgmode/2022-03/msg00085.html, https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00226.html
2022-06-11org-list: Do not move point and change space when promoting/demoting itemsIhor Radchenko
* lisp/org-list.el (org-list-struct-apply-struct): Make sure the origin marker is not moved to bol when promoting/demoting item in special case: - item - <point> :: Do not remove the trailing space after point as well. (org-insert-item): Do not expect point to remain at bol after writing list struct. * testing/lisp/test-org-list.el (test-org-list/indent-item): Add tests. Fixes https://orgmode.org/list/87o88hlkvv.fsf@gmail.com
2022-05-14Fix macro indentation and re-indent code misindented by namelessIhor Radchenko
* lisp/org-fold-core.el (org-fold-core-cycle-over-indirect-buffers): (org-fold-core-ignore-modifications): (org-fold-core-ignore-fragility-checks): * lisp/org-macs.el (org-element-with-disabled-cache): Fix incorrect indentation declare statement. Body-only macros should use (indent 0) to avoid indenting first line differently from other body. * lisp/org-capture.el: * lisp/org-clock.el: * lisp/org-fold-core.el: * lisp/org-fold.el: * lisp/org-id.el: * lisp/org-list.el: * lisp/org-macs.el: * lisp/org.el: Reindent. Reported in https://orgmode.org/list/CAKJdtO_Z4LBGek3SUc6-a_Z0-dDd6L26_YfMYpZTn7F92uxXJQ@mail.gmail.com
2022-04-25Implement overlay- and text-property-based versions of some functionsIhor Radchenko
2022-04-25Rename old function call to use org-foldIhor Radchenko
2022-02-07Merge branch 'bugfix'Ihor Radchenko
2022-02-07org-list-send-item: allow dest to be a buffer positionSacha Chua
* lisp/org-list.el (org-list-send-item): Check if dest is a string before matching it, to allow dest to be a buffer position. * testing/lisp/test-org-list.el (test-org-list/send-item): Add tests.
2022-01-12Fix signature for org-element-at-pointMark A. Hershberger
2022-01-01Merge branch 'bugfix'Kyle Meyer
2022-01-01Update copyright year to 2022Kyle Meyer
2021-10-17Add declares to suppress compiler warningsIhor Radchenko
2021-10-04Prune Emacs 25.1 compatibility kludgesKyle Meyer
* lisp/oc-basic.el (org-cite-basic--field-less-p): * lisp/ol-eww.el (org-eww-store-link): * lisp/org-agenda.el (org-agenda-check-clock-gap): * lisp/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve-clock, org-clock-resolve) (org-resolve-clocks, (org-resolve-clocks-if-idle) (org-clock-in, org-clock-sum): Drop now unnecessary use of compatibility functions. * lisp/org-compat.el (org-string-collate-lessp, org-decode-time) (org-format-time-string, org-link-escape-browser, org-time-add) (org-time-subtract, org-time-since, org-time-less-p): Mark as obsolete. The 9.5 release declared Emacs 25.1 as the minimum version.
2021-09-12Merge branch 'km/from-emacs-master'Kyle Meyer
2021-09-12Backport commit ff4de1bd8 from EmacsEli Zaretskii
* lisp/org.el: * lisp/org-list.el (org-list-to-generic): * lisp/org-compat.el: In comments, quote 'like this'. Fix quoting style in Lisp comments ff4de1bd88b8be4a7071884910ff601eb10fbad5 Eli Zaretskii Sun Sep 12 19:51:06 2021 +0300
2021-09-12Backport commit fc4b956c7 from EmacsStefan Kangas
; Fix symbol quoting typos fc4b956c7cb2fba8ed2a18865a7686c6cfa5d030 Stefan Kangas Sun Sep 12 18:36:49 2021 +0200
2021-05-16lisp/org-list.el: Fix bug wrt updating statisticsBastien
* lisp/org-list.el (org-update-checkbox-count): Don't update statistics when toggling a checkbox witin a heading that has COOKIE_DATA set to "todo". Reported-by: Michael Brand <michael.ch.brand@gmail.com> Link: https://orgmode.org/list/CALn3zohYfoyDm6w-AYWsVRSbOCndBPZQyb+YvHcaEby3JEhWMw@mail.gmail.com
2021-05-07Update Carsten's email address in some filesBastien