Commit Graph

510 Commits

Author SHA1 Message Date
Kyle Meyer af3def5d06 Silence recent 'make single' compiler warnings
And remove the org-return-indent declaration in org-keys.el, which is
not needed as of d3e6b5800 (Make RET and C-j obey
`electric-indent-mode', 2020-05-05).
2020-05-09 22:36:00 -04:00
Nicolas Goaziou e73732f14a compat: Silence byte-compiler
* lisp/org-compat.el (org-cycle-hide-drawers): Ignore optional
argument.
2020-05-09 19:10:47 +02: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 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
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
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
Nicolas Goaziou 62f197103f compat: Silence byte-compiler
* lisp/org-compat.el (org-hide-block-toggle-maybe): Tiny refactoring.
2020-04-18 19:37:41 +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 b4f77b1f9a Deprecate `org-flag-drawer'
* testing/lisp/test-org.el (test-org/flag-drawer): Remove tests.
* lisp/org-clock.el (org-clock-jump-to-current-clock):
* lisp/org.el (org-cycle-hide-drawers): Use `org-hide-drawer-toggle'
instead.
(org-insert-drawer)
(org-hide-drawer-toggle): Use `org-flag-region' instead.
(org-flag-drawer): move...
* lisp/org-compat.el (org-flag-drawer): ... here.
2020-04-18 18:34:55 +02:00
Mattias Engdegård b78583a1c1 Backport commit 770f76f05 from Emacs
Make regexps smaller and faster by removing terms that are superfluous
by virtue of standing next to another term that matches more.  See
https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00949.html
for details.

* lisp/ob-core.el (org-babel-remove-result):
* lisp/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-compat.el (org-maybe-keyword-time-regexp):
* lisp/org-table.el (org-table-expand-lhs-ranges):
Remove subsumed repetitions.

Remove subsumed repetitions in regexps
770f76f050376bbd77a3cc8cf44db57cf855a27c
Mattias Engdegård
Thu Feb 20 16:05:18 2020 +0100
2020-03-15 22:51:31 -04:00
Nicolas Goaziou d9b1fb1e8c org-compat: Add missing definition
* lisp/org-compat.el (org-maybe-keyword-time-regexp): New variable.

This is a followup to 209fb501bd.
2020-03-12 09:57:24 +01:00
Nicolas Goaziou 209fb501bd org-compat: Mark `org-maybe-keyword-time-regexp' as obsolete
* lisp/org-compat.el (org-maybe-keyword-time-regexp): Make obsolete.
2020-03-12 09:08:27 +01:00
Nicolas Goaziou a63073ec04 Move obsolete aliases into "org-compat.el" 2020-02-23 12:57:07 +01:00
Bastien fae16ed8f5 Add `generated-autoload-file' buffer local variable
* lisp/org.el:
* lisp/org-num.el:
* lisp/org-macs.el:
* lisp/org-list.el:
* lisp/org-lint.el:
* lisp/org-keys.el:
* lisp/org-goto.el:
* lisp/org-duration.el:
* lisp/org-compat.el:
* lisp/org-colview.el:
* lisp/org-capture.el:
* lisp/org-agenda.el:
* lisp/ol.el: Add `generated-autoload-file' buffer local variable.

This is needed when compiling Org files within GNU Emacs.
2020-02-18 23:37:24 +01:00
Bastien a85f1603ec Merge branch 'maint' 2020-02-17 16:36:12 +01:00
Bastien 6accd0ef62 Fix fb188adda 2020-02-17 16:36:01 +01:00
Bastien cdf7d6414d Merge branch 'maint' 2020-02-17 16:29:38 +01:00
Bastien 016aa96f99 Revert "org-compat.el: Require 'org-agenda in a timely fashion"
This reverts commit 2f30ecffdf.
2020-02-17 16:29:21 +01:00
Bastien 19cdef520e Merge branch 'maint' 2020-02-17 14:51:47 +01:00
Bastien 2f30ecffdf org-compat.el: Require 'org-agenda in a timely fashion
* lisp/org-compat.el ("calendar"): Require 'org-agenda before
adding `org--setup-calendar-bindings' to `calendar-mode-hook'.

This fixes Emacs bug#38592.
2020-02-17 14:49:15 +01:00
Nicolas Goaziou 2fbbc23368 Fix build
* lisp/org-compat.el (org-file-properties): Prevent error at build
time about creating an alias for a local variable.
* lisp/org.el (org-keyword-properties): Slight change to docstring.
2020-01-03 11:07:28 +01:00
Kyle Meyer 93c11da002 Merge branch 'maint' 2020-01-01 13:39:26 -05:00
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Nicolas Goaziou 1d38233b83 Silence byte-compiler
* lisp/org-compat.el (org-file-properties): Fix typo.
2019-12-15 19:07:51 +01:00
Gustav Wikström 26ace90042 Make org-attach store links using attachment-links
* lisp/org-attach.el (org-attach-attach): Storing links using the new
  attachment link type instead of file links.

* lisp/org-compat.el (org-attach-store-link, org-attach-expand-link):
  Remove not needed functions and mark them as obsolete for easier
  future reference.
2019-12-13 23:01:10 +01:00
Gustav Wikström 1bdff9f73d Org document property-drawers
Add functionality to define property-blocks on document level, in
addition to at headline level.

* doc/org-manual.org:
* etc/ORG-NEWS: Document new functionality.

* lisp/org.el (org-keyword-regexp): Define constant instead of
  hardcoding.
(org-file-properties): Renamed, see next line.
(org-keyword-properties): Renamed from above.  Due to the fact that
  properties can be defined for the whole document using property
  drawers this local variable needs a rename to make its name less
  ambigous.
(org-refresh-properties, org-refresh-property, org-entry-properties)
(org-refresh-category-properties, org-get-property-block)
(org-entry-get-with-inheritance, org-entry-put)
(org-insert-property-drawer, org-end-of-subtree): Made to work before
  first headline.
(org-at-property-block-p): New function to validate if point is at the
start of a property block.
(org-property-global-value): Renamed, see next line.
(org-property-global-or-keyword-value): Renamed from above to match
  its functionality better.
(org-back-to-heading-or-point-min): New function to make a document
  work as a level 0 node in the outline.
(org-at-keyword-p): Predicate function to answer to if we're currently
at a keyword line or not.
(org-up-heading-or-point-min): New function to make a document work as
a level 0 node in the outline.

* lisp/org-element.el (org-element--current-element): Can now detect
  property-blocks before first headline according to it's positional
  rules.

* lisp/org-attach.el (org-attach): Make it possible to call the
  attachment dispatcher also before the first headline, since document
  property drawers make attachments possible for the whole document
  now.

* lisp/org-capture.el: Modified only due to rename of function in
  org.el.

* lisp/org-compat.el (org-file-properties)
(org-property-global-value): Renamed functions declared obsolete.

* testing/lisp/test-org.el (org/insert-property-drawer)
(org/set-property, org/delete-property, org/delete-property-globally):
  Additions of tests to check if they work before first headline.
(org/at-property-p, org/at-property-block-p, org/get-property-block)
(org/entry-get, org/refresh-properties): New tests

* testing/examples/property-inheritance.org: Switch from
  property-keywords to a property-drawer in the testfile.
  Functionality should be the same, but now using a document drawer
  instead of property-keywords.

  Reason for switching is that I'd like us to slowly depricate
  property-keywords.

* testing/lisp/test-org-element.el:

* contrib/lisp/ox-taskjuggler.el: A comment is modified only due to
  rename of function in org.el.
2019-10-19 14:07:58 +02:00
Kyle Meyer c7c04b0447 Merge branch 'maint' 2019-08-18 17:44:08 -04:00
Kyle Meyer bdc5861cf7 org-compat: Add kludges for time-related functions
* lisp/org-compat.el (org-decode-time, org-format-time-string)
(org-time-add, org-time-less-p, org-time-since, org-time-subtract):
New compatibility functions.

On Emacs 24, these functions are stricter about what they accept for
time.  These new function will be used to port over changes in the
Emacs repo.  Don't bother doing a bulk substitution in existing Org
code because that would produce a lot of churn and these calls should
already be compatible with Emacs 24.
2019-08-18 17:36:12 -04:00
Kyle Meyer 24ba689506 org-compat: Add time-convert compatibility wrappers
* lisp/org-compat.el (org-time-convert-to-integer)
(org-time-convert-to-list): New defsubt's to replace common
invocations of time-convert (new in Emacs 27).
* lisp/org-compat.el (org-current-time-as-list): Drop in favor of
org-time-convert-to-list.

These will be used to port changes from the Emacs repo.
2019-08-18 17:31:05 -04:00
Kyle Meyer 4e3a1b3f5a org-compat: Move proper-list-p kludge to proper section 2019-08-17 09:54:35 -04:00
Kyle Meyer 531f4be256 org-compat: Define org-xor as alias for xor if available
* lisp/org-macs.el (org-xor): Move to ...
* lisp/org-compat.el (org-xor): ... here, making it an alias for xor
on Emacs 27.

This is an alternative to porting Emacs's
c676444a43e4634c1f98ec286b5bd9e46b23216b, which targets the code prior
to 45a1918ef (Move `org-xor' into "org-macs.el", 2017-10-17).
2019-08-17 09:54:32 -04:00
Gustav Wikström ae9cd4370b org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el

Changed the way attachments deal with property-inheritance.  It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.

Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).

Added attachment link type with the prefix "attachment:".

Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function

Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook

A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes.  This works for both ID and DIR properties.  The goal is to
make the functionality for attachment links mirror the functionality
for file links.

* lisp/org-attach-git.el

New file, existing functionality.  Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately.  It extends org-attach by use of its
hooks.

Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.

Naming of both functions and tests has been modified to match the move
of functionality into its own module.

* lisp/org.el

Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.

Make org-open-at-point respect ARG when opening attachment-dir.

* lisp/org-compat.el

org-attach-directory has been deprecated in favour for
org-attach-id-dir.  The new name matches its purpose better.

* lisp/ox-html.el

Export attachment links to images as inline images, in the same way as
file links work today.

* etc/ORG-NEWS

Mention the changes in this patch.

* doc/org-manual.org

The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
  existing data around.

- "Capture, Attachments, RSS Feeds and Protocols" for information
  related to working with external data.

The attachment-part has been rewritten and extended to match the
changes in this patch.

The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.

Documentation related to external links has been improved.

* testing/lisp/test-org-attach-annex.el

Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.

* testing/lisp/test-org-attach.el

Add tests for org-attach.

* testing/org-test.el

Define a symbol for a file to test attachments with.

* testing/examples/*

A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2019-07-07 19:55:49 +02:00
Nicolas Goaziou 98475b32d8 Move table-related variables and functions into "org-table"
Slightly re-organize file.
2019-03-15 00:15:30 +01:00
Nicolas Goaziou 2b00d62816 Change bracket link escape syntax
* contrib/lisp/org-link-edit.el (org-link-edit--link-data):
* lisp/ob-tangle.el (org-babel-tangle-comment-links): Update match-group.
(org-babel-detangle): Remove unnecessary `org-link-escape' call.
(org-babel-tangle-jump-to-org): Update match group.
(org-link-url-hexify):
(org-link-escape-chars): Remove variables.
* lisp/ol.el (org-link--decode-compound): Renamed from
  `org-link--unescape-compound'.
(org-link--decode-single-byte-sequence): Renamed from
`org-link--unescape-single-byte-sequence'.
(org-link-make-regexps): Update `org-link-bracket-re' syntax.
(org-link-encode): New function, renamed from `org-link-escape'.
(org-link-decode): New function, renamed from `org-link-unescape'.
(org-link-escape):
(org-link-unescape): Use new escape syntax.
(org-link-make-string): Apply new escaping rules.
(org-link-display-format):
(org-insert-link): Update match group.
* lisp/org-agenda.el (org-diary):
(org-agenda-format-item):
(org-agenda-to-appt): Update match group.
* lisp/org-clock.el (org-clocktable-write-default): Update match group.
* lisp/org-element.el (org-element-link-parser): Update match group.
* lisp/org-mobile.el (org-mobile-escape-olp):
(org-mobile-locate-entry): Apply function renaming.
* lisp/org-protocol.el (org-protocol-split-data):
(org-protocol-parse-parameters): Apply function renaming.
* lisp/org.el (org-refile): Update match group.
* testing/README (Interactive testing from within Emacs): Fix
  examples.
* testing/lisp/test-ol.el (test-ol/encode): Merge old escape tests.
(test-ol/decode): Merge old unescape tests.
(test-ol/escape):
(test-ol/unescape):
(test-ol/make-string): New tests.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/link):
* testing/lisp/test-org.el (test-org/custom-id):
(test-org/fuzzy-links):
* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Update
  tests.
2019-03-10 18:00:36 +01:00
Nicolas Goaziou 3318b50a39 Deprecate `org-link-analytic-bracket-re'
* lisp/ob-tangle.el (org-babel-detangle):
(org-babel-tangle-jump-to-org): Use `org-link-bracket-re'.
* lisp/ol.el (org-link-analytic-bracket-re): Remove variable.
(org-link-make-regexps): Do not set it.
(org-link-display-format): Use `org-link-bracket-re'
(org-link-trim-scheme): New function.
(org-store-link): Remove code duplication.
2019-03-10 18:00:36 +01:00
Nicolas Goaziou 6c9d0e86b1 Fix function declarations 2019-03-10 18:00:36 +01:00
Nicolas Goaziou a486d9cbd7 Move link-related core functions out of "org.el"
* contrib/lisp/org-wl.el (org-wl-store-link-message):
* lisp/Makefile (clean-install):
* lisp/ob-core.el (org-link-bracket-re):
(org-babel-open-src-block-result):
(org-babel-read-element):
(org-babel-read-link):
(org-babel-result-end):
* lisp/ob-tangle.el (org-link-bracket-re):
(org-babel-tangle-single-block):
(org-link-analytic-bracket-re):
(org-babel-detangle):
(org-babel-tangle-jump-to-org):
* lisp/ol.el:
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
(org-diary):
(org-agenda-format-item):
(org-agenda-open-link):
(org-agenda-switch-to):
(org-agenda-to-appt):
* lisp/org-bbdb.el (org-bbdb-store-link):
* lisp/org-bibtex.el (org-bibtex-store-link):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clocktable-write-default):
(org-clock-get-table-data):
* lisp/org-compat.el (org-doi-server-url):
(org-email-link-description-format):
(org-make-link-description-function):
(org-from-is-user-regexp):
(org-descriptive-links):
(org-url-hexify-p):
(org-context-in-file-links):
(org-keep-stored-link-after-insertion):
(org-display-internal-link-with-indirect-buffer):
(org-confirm-shell-link-function):
(org-confirm-shell-link-not-regexp):
(org-confirm-elisp-link-function):
(org-confirm-elisp-link-not-regexp):
(org-file-complete-link):
(org-email-link-description):
(org-make-link-string):
(org-store-link-props):
(org-add-link-props):
(org-make-link-regexps):
(org-angle-link-re):
(org-plain-link-re):
(org-bracket-link-regexp):
(org-bracket-link-analytic-regexp):
(org-any-link-re):
* lisp/org-docview.el (org-docview-store-link):
(org-docview-complete-link):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-eshell.el (org-eshell-store-link):
* lisp/org-eww.el (org-eww-store-link):
(org-eww-copy-for-org-mode):
* lisp/org-footnote.el (org-footnote-next-reference-or-definition):
* lisp/org-gnus.el (org-gnus-article-link):
(org-gnus-store-link):
* lisp/org-id.el (org-id-store-link):
* lisp/org-info.el (org-info-store-link):
* lisp/org-irc.el (org-irc-erc-store-link):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead):
* lisp/org-protocol.el (org-protocol-do-capture):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org-w3m.el (org-w3m-store-link):
(org-w3m-copy-for-org-mode):
2019-03-10 18:00:27 +01:00
Nicolas Goaziou 87a00b3595 Merge branch 'maint' 2019-02-25 13:47:40 +01:00
Nicolas Goaziou d437c1b5de Move obsolete function alias into "org-compat.el" 2019-02-25 13:46:41 +01:00
Nicolas Goaziou 6d9022df22 Make LaTeX preview toggle more useful and predictable
* lisp/org.el (org-remove-highlights-with-change):
(org-mode): Update.
(org--format-latex-make-overlay):
(org--list-latex-overlays): Remove functions.
(org--make-preview-overlay):
(org-clear-latex-preview):
(org--latex-preview-region):
(org-latex-preview): New functions.
(org-format-latex): Use new function
* lisp/org-compat.el (org-toggle-latex-fragment):
(org-remove-latex-fragment-image-overlays): Deprecate.
* doc/org-manual.org (Previewing LaTeX fragments): Update
  documentation about `org-latex-preview'.

See <http://lists.gnu.org/archive/html/emacs-orgmode/2019-02/msg00138.html>.
2019-02-14 00:14:25 +01:00
Kyle Meyer ba321d0e44 Merge branch 'maint' 2019-01-13 15:14:37 -05:00
Kyle Meyer d782b01d35 org-compat: Add org-current-time-as-list
* lisp/org-compat.el (org-current-time-as-list): New function for
compatibility with Emacsen before 27.1.

This is a follow-up to the backport of Emacs's 93fe42094.
2019-01-13 12:43:04 -05:00
Kyle Meyer 6c4acc8ded org-compat: Define file-attribute accessors
* lisp/org-compat.el (file-attribute-modification-time,
file-attribute-size): New functions for compatibility with Emacsen
before 26.1.

This is a follow-up to the backport of Emacs's 662bee7d7.
2019-01-13 12:43:04 -05:00
Kyle Meyer da31714c10 org-compat: Define proper-list-p
* lisp/org-compat.el (proper-list-p): New function for compatibility
with Emacsen before 27.1.

This is a follow-up to the backport of Emacs's 2fde6275b.
2019-01-13 12:43:04 -05:00
Nicolas Goaziou f1de41e172 org-compat: Remove unnecessary obsolete definitions 2019-01-02 16:10:25 +01:00
stardiviner 34b71a0ca9 Add a dispatcher command for inserting dynamic blocks
* lisp/org.el (org-dynamic-block-insert-dblock,
  org-dynamic-block-alist, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-define,
  org-dynamic-block-function): New variables, New functions.

* lisp/org-keys.el (org-dynamic-block-insert-dblock): Add binding for
  the function.
(org-clock-report, org-columns-insert-dblock): Remove function
keybindings. Mark them as obsolete.

* doc/org-manual.org (Dynamic Blocks): : Add manual for dispatch
command `org-dynamic-block-insert-dblock'.

* testing/lisp/test-org-clock.el: New test.
2019-01-02 15:55:51 +01:00
Bastien 7a22b8f93b Merge branch 'maint' 2019-01-01 11:54:01 +01:00
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou cd12a9eefe Merge branch 'master' into next 2018-11-10 20:00:31 +01:00