0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-30 14:07:50 +00:00
Commit graph

25267 commits

Author SHA1 Message Date
Ihor Radchenko d5a52be0a5
org-fold-core: Remove `org-fold-core-first-unfold-functions'
* lisp/org-fold-core.el (org-fold-core-first-unfold-functions):
Remove.  This is very too tricky to implement.  In particular, when we
use jit-lock, there can be a race between calls to
`org-fold-core-region' and fontification.  For example, consider that
one of the functions in the hook folds drawers and everything is
folded initially.  Then, if the user requests unfolding headlines,
drawers, and blocks, it happens before jit-lock is ran in invisible
parts of buffer (out of the display).  Those parts will be folded
despite user explicitly requested full unfold, which is wrong.  Fixing
this behaviour would involve implementing a full-fledged tracker on
top of jit-lock, which is very too complex and will likely introduce
hard-to-debug errors.

* lisp/org-fold-core.el (org-fold-core-initialize):
(org-fold-core-region):
(org-fold-core-remove-optimisation):
* lisp/org-cycle.el (org-cycle-hide-drawers):
(org-cycle-hide-archived-subtrees): Do not use
`org-fold-core-first-unfold-functions'.

Fixes https://list.orgmode.org/80k0ar1lml.fsf@felesatra.moe/T/#u
2022-05-12 21:38:01 +08:00
Daniel Fleischer aea24b3fea lisp/org.el: Fast tag selection disabled tag face
* lisp/org.el (org-fast-tag-selection): Disabled tags face

A tag can be either selected in "current", "inherited" or disabled. When
disabled, it should have the default face. Previously, if a tag was
already selected, when deselection it will still have an org-todo face.

https://lists.gnu.org/archive/html/emacs-orgmode/2021-10/msg00350.html
2022-05-10 08:33:15 +03:00
Ihor Radchenko 0b07b30dea
orgtbl-toggle-comment: Fix when table is at point-min' or point-max'
* lisp/org-table.el (orgtbl-toggle-comment): Avoid infinite loop when
begin/end line of the table is at `point-min' or `point-max'.

Fixes https://orgmode.org/list/874k20v7sj.fsf@gmail.com
2022-05-09 21:31:54 +08:00
Ihor Radchenko 717f83bf75
org-fold--reveal-outline-maybe: Fix wrong side of point error
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Widen the buffer
before testing headline validity.  Otherwise, `goto-char' may not move
where expected in narrowed buffer.
2022-05-09 20:39:57 +08:00
Ihor Radchenko 2a6f5cecf7
test-org: Add new test `test-org/org-find-olp'
* testing/lisp/test-org.el (test-org/org-find-olp): New test examining
`org-find-olp'.
2022-05-08 18:22:01 +08:00
Ignacio a3d9999d28
lisp/org.el: Match COMMENT in `org-complex-heading-regexp-format'
* lisp/org.el (org-set-regexps-and-options): Change
`org-complex-heading-regexp-format' initialization so that the regexp
it produces also matches a headline if it is commented.

TINYCHANGE
2022-05-08 18:22:01 +08:00
Tim Van den Langenbergh 06d08e6f30
lisp/ob-scheme.el: Use synchronous eval.
* ob-scheme.el (org-babel-scheme-execute-with-geiser): If available,
use the synchronous `geiser-eval-region/wait' function to get the
evaluation result.

Works with geiser 0.18 (before introduction of async evaluation) and
geiser 0.22 (which introduces `geiser-eval-region/wait').

Modified from a patch proposal by Felipe Lema.

TINYCHANGE
2022-05-08 17:59:59 +08:00
Ihor Radchenko 2e4ed52b19
org-fold: Revert old behaviour when handling invisible edits
* lisp/org-fold-core.el (org-fold-core-folded-p): Allow list of fold
types to be passed as argument.
* lisp/org-fold.el (org-fold-check-before-invisible-edit--overlays):
(org-fold-check-before-invisible-edit--text-properties): Make
overlay/text-property behaviour consistent.  Do not handle edits
inside folded links.  Fix inconsistencies.
* testing/lisp/test-org-fold.el:
* testing/lisp/test-org.el: Move folding-related tests to new test
file.
* testing/lisp/test-org-fold.el:
(test-org-fold/org-catch-invisible-edits): New test.

See https://orgmode.org/list/m2o809q170.fsf@gmail.com
2022-05-08 17:26:42 +08:00
Ihor Radchenko b5f0efc049
ob-plantuml: Allow setting PlantUML args for jar file
* lisp/ob-plantuml.el (org-plantuml-args): Rename
`org-plantuml-executable-args' to `org-plantuml-args'.
(org-babel-execute:plantuml): Use `org-plantuml-args' when calling
jar.
* lisp/org-compat.el (org-plantuml-executable-args): Obsolete old
variable name.
* etc/ORG-NEWS (=org-plantump-executable-args= is renamed and applies
to jar as well): Document change.

See the discussion in https://list.orgmode.org/orgmode/87y23hr045.fsf@localhost/
2022-05-08 14:44:58 +08:00
TEC 15d25644cc
org-entities: Change \minus to -
* lisp/org-entities.el: The LaTeX command \minus doesn't exist, but a
hyphen in math mode produces a minus symbol.
2022-05-04 23:49:48 +08:00
Ihor Radchenko d2a459d259
org-fold-check-before-invisible-edit: Be smart about editing at border
*
lisp/org-fold.el (org-fold-check-before-invisible-edit--text-properties):
Consider `border-and-ok-direction' value when deciding whether to
throw an error and reveal the fold.  Never throw an error when editing
at border without affecting the text inside.

Fixes https://orgmode.org/list/m2ilqle995.fsf@gmail.com
2022-05-04 22:37:29 +08:00
Ihor Radchenko ebbef7b30c
org-fold-save-outline-visibility: Make it work with 'text-properties
*
lisp/org-fold.el (org-fold-save-outline-visibility--text-properties):
Do not expand list of specs on compile time.  Simplify saving and
re-applying folds.

* lisp/org-fold.el (org-fold-save-outline-visibility): Fix typo when
-> if.
2022-05-03 14:27:25 +08:00
Ihor Radchenko 5d3173cb04
org-compile-prefix-format: Document argument
* lisp/org-agenda.el (org-compile-prefix-format): Document the KEY
argument in the docstring.

Reported in https://orgmode.org/list/CAJ1MqVGR0w93wYi7r0NNmDJxBKeY8vh2=f307u1JeGBOUC597g@mail.gmail.com
2022-05-03 11:38:10 +08:00
Ihor Radchenko 2f19fc62ab
Merge branch 'bugfix' 2022-05-02 12:04:30 +08:00
Ihor Radchenko f8bb414615
org-at-timestamp-p: Fix compatibility with Emacs 26
* lisp/org.el (org-at-timestamp-p): Do not use variables in regexp rx
form.  They are not yet supported in Emacs 26.  Expand them at runtime
instead.
2022-05-02 12:03:52 +08:00
Jacopo De Simoi 2bd34edb64
ob-tangle.el: Handle non-string arguments more gracefully
* lisp/ob-tangle.el (org-babel-tangle-single-block): If the
  argument to :tangle is nil (e.g. when parsing conditional
  tangling such as (when condition "yes") the current code
  throws an error in `file-name-directory'.  This commit
  checks if the argument is a string before calling the fun

TINYCHANGE
2022-05-01 11:36:04 +08:00
Ihor Radchenko dba46b7bc0
* doc/org-manual.org (Tracking your habits): Fix module tag habits -> habit
Reported in https://orgmode.org/list/4971b4a8-4519-ac09-a2e1-49a910e27601@fiander.info
2022-05-01 11:06:05 +08:00
Andrew Arensburger 82a09ba0ae
org-macs.el: Fix template expansion
* lisp/org-macs.el (org-fill-template): Fix a bug in template
expansion: if one key is a substring of another key (like "noweb" and
"noweb-ref", or "tangle" and "tangle-mode"), the second key wouldn't
get expanded properly.  The problem was that keys were processed in
order of increasing length; they are now sorted in order of descending
length.

TINYCHANGE
2022-04-30 17:45:33 +08:00
Andrew Arensburger 4a30e8cc0c
test-org-macs.el: Add test for template-expansion bug
* testing/lisp/test-org-macs.el (ert-deftest test-org/fill-template):
There is a bug in `org-fill-template': it sorts and processes keys in
order of increasing length, so that "noweb" is seen before
"noweb-ref", and "tangle" before "tangle-mode".  So in a template that
includes "%noweb-ref", it will substitute the value of "noweb".

This change includes a test for this bug.

TINYCHANGE
2022-04-30 17:45:32 +08:00
Ihor Radchenko 5f184b5f23
org-inlinetask.el: Fix visibility cycling for inlinetasks
* lisp/org-inlinetask.el (org-inlinetask-hide-tasks): Make sure that
we loop over inlinetasks inside current section only.
`org-inlinetask-goto-end' moves point to the end of the inlinetask
element.  If an inlinetask is followed by a heading, the function
logic will treat the heading as the beginning of another inline task.
Prevent it by moving the point at the end of the END line of the
inlinetask.

Fixes
https://list.orgmode.org/orgmode/CAP7OBx+rs-7v4jstEFYC4u0=0NZ3xJKfb3CNrWeDvjmwRTvgxw@mail.gmail.com/
2022-04-30 16:54:15 +08:00
Sébastien Miquel 2063596b90
ob-core.el: Add :noweb-prefix babel header argument
* lisp/ob-core.el (org-babel-expand-noweb-references): Add support for
`noweb-prefix' header argument, to not repeat the prefix characters
when expanding a noweb reference.
(org-babel-common-header-args-w-values):
(org-babel-safe-header-args): Add `noweb-prefix' value.
* doc/org-manual.org: Document `noweb-prefix' babel header argument.
* etc/ORG-NEWS: Document `:noweb-prefix'.
2022-04-30 16:13:55 +08:00
Ihor Radchenko a3dac4d20a
fixup! org-fold-show-set-visibility: Do not reveal emphasis unless DETAIL is `local'
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Consider nil value for REGION.
2022-04-29 10:55:42 +08:00
Ihor Radchenko 782a661921
org-fold-show-set-visibility: Do not reveal emphasis unless DETAIL is `local'
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Prevent revealing hidden emphasis unless requested DETAIL is `local'.
* lisp/ol.el (org-next-link): Honour `org-fold-show-context-detail'.

Reported in https://orgmode.org/list/626a0713.1c69fb81.a3583.1a07SMTPIN_ADDED_BROKEN@mx.google.com
2022-04-28 14:33:43 +08:00
Ihor Radchenko a0b8adf08a
org-fold: Reveal hidden macro markers
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Unfold hidden macro markers on invisible edit.
2022-04-28 14:02:32 +08:00
Ihor Radchenko 1ed9e42238
org-todo: Fix point moving after setting todo keyword in empty heading
* lisp/org.el (org-todo): Insert new todo keyword before
`save-excursion' markers.  This avoids apparent point movement when a
new keyword is inserted into an empty heading.
Before: "* <point>" -> "*<point> TODO";
After: "* <point>" -> "* TODO<point>";

Fixes https://orgmode.org/list/87mtg6265i.fsf@yandex.com
2022-04-27 19:29:36 +08:00
Ihor Radchenko e142bd8a9a
org-fold: Fix folding blank lines after newly inserted heading
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Reveal blank
lines after newly inserted heading after a folded heading.
2022-04-27 19:28:39 +08:00
Nick Dokos 98a771cc3b
test-ob-octave: Add missing `provide' 2022-04-27 16:56:31 +08:00
Nick Dokos e359b01a63
doc/org-manual.org: Fix clocktable dynamic block examples 2022-04-27 16:52:57 +08:00
Ihor Radchenko 2d6f26c057
org-fold: Prevent folding level 1 headlines
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Never keep level
1 headlines inserted inside folded region hidden.  Such headlines can
often be added to end of buffer by capture.  This change prevents such
headlines to be hidden.

Reported in https://orgmode.org/list/CABUh-74vvn7i06T3zB=38_BFfBKS9J9H8NxGp_-eecoAPgygoQ@mail.gmail.com
2022-04-27 16:45:06 +08:00
Ihor Radchenko 4280762e4c
org-refile: Restore previous behaviour of not revealing the refiled headline
* lisp/org-refile.el (org-refile): Do not reveal the refiled headline.
This reverts the new behaviour accidentally introduced by org-fold
patchset.

See https://orgmode.org/list/87r15l5kce.fsf@gnu.org
2022-04-26 17:46:37 +08:00
Ihor Radchenko 407104459b
org-fold: Honour `org-fold-show-context-detail' for isearch
* lisp/org-fold.el (org-fold--isearch-reveal): Call
`org-fold-show-visibility'.  The previously used
`org-fold-show-set-visibility' does not accept context as argument.

Reported in https://orgmode.org/list/8735i5gd8n.fsf@gmail.com
2022-04-25 19:40:19 +08:00
Ihor Radchenko 24c1c877cf
org-fold-core-fontify-region: Calculate jit-lock-bounds accurately
* lisp/org-fold-core.el (org-fold-core-fontify-region): Collect all
the return values of `font-lock-default-fontify-region' on visible
regions and extend jit-lock-bounds accordingly.
2022-04-25 19:40:18 +08:00
Ihor Radchenko 2249f4d7e5
org-fold-core-fontify-region: Remove unused variable
* lisp/org-fold-core.el (org-fold-core-fontify-region):
2022-04-25 19:40:17 +08:00
Ihor Radchenko 312f39a05d
org-string-width: Do not remove face info when PIXELS is non-nil
* lisp/org-macs.el (org-string-width): Do not remove the STRING faces
unless character width is requested.  Faces might alter pixel width of
the string and removing them would yield incorrect results.
2022-04-25 19:40:17 +08:00
Ihor Radchenko 9bc6c363da
org-fold-core: Fix edge case when fontification goes beyond requested
* lisp/org-fold-core.el (org-fold-core-fontify-region): Run
`org-fold-core-first-unfold-functions' on all the regions unmarked by
'org-fold-core-fontified property instead of using incorrect
heuristics with `point' position.  Make sure that fontified region is
registered as fontified according to the return value of
`font-lock-default-fontify-region'

Fixes https://orgmode.org/list/8735i5gd8n.fsf@gmail.com
2022-04-25 19:40:16 +08:00
Ihor Radchenko fc6314b267
org-fold.el: Fix typo 2022-04-25 19:40:15 +08:00
Ihor Radchenko ce58542c85
org-agenda.el: Re-enable native compilation
* lisp/org-agenda.el: Re-enable native compilation as it does not
cause any issues with agenda rendering without other custom changes
not included in this branch.
2022-04-25 19:40:14 +08:00
Ihor Radchenko 219bc6c2d3
org-fold-core-fontify-region: Fix cases when fontification is not registered
* lisp/org-fold-core.el (org-fold-core-fontify-region): Handle FORCE
argument better.  Skip unnecessary code parts when FORCE is non-nil.
Assign `fontified' text property manually in the actually fontified
regions.  We cannot just supply correct return value since jit-lock
does not allow piecewise fontification.
2022-04-25 19:40:14 +08:00
Ihor Radchenko 062e30be8a
org-macs.el: Fix fontification checks take 2 2022-04-25 19:40:13 +08:00
Ihor Radchenko d2775da08d
test-ol/org-toggle-link-display: Fix compatibility with old Emacs
* testing/lisp/test-ol.el (test-ol/org-toggle-link-display): Use
back-compatible `org-xor' instead of `xor'.
2022-04-25 19:40:12 +08:00
Ihor Radchenko f28f02bde9
org-link-make-string: Throw error when both LINK and DESCRIPTION are empty
This behaviour is expected according to `test-ol/make-string'.
2022-04-25 19:40:11 +08:00
Ihor Radchenko 87babca898
org--string-from-props: Fix handling folds in Emacs <28
* lisp/org-macs.el (org--string-from-props): Respect
`char-property-alias-alist' when querying for `invisible' text
property.
2022-04-25 19:40:11 +08:00
Ihor Radchenko 444d1c50ac
test-org/string-width: Add tests for strings with prefix properties 2022-04-25 19:40:10 +08:00
Ihor Radchenko 3da1b2d240
org-fold-core: Fix fontification inside folded regions
* lisp/org-fold-core.el (org-fold-core-initialize): Declare
`org-fold-core-fontified' text property for font-lock.
(org-fold-core--force-fontification): New variable controlling forced
fontification inside folded regions.
(org-fold-core-fontify-region): Fix cases when BEG is inside folded
region.  Respect `org-fold-core--force-fontification'.
* lisp/org-macs.el (org-with-forced-fontification): New macro.
(org-buffer-substring-fontified):
(org-looking-at-fontified): Do not rely on jit-lock.  Use
`org-fold-core-fontified' text property to determine whether text is
already fontified.
2022-04-25 19:40:09 +08:00
Ihor Radchenko 0bca8bc418
org-fold-show-set-visibility: Fix edge case when folded region is at BOB 2022-04-25 19:40:09 +08:00
Ihor Radchenko 0daa209a74
org-string-width: Work around `window-pixel-width' bug in old Emacs 2022-04-25 19:40:08 +08:00
Ihor Radchenko 2e3566e1e9
org-string-width: Handle undefined behaviour in older Emacs
* lisp/org-macs.el (org-string-width): Force older Emacs treating
invisible text with ellipsis as zero-width.  Newer Emacs versions do
exactly this.
2022-04-25 19:40:07 +08:00
Ihor Radchenko 3fba34900e
Fix org-fold--hide-drawers--overlays 2022-04-25 19:40:06 +08:00
Anders Johansson f813f10818
Rename remaining org-force-cycle-archived → org-cycle-force-archived 2022-04-25 19:40:06 +08:00
Anders Johansson baffebbc33
Fix bug in org-get-heading
Fixes #26, where fontification could make the matching and extraction of heading
components fail.
2022-04-25 19:40:05 +08:00