Commit Graph

426 Commits

Author SHA1 Message Date
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 9cf2040313 Move `org-replace-escapes' into "org-macs.el"
* lisp/org.el (org-replace-escapes): Move function...
* lisp/org-macs.el: ...there.
2019-03-10 18:00:36 +01:00
Nicolas Goaziou ccfea3d8e5 Move `org-fill-template' into "org-macs.el"
* lisp/org.el (org-fill-template): Move function
* lisp/org-macs.el: ...there.
2019-03-10 18:00:36 +01:00
Paul Eggert a6cead0d21 Backport commit 476066e89 from Emacs
* lisp/org-clock.el (org-clock-out):
* lisp/org.el (org-evaluate-time-range):
Avoid double-rounding of time-related values.  Simplify.
* lisp/org-clock.el (org-resolve-clocks-if-idle):
Use time-since instead of open-coding most of it.
* lisp/org-agenda.el (org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-table.el (org-table-sum):
* lisp/org.el (org-babel-load-file, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now):
Simplify.

Note(km): Many of the changes from 476066e89 have been dropped for
compatibility with older Emacsen.

Avoid some double-rounding of Lisp timestamps
476066e89d6f0bb87220da690b8a476bf9655b80
Paul Eggert
Fri Feb 22 18:33:57 2019 -0800
2019-03-03 22:49:42 -05:00
Nicolas Goaziou e54f09af50 org-macs: Fix visibility issue with file local variables
* lisp/org-macs.el (org-preserve-local-variables): When file local
  variables are preserved and located in a folded section, make sure
  to hide them again.

Reported-by: Scott Randby <srandby@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-02/msg00105.html>
2019-02-12 23:33:01 +01:00
Glenn Morris d5a7a1a22c Backport commit 1c7db8aa3 from Emacs
* lisp/org-ctags.el:
* lisp/org-macs.el: Explicitly require cl-lib as needed.

Explicitly require cl-lib where needed
1c7db8aa30969d0bc0e6d35b9bd57c70314ed9d0
Glenn Morris
Fri Mar 16 20:41:17 2018 -0400
2019-01-13 12:43:04 -05:00
Kyle Meyer c11b147d1d org-parse-time-string: Describe time stamp matching behavior
* lisp/org-macs.el (org-parse-time-string): Document matching of
YYYY-MM-DD substring.

org-clock-special-range used to pass in <-50001-11-30 Tue 00:00> with
the expectation that the year would be parsed as -50001, not 0001.
Mention this YYYY-MM-DD format assumption in the docstring to help
avoid such cases.
2019-01-13 12:43:03 -05:00
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou f5c2659bb8 Use `org-strip-quote' when possible
* lisp/org-macs.el (org-unbracket-string):
(org-strip-quotes): Allow nil values.
* lisp/org-lint.el (org-lint-wrong-include-link-parameter):
* lisp/org-macro.el (org-macro--collect-macros):
* lisp/org.el (org--setup-collect-keywords):
(org-edit-special):
* lisp/ox.el (org-export--get-inbuffer-options):
(org-export--list-bound-variables):
(org-export-expand-include-keyword): Use `org-strip-quote' instead of
`org-unbracket-string' whenever possible.
2018-11-10 08:58:31 +01:00
Nicolas Goaziou 4b905774ac org-macs: Fix last commit
* lisp/org-macs.el (org--string-from-props): Do not raise an error on
  unsupported display properties.  Change signature to avoid creating
  new strings unnecessarily.  Update docstring accordingly.
(org-string-width): Apply signature change.
* testing/lisp/test-org-macs.el (test-org/string-width): Add test.

Reported-by: Colin Baxter <m43cap@yandex.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00346.html>
2018-10-26 14:37:57 +02:00
Nicolas Goaziou b886ebbc89 org-macs: `org-string-width' handles images
* lisp/org-macs.el (org--string-from-props): Handle image display
  properties.
(org-string-width): Improve docstring.
2018-10-25 15:34:05 +02:00
Nicolas Goaziou e7911a0fb1 org-macs: Add missing docstring
* lisp/org-macs.el (org-current-line-string): Add missing docstring.
2018-10-06 09:44:35 +02:00
Nicolas Goaziou 5cc69a9ebf Deprecate `org-babel-strip-quotes' in favor of `org-strip-quotes'
* lisp/ob-core.el (org-babel-strip-quotes): Remove function.
* lisp/org-macs.el (org-strip-quotes): New function.
* lisp/org-compat.el (org-babel-strip-quotes): Alias for new function.
* lisp/ob-haskell.el (org-babel-execute:haskell):
* lisp/ob-octave.el (org-babel-octave-evaluate-session): Use new function.
2018-10-06 09:40:33 +02:00
Nicolas Goaziou 1334572582 org-macs: Optimize `org-string-width'
* lisp/org-macs.el (org--string-from-props): New function.
(org-string-display): Remove function.
(org-string-width): Use new function.
2018-08-30 21:09:57 +02:00
Nicolas Goaziou 9a816fe3ea org-macs: Optimize `org-split-string'
* lisp/org-macs.el (org-split-string): Do less consing. Do not rely on
  `split-string'.
2018-08-30 21:09:57 +02:00
Nicolas Goaziou 417479238b org-macs: Move a macro 2018-07-17 11:41:58 +02:00
Nicolas Goaziou 937e7ce76b org-macs: Fix last commit
* lisp/org-macs.el (org-parse-time-string): Fix typo in last commit.
* testing/lisp/test-org-element.el (test-org-element/timestamp):
  Rename to `test-org-element/timestamp-parser'.
2018-07-02 00:18:44 +02:00
Nicolas Goaziou e1884a0985 org-macs: Tiny refactoring
* lisp/org-macs.el (org-parse-time-string): Refactor code.

`org-parse-time-string' does not need to handle non-Org timestamps,
like "<tomorrow>" or "<+2d>" so we remove the cond branch.
2018-07-01 23:25:56 +02:00
Nicolas Goaziou 6f8fdabf35 org-macs: Fix circular dependency
* lisp/org-macs.el (org-matcher-time): Fix circular dependency between
  `org-parse-time-string', `org-matcher-time' and `org-2ft'.  Improve
  docstring.

Reported-by: Allen Li <vianchielfaura@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2017-11/msg00023.html>
2018-06-28 22:40:51 +02:00
Nicolas Goaziou 6c3ce3c17b org-macs: Fix `provide' location 2018-06-19 22:42:11 +02:00
Aaron Ecay 7106eab974 Many small code improvements
* lisp/org-capture.el (org-capture-member): Make obsolete; the old
definition was identical to ‘org-capture-get’ anyway.
(org-capture-mode-map): Move the calls to ‘define-key’ up to where the
variable is defined.
(org-capture-mode-hook): Small docstring tweak.
(org-capture-mode): Fix typo in mode lighter.
(org-capture-set-target-location, org-capture-place-item):
(org-capture-place-plain-text, org-capture-narrow):
(org-capture-empty-lines-after):
(org-capture-import-remember-templates): ‘if’ without else -> ‘when’
* lisp/org-colview.el (org-columns-edit-value): Change an error to a
user-error.
(org-columns-uncompile-format): Improve docstring.
* lisp/org-compat.el (org-remove-from-invisibility-spec): Make
obsolete, the underlying emacs function exists since 1997, commit 31aa282e.
(org-in-invisibility-spec-p, org-count-lines): ‘if’ without else -> ‘when’.
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-entities.el (org-entities-create-table):
* lisp/org-list.el (org-insert-item):
* lisp/org-macs.el (org-with-point-at, org-base-buffer):
(org-preserve-local-variables, org-overlay-display):
(org-overlay-before-string): ‘if’ without else -> ‘when’.
* lisp/org-eshell.el (org-eshell-open): Fix docstring typo.
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/language):
(pcomplete/org-mode/file-option/startup):
(pcomplete/org-mode/file-option/options):
(pcomplete/org-mode/file-option/infojs_opt):
(pcomplete/org-mode/link, pcomplete/org-mode/tex):
(pcomplete/org-mode/todo, pcomplete/org-mode/searchhead):
(pcomplete/org-mode/tag, pcomplete/org-mode/prop): Avoid the formerly
misspelled ‘pcomplete-uniqify-list’ function.  It has a defalias in
emacs >= 27; we add our own for older emacsen.
(pcomplete/org-mode/file-option/bind): ‘if’ without else -> ‘when’.
* lisp/org-protocol.el (org-protocol-capture):
(org-protocol-convert-query-to-plist): ‘if’ without else -> ‘when’.
(org-protocol-do-capture): Pacify byte compiler, simplify conditional
logic.
* lisp/org-table.el (org-table-create-with-table.el): Simplify conditional
logic.
(org-table-create, org-table-convert-region, org-table-next-field):
(org-table-beginning-of-field, org-table-end-of-field):
* lisp/org-w3m.el (org-w3m-copy-for-org-mode): ‘if’ without else ->
‘when’.
* lisp/org.el (org-babel-do-load-languages, org-previous-link):
(org-refile): Use ‘(foo ...)’ instead of ‘(funcall 'foo ...)’.
(org-add-log-note): Convert a long cond into a cl-case.
(org-priority): Improve docstring, show a deprecation warning if the
‘show’ argument is passed (which was previously silently ignored).
Also, use ?\s instead of ?\ as a character literal for space.
(org-fast-tag-insert): Fix docstring typo.
(org-fill-element): ‘if’ without else -> ‘when’.
(org-on-target-p): Remove ancient compatibility alias.
2018-05-10 04:22:30 +01:00
Aaron Ecay 581fd90645 Fix declare-function and friends in org.el
* lisp/org-table.el (org-table-with-shrunk-field): Move from here...
* lisp/org-macs.el: ...to here

The move is necessary because this macro is used (at compile time) in
org.el.  We cannot leave its definition in org-table, because that
would lead to a require loop.  So we need to put it in org-macs, and
require the latter file in org.el also at compile time.

Finally, update and sort the declare-function calls.
2018-05-10 01:07:57 +01:00
Aaron Ecay 4afb7f747b Update declare-function calls for functions that have moved.
In cases where functions have moved from org.el into org-macs.el, it
is often possible to replace declare-function by (require 'org-macs)
2018-05-10 01:04:12 +01:00
Nicolas Goaziou 0dda9bf1c1 Mark `org-get-indentation' as obsolete
* lisp/org-macs.el (org-get-indentation): Move function...
* lisp/org-compat: ... here.
* lisp/ob-core.el (org-babel-demarcate-block):
(org-babel-insert-result):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
* lisp/org-capture.el (org-capture-place-item):
* lisp/org-clock.el (org-clock-in):
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-feed.el (org-feed-format-entry):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-list.el (org-in-item-p):
(org-list-struct):
(org-list-struct-apply-struct):
(org-list-item-body-column):
(org-toggle-item):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-fixup-indentation):
(org-cdlatex-environment-indent):
(org--get-expected-indentation):
(org-indent-region):
(org-toggle-fixed-width):
* lisp/ox.el (org-export-expand-include-keyword): Use
  `current-indentation' instead.
2018-05-09 01:26:31 +02:00
Carsten Dominik ee336b8cf7 Fix typo in docstring 2018-05-03 09:25:56 +02:00
Nicolas Goaziou 4a3c1a414b org-macs: Silence byte-compiler 2018-04-30 13:59:34 +02:00
Nicolas Goaziou 6d4e0b3dd1 Move `org-no-popups' to "org-macs.el"
* lisp/org-compat.el (org-no-popups): Move function...
* lisp/org-macs.el : ... here.
2018-04-30 13:58:25 +02:00
Nicolas Goaziou 722f8a517f org-macs: Re-order sections alphabetically 2018-04-29 12:09:34 +02:00
Nicolas Goaziou 3c013ba24d Silence byte-compiler 2018-04-29 12:03:17 +02:00
Nicolas Goaziou 9d8aade7ec Mark `org-with-silent-modifications' as obsolete
* lisp/org-clock.el (org-clock-sum):
* lisp/org-colview.el (org-columns--display-here):
(org-columns-remove-overlays):
(org-columns-quit):
(org-columns-edit-value):
(org-columns--compute-spec):
(org-columns-compute-all):
(org-agenda-colview-compute):
* lisp/org-indent.el (org-indent-remove-properties):
(org-indent-add-properties):
* lisp/org.el (org-sort-entries):
(org-refresh-properties):
(org-refresh-category-properties):
(org-refresh-stats-properties):
(org-agenda-prepare-buffers): Do not use
`org-with-silent-modifications'.
2018-04-29 12:02:01 +02:00
Nicolas Goaziou 31afe4b718 Move window-related function to "org-macs.el"
* lisp/org.el (org-switch-to-buffer-other-window):
* lisp/org-compat.el (org-fit-window-to-buffer): Move functions...
* lisp/org-macs.el: ... here.
2018-04-29 10:31:24 +02:00
Nicolas Goaziou 4d568fc83c Move `org-parse-time-string' to "org-macs.el"
* lisp/org.el (org-parse-time-string): Move function...
* lisp/org-macs.el : ... here.  Remove obsolete FIXME.  Improve
  docstring.
2018-04-29 10:26:41 +02:00
Nicolas Goaziou cc9ae41738 Mark `org-preserve-lc' as obsolete
* lisp/org-macs.el (org-preserve-lc): Move function...
* lisp/org-compat.el (org-preserve-lc): ... here.

The function is no longer used in code base.
2018-04-29 00:44:26 +02:00
Nicolas Goaziou ff3f3876a8 Move time related functions from "org.el" to "org-macs.el"
* lisp/org.el (org-2ft):
(org-time=):
(org-time<):
(org-time<=):
(org-time>):
(org-time>=):
(org-time<>):
(org-matcher-time): Move from here to...
* lisp/org-macs.el: ... here
2018-04-17 16:06:09 +02:00
Nicolas Goaziou 384d763447 Move some functions into "org-macs.el"
* lisp/org.el (org-file-newer-than-p):
(org-compile-file): Move...
* lisp/org-macs.el: ... here.
2018-04-11 22:03:18 +02:00
Rasmus ac4d5fe1b3 org-macs: Make tab, space and RET equivalent in org-mks
* lisp/org-macs.el (org--mks-read-key): New function.
  (org-mks): Use new function and make space, tab and RET equivalent.
2018-04-08 12:47:08 +02:00
Rasmus 06ab656f42 org-macs: Move org-mks from org-capture to org-macs
* lisp/org-capture.el (org-mks): Moved to org-macs.el.
* lisp/org-macs.el (org-mks): Added from org-capture.el.

The move is being done to accommodate the usage of org-mks in other
Org libraries.
2018-04-07 13:03:18 +02:00
Nicolas Goaziou 409a62e5c9 Move some string functions to "org-macs.el"
* lisp/org.el (org-string<):
(org-string<=):
(org-string>=):
(org-string>):
(org-string<>): Move to...
* lisp/org-macs.el: ... here.
2018-03-13 09:26:53 +01:00
Nicolas Goaziou 6cb6ddc671 org-macs.el: Tiny re-ordering 2018-02-11 11:45:07 +01:00
Nicolas Goaziou f487fccbec org-macs: Use `define-key' instead of `org-defkey'
* lisp/org-macs.el (org-completing-read): Use `define-key' instead of
  `org-defkey'.

For bootstrapping reasons, "org-macs.el" isn't expected to require
functions from "org.el". Besides, minibuffer isn't supposed to depend
of `org-disputed-keys' either.
2018-02-11 11:40:21 +01:00
Nicolas Goaziou 013941de86 `org-save-outline-visibility' preserve outline, blocks and drawers
* lisp/org-macs.el (org-save-outline-visibility): Also preserve blocks
  and drawers visibility.  Re-implement without helper functions.
  (org-outline-overlay-data):
  (org-set-outline-overlay-data): Remove functions.
2018-02-11 11:37:50 +01:00
Nicolas Goaziou 2956408f75 Move `org-flag-region' to "org-macs.el"
* lisp/org.el (org-flag-region): Move function...
* lisp/org-macs.el (org-flag-region): ... here.
2018-02-11 11:27:53 +01:00
Nicolas Goaziou 86f3ef8d80 org-macs: Fix typo in docstring.
* lisp/org-macs.el (org-match-any-p): Fix typo in docstring.
2018-01-31 18:20:25 +01:00
Nicolas Goaziou 8ecc4c4365 Move `org-match-any-p' in "org-macs.el"
* lisp/org-macs.el (org-match-any-p): Moved from "org.el".
* lisp/org.el (org-match-any-p): Removed.
2018-01-23 09:48:01 +01:00
Nicolas Goaziou b7e94882ea Move some indentation functions in "org-macs.el", remove others
* lisp/org-macs.el (org-get-indentation): Moved from "org.el"
(org-get-string-indentation):
(org-fix-indentation): Remove functions.
2018-01-20 15:54:20 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Nicolas Goaziou 000b943ebd Re-order visibility functions in "org.el"
* lisp/org-macs.el (org-outline-overlay-data):
(org-set-outline-overlay-data): Moved from "org.el".
* lisp/org.el (org-remove-empty-overlays-at):
(org-show-empty-lines-in-parent):
(org-files-list):
(org-entry-beginning-position):
(org-entry-end-position):
(org-subtree-end-visible-p):
(org-first-headline-recenter):
(org-flag-region):
(org-show-entry):
(org-show-children):
(org-show-subtree):
(org-hide-block-toggle-maybe):
(org-hide-block-toggle):
(org-hide-block-toggle-all):
(org-hide-block-all):
(org-cycle-hide-drawers):
(org-flag-drawer):
(org-previous-block):
(org-next-block): Move functions.
2018-01-13 14:15:53 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00