Commit Graph

5010 Commits

Author SHA1 Message Date
Nicolas Goaziou 99bb514f7f Follow links with RET even in read-only buffers
* lisp/org.el (org-return): Fix `interactive' arguments.
* testing/lisp/test-org.el (test-org/return): Add test.

Reported-by: Gregor Zattler <telegraph@gmx.net>
<http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00247.html>
2020-05-14 23:28:10 +02:00
Jonas Bernoulli 71604cbc2d Fix typos 2020-05-13 23:27:49 -04:00
Nicolas Goaziou 88f5ed91c5 `org-startup-folded' defaults to `showeverything'
* lisp/org.el (org-startup-folded): New default value.

See <http://lists.gnu.org/r/emacs-orgmode/2020-04/msg00452.html>.
2020-05-12 12:33:21 +02:00
Nicolas Goaziou 20c1322194 Small fix in `org-cycle-hide-property-drawers'
* lisp/org.el (org-cycle-hide-property-drawers): Ignore case when
looking for the end of a property drawer.
2020-05-10 23:55:12 +02:00
Nicolas Goaziou 6076f40cae Better checks to avoid re-hiding folded drawers
* lisp/org.el (org-hide-drawer-all): Hide regular drawers even in
folded headlines.  They do not use the same invisibility spec.
However, when the heading is folded, still ignore property drawers.
(org-cycle-hide-property-drawers): Only skip property drawers folded
with or inside `outline' overlays.
2020-05-10 11:14:40 +02:00
Nicolas Goaziou eabc9712b7 Fix code typo.
* lisp/org.el (org-cycle-hide-property-drawers): Fix code typo.
2020-05-10 10:46:21 +02:00
Nicolas Goaziou 1bf2b33e27 Refactor `org-global-cycle'
* lisp/org.el (org-global-cycle): Small refactoring. Always assume
`org-mode' as major mode.  Show all is not necessary.
2020-05-10 02:22:19 +02:00
Nicolas Goaziou a9ba5dc2dc Fix `org-content'
* lisp/org.el (org-content): Use Org function instead of Outline's for
a small speed-up. Properly handle numeric argument.
2020-05-10 02:20:52 +02:00
Nicolas Goaziou f1c0f34772 Small speed-up to `org-overview'
* lisp/org.el (org-overview): Use direct Org function instead of
Outline's for a slight speed-up.
2020-05-10 02:19:43 +02:00
Nicolas Goaziou c744d3cf4c Do not fold drawers hidden inside folded blocks
* lisp/org.el (org-hide-drawer-all):
(org-cycle-hide-property-drawers): Do not fold invisible drawers,
ignoring the type of invisibility spec.
2020-05-09 23:41:39 +02:00
Kyle Meyer b0fb4599c7 Merge branch 'maint' 2020-05-09 15:54:44 -04:00
Matt Lundin 6e50b22ff0 Fix bug that placed cursor incorrectly when setting tags
* lisp/org.el (org-set-tags-command): Only fix cursor position in very
specific circumstances (i.e., when cursor is on an empty headline).
* testing/lisp/test-org.el (test-org/set-tags-command): Add tests
related to point position.

Modified-by: Kyle Meyer <kyle@kyleam.com>
  Adjusted for review comments and added tests.
2020-05-09 15:50:37 -04:00
Nicolas Goaziou 92bc33287e Do not fold property drawers in already folded areas
* lisp/org.el (org-cycle-hide-property-drawers): Do not re-fold
drawer.
2020-05-09 19:09:39 +02:00
Nicolas Goaziou 76f5cbd5a5 Properly hide new property drawers
* lisp/org.el (org-insert-property-drawer): Fix typo.
2020-05-09 18:56:34 +02:00
Nicolas Goaziou 3435b05922 Do not move point when cycling subtree visibility
* lisp/org.el (org-cycle-hide-property-drawers): Fix a bug introduced
in 1027e02569.
2020-05-09 18:35:11 +02:00
Kyle Meyer 86ec470bfc Correct :package-version typo from 1027e0256
* lisp/org.el (org-cycle-hook): Fix recent typo in package-version
value.
2020-05-09 11:14:46 -04:00
Nicolas Goaziou 074ea1629c Deprecate `org-cycle-hide-drawers'
* lisp/org.el (org-hide-drawer-all): New function.
(org-cycle-hide-drawers): move...
* lisp/org-compat.el (org-cycle-hide-drawers): ... here.
* lisp/org-agenda.el (org-agenda-show-1): Remove use of
`org-cycle-hide-drawers'.
2020-05-09 15:30:02 +02:00
Nicolas Goaziou 1027e02569 Implement `org-cycle-hide-property-drawers'
* lisp/org.el (org-cycle-hide-property-drawers): New function.
(org-set-startup-visibility):
(org-clean-visibility-after-subtree-move):
(org-sort-entries):
(org-cycle-hook):
(org-show-entry):
* lisp/org-agenda.el (org-agenda-show-and-scroll-up): Use new function.
2020-05-09 15:20:39 +02:00
Nicolas Goaziou 8b05c06d42 Use `outline' invisibility spec for property drawers
* lisp/org.el (org--hide-wrapper-toggle): Use `outline' invisibility
spec when hiding a property drawer.
(org-cycle): Fix typo.
2020-05-09 13:30:27 +02:00
Nicolas Goaziou ed0e75d241 Fix typo
* lisp/org.el (org-at-property-drawer-p): Fix typo.
* testing/lisp/test-org.el (test-org/at-property-drawer-p): Update
name and function calls.  Add a test.
2020-05-09 12:58:09 +02:00
Nicolas Goaziou 8580ef6ec1 Rename `org-at-property-block-p'
* lisp/org.el (org-at-property-drawer-p): New name.
* lisp/org-compat.el (org-at-property-block-p): Obsolete alias.
2020-05-09 12:50:34 +02:00
Nicolas Goaziou 7e7f5c6f03 Rewrite `org-at-property-block-p'
* lisp/org.el (org-comment-regexp): New variable.
(org-at-property-block-p): Rewrite function to check syntax locally.
(org-at-comment-p): Use new variable.
2020-05-09 12:47:37 +02:00
Kévin Le Gouguec e47b053d9a compat: Add `org-newline-and-indent'
* lisp/org-compat.el (org-newline-and-indent): New function.
* lisp/org.el (org--newline): Use new function.
2020-05-07 21:34:32 +02:00
Nicolas Goaziou e304d58978 Revert "Fix docstring"
This reverts commit 5d308e2728.
2020-05-07 21:29:46 +02:00
Nicolas Goaziou 5d308e2728 Fix docstring
* lisp/org.el (org--newline): Fix docstring.
2020-05-07 14:10:05 +02:00
Kévin Le Gouguec d3e6b58004 Make RET and C-j obey `electric-indent-mode'
* lisp/org-compat.el (org-return-indent): Deprecate this command.
* lisp/org-keys.el (org-mode-map): Rebind C-j to a command emulating
`electric-newline-and-maybe-indent'.
* lisp/org.el (org-cdlatex-environment-indent): Stop using the now
obsolete function.
(org--newline): New helper function.
(org-return): Use it to transparently handle `electric-indent-mode'.
(org-return-and-maybe-indent): New command to emulate
`electric-newline-and-maybe-indent' while taking care of Org special
cases (tables, links, timestamps).
* testing/lisp/test-org.el (test-org/with-electric-indent,
test-org/without-electric-indent): New tests.
* testing/org-test.el (org-test-with-minor-mode): New helper to set a
minor mode to a specific state, and reset it afterward.
2020-05-07 12:14:30 +02:00
Kyle Meyer b171ff02f6 Merge branch 'maint' 2020-05-05 22:38:00 -04:00
Kyle Meyer f4fed7ea0c org: Retain prefix arg when dispatching dynamic block commands
* lisp/org.el (org-dynamic-block-insert-dblock): Add an interactive-p
argument that is non-nil for interactive calls and signals to call the
dynamic block function interactively.

org-clock-report takes a prefix argument.  When it had a regular
binding, this was easy to access.  As of 34b71a0ca (Add a dispatcher
command for inserting dynamic blocks, 2018-12-23), its only "binding"
is through the dynamic block dispatcher.  Make it possible to supply a
prefix argument in that context too.
2020-05-05 22:31:43 -04:00
Nicolas Goaziou ea6a9bd6fa Add menu entry for `org-insert-structure-template'
* lisp/org.el (org-org-menu): Add entry.

Reported-by: John Ciolfi <ciolfi@mathworks.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-11/msg00157.html>
2020-05-06 02:47:35 +02:00
Nicolas Goaziou 271f5a6829 Insert planning in visible part of narrowed buffer
* lisp/org.el (org-add-planning-info): Make sure planning info appears
in the visible part of a narrowed buffer.
* testing/lisp/test-org.el (test-org/deadline):
(test-org/schedule): Update tests.

Reported-by: Michaël Cadilhac <michael@cadilhac.name>
<http://lists.gnu.org/r/emacs-orgmode/2019-09/msg00091.html>
2020-05-06 02:43:42 +02:00
Nicolas Goaziou 046f1d22ff org-ellipsis cannot be local variable
* lisp/org.el (org-ellipsis): docstring specifies it cannot be a local
variable.  As a consequence, remove :safe keyword.

Reported-by: "Mark E. Shoulson" <mark@shoulson.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-01/msg00145.html>
2020-05-06 02:15:22 +02:00
Nicolas Goaziou 7d35d46494 Fix :package-version values
* lisp/ol.el (org-link-email-description-format):
* lisp/org-src.el (org-src-tab-acts-natively):
* lisp/org-table.el (org-table-header-line-p):
* lisp/org.el (org-loop-over-headlines-in-active-region):
(org-fontify-done-headline): Use correct (PACKAGE . VERSION-STRING)
value.  Remove :version keyword since :package-version overrides it.
2020-05-06 02:12:23 +02:00
Nicolas Goaziou 1e1328b41c Move some functions in "org-macs.el"
* lisp/org.el (org--line-empty-p):
(org-previous-line-empty-p):
(org-next-line-empty-p): Move these functions...
* lisp/org-macs.el: ... here.
2020-04-30 11:23:11 +02:00
Nicolas Goaziou c672651fef Small speed-up for `org-collect-keywords'
* lisp/org.el (org--collect-keywords-1): Do not really activate Org
mode in setup files.
2020-04-28 09:50:46 +02:00
Nicolas Goaziou 80865bab64 Improve SETUPFILE error handling
* lisp/org.el (org-file-contents): Return nil when NOERROR is non-nil
and an error is raised.
(org--collect-keywords-1): Do not raise an error when an invalid
SETUPFILE keyword is met.
2020-04-27 23:31:05 +02:00
Nicolas Goaziou b223a28063 Fix last commit
* lisp/org.el (org--collect-keywords-1): Fix thinko.
2020-04-26 18:51:16 +02:00
Nicolas Goaziou 053676d284 Better handling of filenames in `org-collect-keywords'
* lisp/org.el (org-collect-keywords):
(org--collect-keywords-1): Add a new argument to take into
consideration current directory.
2020-04-26 18:40:24 +02:00
Nicolas Goaziou b4e91b7e94 New function: org-collect-keywords
* lisp/org.el (org-set-regexps-and-options): Use new function.
(org-collect-keywords):
(org--collect-keywords-1): New functions.
* lisp/ox.el (org-export--get-inbuffer-options): Use new function.
2020-04-26 18:06:15 +02:00
Kyle Meyer 3c31941139 Fix loading issues related to org-refile.el move
* lisp/org-refile.el (org-directory):
(org-default-notes-file):
(org-reverse-note-order):
(org-outline-path-cache):
(org--get-outline-path-1):
(org-get-outline-path):
(org-format-outline-path):
(org-display-outline-path): Move back to org.el.
* lisp/org-id.el: Require org-refile.
* lisp/org-refile.el: Require org.

f636cf91b (New org-refile.el file with refile definitions, 2020-02-05)
moved refile-related code into a new file, org-refile.el.  This
introduced several dependency issues, which can be seen by running
`make single'.

Many of these issues could be solved by loading org.el in
org-refile.el and loading org-refile in several libraries that depend
on moved functionality.  However, there would still be a circular
dependency because org.el depends on three variables now defined in
org-refile.el.  Also, conceptually there is the problem that the
outline path functionality, despite being used primarily for refile
internally, is now used more generally in third-party code and in a
couple of spots within this repo.

Resolve the above situation by moving the three org-refile.el
variables that org.el needs and the outline path bits back to org.el.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<CAFyQvY1VR5t_a=JO01+QWbUQk_9i8+2XG6W2-mg-DpFzjz9seg@mail.gmail.com>

Reported-by: Ihor Radchenko <yantar92@gmail.com>
<878sj74lfp.fsf@localhost>

Reported-by: Ryan C. Thompson <rct@thompsonclan.org>
<8861c9e9-6c19-ea8f-6a90-7a466782096f@thompsonclan.org>
2020-04-26 01:29:33 -04:00
Nicolas Goaziou 12515da332 Fix LaTeX fragments fontification
* lisp/org.el (org-do-latex-and-related): Limit false positive, e.g.,
in ORG-NEWS file.  Small speedup.
2020-04-24 00:52:14 +02:00
Nicolas Goaziou 5afacc5fce Do not apply drawer face also on indentation
* lisp/org.el (org-fontify-drawers): Do not apply drawer face also on
indentation.

Reported-by: Norman Tovey-Walsh <ndw@nwalsh.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-04/msg00330.html>
2020-04-21 18:42:43 +02:00
Kyle Meyer bab2995c71 Merge branch 'maint' 2020-04-20 20:47:24 -04:00
Kyle Meyer c716b7c085 org-id: Allow file name to be overridden on ID creation
* lisp/org-id.el (org-id-overriding-file-name): New variable.
(org-id-get): Prefer org-id-overriding-file-name over the buffer's
file name if set.
(org-id-locations-load): Give a more informative error when file is
nil.
* lisp/org.el (org-clone-subtree-with-time-shift): Let-bind
org-id-overriding-file-name, enabling an ID to be created for a cloned
subtree rather than crashing with a type error.

Note that, before 9865e6bd8 (org-id: Speedup, minor functional change
and fix, 2019-08-01), this wouldn't fail with a type error.  However,
the ID would not be added correctly because org-id-add-location simply
wouldn't process the ID at all if the passed file was nil.

Reported-by: Ian Eure <ian@retrospec.tv>
<87a73caayj.fsf@phaktory>
2020-04-20 20:46:56 -04:00
Nicolas Goaziou 0d1d56f86a Merge branch 'maint' 2020-04-19 00:04:27 +02:00
Nicolas Goaziou eb2d6a8cd4 Fix some fontification issues
* lisp/org.el (org-inside-LaTeX-fragment-p): properly find limit.

This commit partly reverts ad8e508e93.
2020-04-19 00:02:53 +02:00
Nicolas Goaziou 43956c693b Small refactoring to `org-cycle'
* lisp/org.el (org-cycle): Integrate new folding functions for
drawers.  Small refactoring, in particular to minimize the number of
calls to `org-element-at-point'.
2020-04-18 18:34:56 +02:00
Nicolas Goaziou 692f191f84 Refactor block and drawer visibility toggling
* lisp/org.el (org--hide-wrapper-toggle): New function.
(org-hide-block-toggle):
(org-hide-drawer-toggle): Use new function.
2020-04-18 18:34:56 +02:00
Nicolas Goaziou 4fbc36a057 Deprecate `org-hide-block-toggle-all'
* lisp/org.el (org-hide-block-toggle-all): move...
* lisp/org-compat.el (org-hide-block-toggle-all): ... here.
2020-04-18 18:34:56 +02:00
Nicolas Goaziou cd9e000d86 Deprecate `org-hide-block-toggle-maybe'
* lisp/org.el (org-hide-block-all): Use `org-hide-block-toggle'.
(org-hide-block-toggle-maybe): move...
* lisp/org-compat.el (org-hide-block-toggle-maybe): ... here.
2020-04-18 18:34:56 +02:00
Nicolas Goaziou 09f1b74f25 Change signature for `org-hide-block-toggle'
* lisp/org.el (org-hide-block-toggle): Add two optional arguments.
Small refactoring.
2020-04-18 18:34:55 +02:00