Commit Graph

602 Commits

Author SHA1 Message Date
Ihor Radchenko dd0a723603
org-fold-core: Do not override default fontification
* lisp/org-fold-core.el: Remove the code overriding
`font-lock-default-fontify-region'.  Emacs itself is skipping
fontification of invisible text and doing it more efficiently.  The
org-fold fontification overrides are redundant, except when some
poorly written third-party code is forcing fontification inside folded
regions.  However, Org does not need to entertain poorly written third
party code, especially when the required supporting code is reducing
font-lock performance and is complicating the maintenance.
(org-fold-core--specs):
(org-fold-core-add-folding-spec): Remove `:font-lock-skip' spec.
(org-fold-core-initialize):
(org-fold-core--fontifying):
(org-fold-core-region):
(org-fold-core--force-fontification):
(org-fold-core-fontify-region): Remove custom fontification.
* lisp/org-fold.el (org-fold-initialize): Remove `:font-lock-skip'
spec.
* lisp/org-macs.el (org-fold-core--force-fontification):
(org-with-forced-fontification):
(org-buffer-substring-fontified):
(org-looking-at-fontified): Remove org-fold's font-lock logic.
2022-08-23 12:01:34 +08:00
Ihor Radchenko d3a9c424ba
org-encode-time: Refactor into top-level `defmacro'
* lisp/org-macs.el (org-encode-time): Rewrite, avoiding top-level `if'
statement that triggers
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56746

Also, fix the docstring warnings.
2022-08-16 17:16:41 +08:00
Ihor Radchenko b8a0ddf52f
Use the full org-fold-core API when `org-fold-core-style' is `overlays'
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-08-13 15:03:28 +08:00
Ihor Radchenko 5a1b050310
org-colview: Do not rely on `current-column' ignoring display properties
* lisp/org-macs.el (org-current-text-column): New macro calculating
current column without accounting display text properties.

* lisp/org-colview.el (org-columns-check-computed):
(org-columns-next-allowed-value):
(org-columns-new):
(org-columns-delete):
(org-columns-edit-attributes):
(org-columns-widen):
(org-columns-move-right):
(org-columns-move-left):
(org-columns-update): Use the new macro when calculating point
position in the column view table overlay.  Do _not_ use the new
macro when we want to get the visual column position of the point.

Fixes "test-org-colview/" failures on Emacs 29 after Emacs commit
4243747b1b8c3b7e3463822804b32e83febe2878:

;; Fix 'current-column' in the presence of display strings

;; * src/indent.c (check_display_width): Support calculation of width
;; of 'display' properties whose values are strings.  This fixes the
;; value returned by 'current-column' when display strings are
;; present between BOL and point.  (Bug#53795)

See https://orgmode.org/list/CACnOyijQc7BDDtrYQb+=VoGWkpWAyMu7O4qsvGpsU6SCgwiM8Q@mail.gmail.com
2022-08-06 13:33:44 +08:00
Ihor Radchenko 4d0295b315
Avoid ignoring LaTeX export output errors
* lisp/org-macs.el (org-compile-file): When PROCESS is a list, keep
output of all the listed commands, not just the last one.
* lisp/ox-latex.el (org-latex-pdf-process): Clarify that the process
output is parsed to detect compilation errors/warnings.
2022-07-31 15:30:51 +08:00
Paul Eggert 6013cb161d Fix doc string quoting problems with '
The Emacs doc string convention is to document values as-is when that
is clear, and surrounded by `single quotes' otherwise. For example, a
doc string "(a b c)" stands for a list of symbols, and the doc string
"`a'" stands for a single symbol. The doc string "\\=`a" is typically
not correct for that single symbol, because that is equivalent to
"(quote a)" and the typical intent is to talk about the symbol, not
about the Lisp quoting construct.  One needs "\\=`X" only when talking
about something intended to be equivalent to "(quote X)", as in the
doc string "(provide \\='org-xyz)".
2022-07-25 13:10:29 -07:00
Max Nikulin ae1db7df39
Use `org-encode-time' helper macro
* lisp/ol.el (org-store-link):
* lisp/org-agenda.el (org-agenda-get-timestamps)
(org-agenda-get-progress, agenda-bulk-action):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clock-get-sum-start)
(org-clock-special-range, org-clocktable-shift)
(org-clocktable-steps):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-datetree.el (org-datetree-find-iso-week-create)
(org-datetree-insert-line):
* lisp/org-element.el (org-element-timestamp-interpreter):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-matcher-time):
* lisp/org.el (org-current-time, org-current-effective-time)
(org-add-planning-info, org-read-date, org-read-date-display)
(org-read-date-analyze, org-eval-in-calendar)
(org-calendar-select, org-display-custom-time)
(org-calendar-select-mouse, org-time-string-to-time)
(org-time-from-absolute, org-at-clock-log-p)
(org-date-from-calendar, org-get-cursor-date)
(org-timestamp-to-time):
* testing/lisp/test-org-clock.el (org-test-clock-create-timestamp):
* lisp/ox-icalendar.el (org-icalendar-convert-timestamp):
Avoid direct calls of `encode-time', use `org-encode-time' instead.

Org supports Emacs-26, but the recommended way to call `encode-time'
changed in Emacs-27.  In Emacs-29 DST and TZ elements of the single list
arguments became optional.  In Org it is still convenient to call the
function with separate arguments without explicit DST and TZ arguments.
The `org-encode-time' should mitigate attempts to modernize Org code
directly in the Emacs repository.
2022-07-17 16:40:18 +08:00
Max Nikulin 8908a1bda1
org-macs.el: Introduce a helper for `encode-time'
* lisp/org-macs.el (org-encode-time): New compatibility and convenience
helper macro to allow a list for time components or separate arguments
independently of Emacs version.
* testing/lisp/test-org.el (org-test-with-timezone): New macro to ensure
that some code is executed with certain TZ environment value and thus
particular daylight saving time or other time shift rules are active.
* testing/lisp/test-org.el (test-org/org-encode-time): Tests for various
ways to call `org-encode-time'.

Ensure recommended way to call `encode-time' for Emacs-27 and newer with
hope to avoid bugs due to attempts to modernize the code similar to
bug#54731.  6-elements list may be allowed as `encode-time' argument
since Emacs-29, see bug#54764.
2022-07-17 16:38:53 +08:00
Paul Eggert a4105d0942
Use higher level helpers instead of `encode-time'
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
Prefer org-time-string-to-seconds to doing it by hand.
* lisp/org-macs.el (org-2ft):
Prefer org-time-string-to-seconds to doing it by hand.
* lisp/org-table.el (org-table-eval-formula):
Prefer org-time-string-to-time to doing it by hand.

Max Nikulin:
A larger patch "Improve Org usage of timestamps" was suggested in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54764#10

Only cosmetic changes are selected for this patch.
2022-07-17 16:38:51 +08:00
Paul Eggert 132a9d304e
Use unknown DST instead of standard time in timestamps
* lisp/ol.el (org-store-link): Prefer plain (encode-time ...)
to (apply 'encode-time ...), for speed.
* lisp/org-macs.el (org-parse-time-string): Return unknown DST,
not standard time.
* lisp/org.el (org-read-date-analyze): Return a timestamp with a DST
flag of -1 (unknown) rather than nil (standard time).

Max Nikulin:
A larger patch "Improve Org usage of timestamps" was suggested in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54764#10

Changes selected for this patch normalizes timestamp format:
if it is a list than it should contain 9 elements to be compatible
with Emacs-27 and Emacs-28 `encode-time' single argument, nil should not
be used for DST field since it means standard time while actual value
is unknown and should be guessed.

Ignacio Casso reported a problem with agenda
https://list.orgmode.org/PAXPR06MB7760238F410CBE3203F78EE0C61E9@PAXPR06MB7760.eurprd06.prod.outlook.com
due to Emacs commit dd0727e1ec1 changing Org code.  It was mostly reverted
by 8ef37913d3 (bug#54731).  Code in the Org repository did not have
the bug, but it safer to add protection against similar refactoring.
2022-07-17 16:38:50 +08:00
Stefan Kangas 0ed0dea229
Delete some Emacs 24 compat code
Org mode supports Emacs 26 or newer:
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility

* lisp/org-compat.el (org-set-transient-map)
(org-font-lock-ensure): Delete compat aliases.  Update callers.
(org-define-error): Redefine as obsolete function alias for
`define-error'.  Update callers.
(string-suffix-p): Delete compatibility definition.

* lisp/org-fold-core.el (org-fold-core--seq-partition): Delete private
function and update callers to use `seq-partition'.

* lisp/org-macs.el (org-without-partial-completion): Move from here...
* lisp/org-compat.el (org-without-partial-completion): ...to here.
Redefine as obsolete function alias for `progn'.
2022-07-02 12:10:00 +08:00
Ihor Radchenko eb796ae432
org-element-cache: Use `buffer-size' to detect silent modifications
* lisp/org-element.el (org-element--cache-diagnostics-modifications):
(org-element--cache-silent-modification-check): Remove variables that
were introduced to deal with false positives.  The new check is more
reliable.
(org-element--cache-last-buffer-size): New variable storing the last
known buffer size registered before/after handled buffer edits.
(org-element--cache-sync): Use `buffer-size' instead of
`buffer-chars-modified-tick' heuristics.  `buffer-size' may not catch
all the modifications, but it does not cause numerous
false-positives triggered by quail.  See Emacs Bug#51766 for the
detailed discussion.
(org-element--cache-before-change):
(org-element-cache-reset): Record buffer size before/after changes.
* lisp/org-macs.el (org-unique-local-variables): Do not carry over
buffer-local `org-element--cache-last-buffer-size' when cloning
buffer.
2022-06-29 09:15:52 +08:00
Stefan Kangas 13d97ee18c
Prefer "website" to "homepage"
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-26 10:10:48 +08:00
Stefan Kangas 45174d62b9
Remove XEmacs and ancient Emacs compat code
* lisp/org-colview.el (org-columns-remove-overlays):
* lisp/org-ctags.el (org-ctags-find-tag-interactive):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-mouse.el (org-mouse-show-context-menu):
* lisp/org-table.el (org-table-fedit-lisp-indent):
* lisp/org.el (org-version, org-reload):
* lisp/ox-html.el (org-html-template, org-html--build-meta-info):
Remove Emacs 21 and 22 compat code.

* lisp/ol-eww.el (org-eww-copy-for-org-mode):
* lisp/ol-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-refile.el (org-refile):
* lisp/org.el (org-change-tag-in-region): Remove XEmacs compat code.

* lisp/org-goto.el (org-goto--set-map):
* lisp/org-macs.el (org-fit-window-to-buffer):
* lisp/org-table.el (orgtbl-mode):
* lisp/org.el (org-setup-filling): Remove XEmacs or Emacs 19 or 20
compat code.  (It is one of these; not clear which.)
2022-06-18 15:43:30 +08:00
Ignacio Casso aa789b89d7
Do not mark buffer as modified with org-preserve-local-variables
* lisp/org-macs.el (org-preserve-local-variables): Do not mark buffer
as modified or alter `buffer-undo-list' when body does not actually
modify the buffer.

This commit fixes a bug with `org-copy-subtree', which marked the
buffer as modified and added an entry to the undo list when the visited
file had local variables.
2022-06-14 22:02:10 +08:00
Ihor Radchenko e156e54251
org-clone-local-variables: Prevent carrying over cache data
* lisp/org-macs.el (org-unique-local-variables): Add newly added cache
variables.  They must not be copied by `org-clone-local-variables'.
Otherwise, random failure may happen when cache does not correspond to
the buffer text.
2022-06-04 11:51:00 +08:00
Ihor Radchenko 962b796900
org-element: Implement tree search caching
* lisp/org-element.el (org-element--cache-hash-size):
(org-element--cache-hash-statistics):
(org-element--cache-hash-nocache):
(org-element--cache-hash-size):
(org-element--cache-hash-left):
(org-element--cache-hash-right): Implement recent search cache for
`org-element--cache-find'.  The cache stores recent cache tree queries
as a vector with O(1) access time.

(org-element--cache-find): Make use of `org-element--cache-hash-left'
and `org-element--cache-hash-right' when cached query element starts
at POS and SIDE is nil.  Record statistics.

(org-element-cache-reset): Reset search cache on init.

(org-element-cache-hash-show-statistics): Provide a command reporting
the new caching efficiency.  Can be used for debugging/survey
purposes.

* lisp/org-macs.el (org-knuth-hash): Implement multiplicative hash
function.

Preliminary testing reveals that this simple strategy can reduce query
time from O(Log N) down to O(1) for ~30%-50% cache queries.
2022-06-03 09:59:58 +08:00
Ihor Radchenko d6bae908f3
Fix macro indentation and re-indent code misindented by nameless
* 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-05-14 16:58:35 +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
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 062e30be8a
org-macs.el: Fix fontification checks take 2 2022-04-25 19:40:13 +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 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 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 17e762426d
Move `org-buffer-list' to org-macs.el 2022-04-25 19:40:00 +08:00
Ihor Radchenko f63ff07441
Fix subtle differences between overlays and invisible text properties
* lisp/org-clock.el (org-clock-in):
(org-clock-find-position):
(org-clock-out):
* lisp/org.el (org-add-planning-info):
(org-scan-tags):
(org-global-tags-completion-table):
(org-make-tags-matcher):
(org-tags-expand):
(org--property-local-values):
(org-read-date-analyze):
(org-revert-all-org-buffers):
(org-beginning-of-line): Make sure that we inherit invisible state
when inserting text.
(org-sort-entries): Preserve invisible state after replace-match.

(org-log-beginning): Do not try to move by visible lines.

* lisp/org-macs.el (org-preserve-local-variables): Do not try to
preserve overlays.
* lisp/ox.el (org-export--generate-copy-script): Preserve folding
properties in export buffer.
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Fix
test failure.
* testing/lisp/test-org.el (test-org/meta-return):
(test-org/custom-properties): Use new folding.
2022-04-25 19:39:56 +08:00
Ihor Radchenko 77aa9be5ac
Implement overlay- and text-property-based versions of some functions 2022-04-25 19:39:54 +08:00
Ihor Radchenko fa7530c7b4
Rename old function call to use org-fold 2022-04-25 19:39:53 +08:00
Ihor Radchenko d048c153dd
org-string-width: Reimplement to work with new folding
* lisp/org-macs.el (org--string-from-props): Removed since it is no
longer needed.
(org-string-width): Updated to use `window-text-pixel-size'.
2022-04-25 19:39:52 +08:00
Ihor Radchenko b7dae51dbb
org-macs: New function org-find-text-property-region 2022-04-25 19:39:51 +08:00
Karl Fogel d80aa2776c
lisp/org-macs.el: Fix spelling of `org-truly-invisible-p'
* lisp/org-macs.el (org-truly-invisible-p): Fix spelling of name.
* lisp/org-compat.el (org-truely-invisible-p): Add compatibility
  alias for the old name.
2022-04-07 12:43:36 +08:00
Ihor Radchenko 2b49d6fd9c
org-id-update-id-locations: Disable cache in throwaway buffers
* lisp/org-macs.el (org-element-with-disabled-cache): Move from
org-element.el to org-macs.el
2022-01-30 15:40:14 +08:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Kyle Meyer cc2490a706 Prune Emacs 25.1 compatibility kludges
* 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-10-04 23:43:14 -04:00
Sébastien Miquel e1c49af76d org-src.el: Fix special editing of LaTeX fragments
* lisp/org-macs.el (org-do-remove-indentation): Add optional argument
to skip the first line.
* lisp/org-src.el (org-src--coordinates): Fix coordinates for inline
LaTeX fragments.
(org-src--contents-for-write-back): Do not indent first line for LaTeX
fragments.
(org-src--edit-element): Compute block-indentation according to parent
for LaTeX fragments.  Skip first line when removing common indentation
for LaTeX fragments.
2021-09-30 16:16:52 +02:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Yasushi SHOJI 3a291b0f0e ox-publish.el: Add `org-html-publish-to-html' as the default publishing function
* lisp/org-macs.el (org-plist-delete-all): New function.

* lisp/ox-publish.el (org-publish-file): Add
`org-html-publish-to-html' as the default publishing function.

* testing/lisp/test-ox-publish.el (org-test-publish): Use
`org-plist-delete-all' to remove properties from the plist.

Reported-by: Christopher W. Ryan
See <https://list.orgmode.org/CAELBRWLgV-s6SGX=cevtN7iW8htwiLezR469T-cGMWE_6iX1+A@mail.gmail.com>
2021-09-29 09:14:43 +02:00
Bastien 769a557ceb Merge branch 'bugfix' 2021-09-25 18:17:46 +02:00
Ihor Radchenko 399481bad1 Do not ignore user-defined display-buffer-alist in org-insert-link
* lisp/ol.el (org-insert-link): Handle case when *Org Links* window is
not created.
* lisp/org-macs.el (org-no-popups): Do not override
`display-buffer-alist'. Use `pop-up-windows' instead.
2021-09-25 18:17:32 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
TEC d70f280678
org-macs: Allow for nil ffap-url-regexp
* lisp/org-macs.el (org-url-p): `ffap-url-regexp' is allowed to be nil,
which is taken to mean urls should not be matched.  When this is set,
`string-match-p' errors.  To consider this case correctly, we check that
`ffap-url-regexp' is non-nil before calling `string-match-p'.

Reported-by: "Peder Stray" <peder.stray@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2021-09/msg00004.html>
2021-09-01 22:43:07 +08:00
Nicolas Goaziou 6de34f2891 Move `org-file-url-p' to "org-macs.el", rename it to `org-url-p'
* lisp/org-macs.el (org-url-p): New function.
* lisp/org-compat.el (org-file-url-p): Make obsolete alias for
function above.
* lisp/org-lint.el (org-lint-non-existent-setupfile-parameter):
* lisp/org.el (org--collect-keywords-1):
(org-file-contents):
(org-edit-special): Use new function.
2021-05-18 16:31:39 +02:00
Bastien 336efd6dd9 lisp/*: Use version number when obsoleting
* lisp/org-compat.el:
* lisp/org-agenda.el:
* lisp/org-macs.el:
* lisp/org.el:
* lisp/ob-sqlite.el: Use version number when obsoleting.
2021-05-16 09:54:28 +02:00
Bastien 0f2ece647b Update Carsten's email address in some files 2021-05-07 16:50:57 +02:00
Kyle Meyer e2e89cea87 Merge branch 'km/from-emacs-master' 2021-03-27 02:20:45 -04:00
Basil L. Contovounesios f10773675d Backport commit 331ddd803 from Emacs
* lisp/org-macs.el (org--string-from-props): Pacify warnings
about unknown functions in non-GUI bilds.

Address some --without-x byte-compilation warnings
331ddd803a72056d0f0c70e5a677e0d4a6300584
Basil L. Contovounesios
Fri Mar 26 17:35:34 2021 +0000
2021-03-27 02:18:35 -04:00
Stefan Monnier 129c33dddf * lisp/org-agenda.el: Use lexical-binding
- Removed the global (defvar date) and (defvar entry) so as not to
  conflict with function arguments of that name.  Instead I added such
  `defvar`s in the body of each of the functions where it
  seemed needed.
- I added some FIXMEs for some issues I found along the way.
- Added an `org-dlet` macro, just like I had done for `calendar-dlet`,
  but I also use `defvar` "manually" at some places, when splitting an
  existing `let` into a mix of `let`s and `dlet`s seemed too much trouble.
- Removed uses of `org-let and `org-let2` not only because I consider
  them offensive to my sense of aesthetics but also because they're
  basically incompatible with lexical scoping.
  I replaced them with uses of `cl-progv` which are a bit more verbose.
  Maybe we should define some `org-progv` macro on top of `cl-progv` to
  make the code less verbose, but I didn't do that because I like the
  fact that the current code makes uses of `eval` a bit more obvious
  (since these behave differently with lexical scoping than with
  lexical binding, it seemed worthwhile).
- Removed the use of `eval` in `org-store-agenda-views` which was only
  placed there in order to use a macro before it's defined (it would
  have been simpler/cleaner to just move that functions *after* the
  macro, but with the new code the problem doesn't occur any more anyway).
- Replaced a few `(lambda...) with actual closures.

Detailed changes follow:

(date, entry): Don't declare as being globally dynbound.
(org-agenda-format-date-aligned): Remove unused var `weekyear`.
(org-agenda-mode): `run-mode-hooks` is always available nowadays.
(org-agenda-undo): Remove unused var `last-undo-buffer`.
(org-agenda): Rename arg to `keys` and then dyn-bind it as `org-keys`.
Remove unused vars `buf` and `key`.
(org-agenda): Use `pcase` and `cl-progv` instead of `org-let`.
(org-let, org-let2): Mark as obsolete.
(org-agenda-run-series): Use `cl-progv` instead of `org-let` and `org-let2`.
(org-agenda-run-series): New function.
(org--batch-agenda): New function extracted from `org-batch-agenda`.
(org-batch-agenda): Use it.
(org--batch-agenda-csv): New function extracted from `org-batch-agenda-csv`.
(org-batch-agenda-csv): Use it.
(org--batch-store-agenda-views): New function, extracted from
`org-batch-store-agenda-views`.
(org-store-agenda-views, org-batch-store-agenda-views): Use it.
(org--batch-store-agenda-views): Use `cl-progv` instead of
`org-eval-in-environment`.
(org-agenda-write): Use `cl-progv` instead of `org-let`.
Use `with-current-buffer`.
(org-agenda-filter-any): Use `cl-some` instead of `eval`.
(org-agenda-list): Remove unused var `e`.
(org-search-view): η-reduce.
(crm-separator): Declare var.
(org-agenda-skip-if): Remove unused var `beg`.
(org-agenda-list-stuck-projects): Use a closure rather than `(lambda..).
(diary-modify-entry-list-string-function, diary-file-name-prefix)
(diary-display-function): Declare vars.
(org-diary): Declare `date` and `entry` as dynbound.
(org-agenda-get-day-entries): Use `org-dlet`.
(org-agenda-get-timestamps, org-agenda-get-progress)
(org-agenda-get-deadlines, org-agenda-get-scheduled, org-agenda-get-blocks):
Declare `date` as dynbound.
(org-agenda-get-sexps, org-class): Declare `date` and `entry` as dynbound.
(org-agenda-format-item): Declare the vars mentioned in
`org-compile-prefix-format` as dyn-bound.
Also binding `extra`, suggested by Kyle Meyer <kyle@kyleam.com>.
(org-compile-prefix-format): Remove unused var `e`.
Use `member` rather than or+equal.
(org-set-sorting-strategy): Minor simplification.
(org-entries-lessp): Use `org-dlet`.
(org-agenda-redo): Declare var `org-agenda-tag-filter-while-redo`.
(org-agenda-redo): Use `cl-progv` rather than `org-let`.
(org-agenda-filter): Remove unused var `rpl-fn`.
Use `org-pushnew-to-end` to replace `add-to-list` on lexical var.
(org-agenda-filter-by-tag): Remove unused var `n`.
(org-agenda-filter-apply): Use `org-dlet`.
(org-agenda-compute-starting-span): Remove unused var `dg`.
(org-agenda-forward-block): Remove unused var `pos`.
(org-archive-from-agenda): Declare var.
(org-agenda-refile): Remove unused var `pos`.
(org-agenda-headline-snapshot-before-repeat): Declare var.
(org-agenda-todo): Remove redundant use of `bound-and-true-p`.
(org-agenda-add-note): Remove unused var `hdmarker` and unused `arg`.
(org-agenda-change-all-lines): Remove unused var `pl`.
(org-agenda-priority): Remove unused var `marker`.
(org-agenda-set-effort): Remove unused var `newhead`.
(org-agenda-schedule): Remove unused var `type`.
(org-agenda-clock-cancel): Remove unused `arg`.
(org-agenda-execute-calendar-command): Use `org-dlet`.
(org-agenda-bulk-action): Use closures instead of `(lambda ...).
(org-agenda-show-the-flagging-note): Remove unused vars `heading` and
`newhead`.
(org-agenda-remove-flag): Avoid `setq`.

* testing/org-test.el (org--compile-when): New macro.
(org-test-jump): Use it so compilation doesn't fail or generate broken
code when `jump` is not available.

* testing/lisp/test-org-src.el:
* testing/lisp/test-org-attach.el:
* testing/lisp/test-org-agenda.el:
* testing/lisp/test-ob-java.el: Pass explicit filename to `require`
so as not to rely on ".../testing" being in `load-path` during compilation.

* lisp/org-num.el: Require` org`.

* lisp/org-macs.el (org-eval-in-environment): Declare obsolete.
(org-dlet, org-pushnew-to-end): New macros.

* doc/Makefile (org.texi, orgguide.texi, %_letter.tex): Simplify quoting.

* contrib/lisp/ob-sclang.el: Don't crash compilation when `sclang`
is not available.

* contrib/lisp/ob-clojure-literate.el: Don't crash compilation when `cider`
is not available.

* contrib/lisp/ob-arduino.el: Don't crash compilation when `arduino-mode`
is not available.

* .gitignore: Add files generated during `make packages/org`.
2021-03-09 22:56:33 -05:00
Stefan Monnier 63da3ccfb4 Backport commit 8d5dfafab from Emacs
While at it, I enabled lexical-binding in the affected files.

* lisp/org-agenda.el (org-let, org-let2): Move from org-macs and
use `declare`.

* lisp/org-macs.el (org-let, org-let2): Move these functions that are
inherently harmful to your karma to the only package that uses them.
(org-scroll): Use `pcase` to avoid `eval` and use more readable syntax
for those integers standing for events.

* lisp/org-element.el (org-element-map): Use `declare`.

Prefer `declare` over a `put` of `list-indent-function`.
8d5dfafab7dc40d4b74dc0b56d1b314fd8cac390
Stefan Monnier
Mon Feb 22 11:54:17 2021 -0500
2021-02-28 17:24:24 -05:00
Daniel Gröber aeb9f036ff org-macs: Allow specifying relative time in hours
* lisp/org-macs.el (org-matcher-time): Handle hour ("h") time stamp
modifier.
* doc/org-manual.org (The date/time prompt): Document hour modifier.

This adds support for date expressions such as +12h to
org-matcher-time. The regexp this function uses to parse such relative
expressions already includes the "h" character but doesn't actually
handle that case.

AFAICT org-mode commit ec921a2a68 ("Support hourly repeat cookies")
neglected to add support here.

TINYCHANGE
2021-01-24 22:16:45 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Marco Wahl 6ec2bb04e3 org-macs: Improve navigation in org-mks window
* lisp/org-macs.el (org--mks-read-key): New function parameter
navigation-keys to enable navigation keys. M-v has been added to the
navigation keys.
(org-mks): Supress spurious output in minibuffer.

This commit is a reaction to
https://orgmode.org/list/trinity-b89ea3b3-3d0d-4648-bcfc-0054a4a7fdaa-1607976126186@3c-app-mailcom-bs08/
2020-12-16 22:15:39 +01:00
Marco Wahl 01f57aa0df org-macs: Make org-mks window navigable when needed
* lisp/org-macs.el (org-mks): Activate keys for scrolling when the
whole text does not fit into the visible portion of the window.

https://orgmode.org/list/trinity-ac492dc8-9edb-46e6-871a-fdbb9eaa3116-1607796126691@3c-app-mailcom-bs06/
2020-12-14 12:56:42 +01:00
Kyle Meyer d7d714c7d5 Silence byte-compiler in Emacs repo
These show up in the Emacs repo (before and after the latest sync in
f22856a5c5), but for an unknown reason do not show up with `make
compile' or `make single' in the Org repo.

All of these functions are autoloaded.
2020-12-13 13:56:29 -05:00
Kyle Meyer 05fac0b765 org-macs.el: Silence byte-compiler under 'make single' 2020-07-15 23:37:21 -04:00
Nicolas Goaziou a3f01e183f Tweak drawer visibility after isearch
* lisp/org-macs.el (org-flag-region): Control visibility state after
an isearch.
* lisp/org.el (org-mode): Remove an unused variable.
2020-07-04 09:56:20 +02:00
Nicolas Goaziou e3745fac1e Remove `org-hide-drawer' text property leftovers
* lisp/org-macs.el (org-save-outline-visibility):
(org-invisible-p):
* lisp/org.el (org-show-set-visibility):
(org--forward-paragraph-once):
(org--backward-paragraph-once): Remove reference to `org-hide-drawer',
no longer used to hide drawers.
2020-07-03 21:50:46 +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 0fadd06b72 Fix "Symbol’s function definition is void: case"
* lisp/org-macs.el (org-scroll): Use `cl-case' instead of `case'.
2020-04-14 16:48:27 +02: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 2508dfa644 Factor out org-scroll and use it in ox.el, org-agenda/attach.el
* lisp/ox.el (org-export--dispatch-ui): Update message in the
header line to promote the use of C-v and M-v while SPC and
DEL are still allowed for backward compatibility reasons.

* lisp/org-macs.el (org-scroll): New function.

* lisp/org-attach.el (org-attach): Use `org-scroll'.

* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Allow C-v, M-v, C-n and C-p to scroll.

This change adverize C-v, M-v, C-n and C-p as the default keys
for scrolling the window, while SPC and DEL are still available
in the export dispatch window.

In particular, don't use SPC as a way to scroll the window in
the agenda commands dispatch window, as this key might be used
for a custom agenda command.
2020-02-11 01:04:28 +01:00
Bastien ceb8086301 Small refactoring
* lisp/org-macs.el (org-scroll): New function.

* lisp/ox.el (org-export--dispatch-action):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Use the new function.
2020-02-10 23:22:51 +01:00
Bastien f704904737 Merge branch 'maint' 2020-02-01 10:16:13 +01:00
No Wayman f33167a0e5 lisp/org-macs.el (org-mks): Respect case
* lisp/org-macs.el (org-mks): Respect case.

This fixes a bug regarding the selection of capture templates.

TINYCHANGE
2020-02-01 10:15:20 +01:00
Bastien 241750b3c2 Use `number-to-string' instead of `int-to-string'
* lisp/org.el (org-end-of-subtree): Use `number-to-string' instead
of `int-to-string'.

* lisp/org-table.el (org-table-edit-field)
(org-table-fix-formulas, org-table-analyze, orgtbl-make-binding)
(org-table-field-info): Ditto.

* lisp/org-macs.el (org-shorten-string): Ditto.

* lisp/org-agenda.el (org-get-time-of-day): Ditto.
2020-01-28 20:19:24 +01:00
Nicolas Goaziou 2931bef9e7 Move `org-find-(visible|invisible)' to org-macs.el
* lisp/org.el (org-find-visible):
(org-find-invisible): Move functions...
* lisp/org-macs.el: ... here.
2020-01-11 20:15:30 +01:00
Nicolas Goaziou b1822760f4 Fix exporting visible parts of a buffer
* lisp/org-element.el (org-element--parse-elements): Only ignore parts
due to folding, not because of fontification.
* lisp/org-macs.el (org-invisible-p): Add an optional argument.
* testing/lisp/test-org-element.el (test-org-element/parse-buffer-visible):
Add tests.
2020-01-11 20:13:39 +01:00
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Kyle Meyer d215c3a8c0 Merge branch 'maint' 2019-09-29 15:49:08 -04:00
Juanma Barranquero 97feee0469 Backport commit 114323226 from Emacs
* lisp/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/ob-J.el (org-babel-execute:J):
* lisp/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/ob-awk.el (org-babel-execute:awk):
* lisp/ob-core.el (org-babel-process-file-name):
* lisp/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/ob-forth.el (org-babel-execute:forth):
* lisp/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/ob-groovy.el (org-babel-execute:groovy):
* lisp/ob-io.el (org-babel-execute:io):
* lisp/ob-js.el (org-babel-execute:js):
* lisp/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/ob-lua.el (org-babel-prep-session:lua):
* lisp/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/ob-processing.el (org-babel-prep-session:processing):
* lisp/ob-python.el (org-babel-prep-session:python):
* lisp/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/ob-shen.el (org-babel-execute:shen):
* lisp/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org-indent.el (org-indent-set-line-properties):
* lisp/org-macs.el (org-get-limited-outline-regexp):
* lisp/org-mobile.el (org-mobile-files):
* lisp/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/ox-html.el (org-html-checkbox-type):
* lisp/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/ox-publish.el (org-publish-sitemap-default): Assorted
docfixes.

lisp/*.el: Fix typos and other trivial doc fixes
11432322650830fe9ae365f4113733a79226056d
Juanma Barranquero
Sat Sep 21 00:27:53 2019 +0200
2019-09-29 15:47:58 -04:00
Nicolas Goaziou 55d3dfaaf8 org-macs: Fix indentation for full-width characters
* lisp/org-macs.el (org-do-remove-indentation): Handle full-width characters.

When the least indented line in buffer begins from fullwidth character
like 'あ', a Japanese character, `org-do-remove-indentation' doesn't
remove indentation at all or removes improperly.

e.g. 'あ' with 2 spaces indent

-----[buffer begin]-----
  あ
-----[buffer   end]-----
`org-do-remove-indentation' does nothing in this buffer.

Expected result is:
-----[buffer begin]-----
あ
-----[buffer   end]-----

Reported-by: Yuichiro Hakozaki <sankaku.git@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-09/msg00075.html>
2019-09-16 18:42:59 +02:00
Nicolas Goaziou d64f7a2c9b Silence byte-compiler 2019-08-24 00:11:07 +02:00
Kyle Meyer c7c04b0447 Merge branch 'maint' 2019-08-18 17:44:08 -04:00
Paul Eggert 74bf99502d Backport commit 988e37fa0 from Emacs
* lisp/org-agenda.el (org-agenda-get-timestamps, org-agenda-get-progress)
(org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-clock.el (org-clock-get-sum-start):
* lisp/org.el (org-current-time, org-store-link)
(org-read-date, org-read-date-display)
(org-display-custom-time, org-timestamp-to-time)
Simplify use of encode-time.
* lisp/org-clock.el (org-clock-in, org-clock-update-time-maybe):
* lisp/org-colview.el (org-columns--age-to-minutes):
* lisp/org-macs.el (org-2ft):
* lisp/org.el (org-get-scheduled-time, org-get-deadline-time)
(org-add-planning-info, org-time-string-to-absolute)
(org-closest-date):
Use org-time-string-to-time instead of doing it by hand with
encode-time.
* lisp/org.el (org-read-date): Avoid extra trip through encode-time.

Simplify use of encode-time
988e37fa0f922b852715671d59a0e3f682373411
Paul Eggert
Sun Feb 10 23:54:35 2019 -0800

Note(km): org-current-time has been modified to use org-time-subtract
and org-time-less-p for backward compatibility.  Some changes from
988e37fa0 have been dropped to keep encode-time's call compatible with
older Emacsen.
2019-08-18 17:36:13 -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
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
Nicolas Goaziou fdb2eb6701 Preserve file local variables during some operations
* lisp/org-macs.el (org-preserve-local-variables): New macro.
* lisp/org-footnote.el (org-footnote--clear-footnote-section):
(org-footnote--goto-local-insertion-point):
(org-footnote-create-definition):
(org-footnote-delete):
(org-footnote-renumber-fn:N):
(org-footnote-sort):
(org-footnote-normalize):
* lisp/org.el (org-move-subtree-down):
(org-copy-subtree):
(org-sort-entries):
(org-refile): Use new macro.
* testing/lisp/test-org-footnote.el (test-org-footnote/normalize):
(test-org-footnote/delete):
(test-org-footnote/sort):
(test-org-footnote/normalize):
* testing/lisp/test-org.el (test-org/sort-entries): Add tests.

Operations affected include copying, killing, refiling, archiving and
moving subtrees.  It also affects sorting, creating and deleting
footnotes.
2017-12-18 16:01:41 +01:00
Nicolas Goaziou 6f89177ee6 Move `org-unlogged-message' to "org-macs.el"
* lisp/org.el (org-unlogged-message): Move function to...
* lisp/org-macs.el: ... here.
2017-12-10 23:37:59 +01:00
Nicolas Goaziou 04e0532ef5 Merge branch 'maint' 2017-11-15 18:59:05 +01:00
Nicolas Goaziou 696ec60341 org-macs: Fix typos in docstrings
* lisp/org-macs.el (org-split-string):
(org-string-width): Fix typo in docstring.
2017-11-15 18:58:44 +01:00
Nicolas Goaziou 966af419f9 Merge branch 'maint' 2017-11-15 18:14:44 +01:00
Nicolas Goaziou 40f73953f6 Fix `org-string-display'
* lisp/org-macs.el (org-string-display): Preserve original string's
  display property when computing displayed width.

* testing/lisp/test-org-macs.el (test-org/string-display): Add test.

Reported-by: Ruy Exel <ruyexel@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00160.html>
2017-11-15 18:13:34 +01:00
Nicolas Goaziou 87116700e6 Move some invisibility check functions to "org-macs.el"
* lisp/org.el (org-invisible-p):
(org-truely-invisible-p):
(org-invisible-p2): Move...

* lisp/org-macs.el: ... there.
2017-10-22 16:20:58 +02:00
Nicolas Goaziou fc551191a7 Silence byte-compiler 2017-10-22 15:41:02 +02:00
Nicolas Goaziou 59d21881b1 Revert "Move `org-key' and `org-defkey' into "org-macs.el""
This reverts commit 7f56a9920f.

`org-key' is specific to Org keybinding, therefore not generic enough
to fit in "org-macs.el". So is `org-defkey'.
2017-10-22 15:38:35 +02:00
Nicolas Goaziou 486331e323 Move some generic functions into "org-macs.el"
* lisp/org.el (org-do-wrap): Remove function.
(org-base-buffer):
(org-find-base-buffer-visiting):
(org-overlay-display):
(org-overlay-before-string):
(org-find-overlays):
(org-reverse-string):
(org-shorten-string):
(org-remove-tabs):
(org-wrap):
(org-remove-indentation):
(org-do-remove-indentation):
(org-uniquify-alist):
(org-combine-plists):
(org-skip-whitespace):
(org-in-regexp):
(org-point-in-group):
(org-get-at-eol):
(org-find-text-property-in-string):
(org-display-warning):
(org-eval):
* lisp/org-compat.el (org-add-props): Move ...

* lisp/org-macs.el: ... there.
(org--do-wrap): New function.
2017-10-22 15:34:26 +02:00
Nicolas Goaziou 7f56a9920f Move `org-key' and `org-defkey' into "org-macs.el"
* lisp/org.el (org-key):
(org-defkey): Move...

* lisp/org-macs.el: ... there.
2017-10-22 15:05:48 +02:00
Nicolas Goaziou 7ac8883394 Move `org-completing-read' into "org-macs.el"
* lisp/org-macs.el (org-completing-read): Moved here...
* lisp/org.el: ... from there.
2017-10-17 10:11:21 +02:00
Nicolas Goaziou 45a1918efe Move `org-xor' into "org-macs.el"
* lisp/org.el (org-xor): Move...
* lisp/org-macs.el: ... there.
2017-10-17 09:37:34 +02:00
Nicolas Goaziou 6e7d152699 Move `org-get-at-bol' into "org-macs.el"
* lisp/org.el (org-get-at-bol): Move...
* lisp/org-macs.el: ... here.
2017-09-18 21:26:18 +02:00
Nicolas Goaziou 32890ea5a5 Move `org-uniquify' into "org-macs.el"
* lisp/org.el (org-uniquify): Move function...
* lisp/org-macs.el: ... here.
2017-09-18 21:25:15 +02:00
Nicolas Goaziou 794dfaa6e0 org-macs: Re-order functions and macros 2017-09-18 21:24:23 +02:00
Nicolas Goaziou 442a2b430d Move `org-trim' in "org-macs.el"
* lisp/org.el (org-trim): Move function...
* lisp/org-macs.el: ... here.
2017-09-18 21:07:13 +02:00
Paul Eggert ff0dcf52a5 Backport commit bc511a64f from Emacs
Prefer HTTPS to FTP and HTTP in documentation
bc511a64f6da9ab51acc7c8865e80c4a4cb655c2
Paul Eggert
Wed Sep 13 15:54:37 2017 -0700
2017-09-17 00:28:38 -04:00
Nicolas Goaziou bd9f63a22a Merge branch 'maint' 2017-08-07 10:53:22 +02:00
Nicolas Goaziou e8fe579a17 Silence byte-compiler
* lisp/org-macs.el (org-unique-local-variables):
(org-get-local-variables):
(org-clone-local-variables): Moved from "org.el".
2017-08-07 10:52:37 +02:00
Nicolas Goaziou 90f606d9c2 org-macs: Fix `org-string-width' with `display' property
* lisp/org-macs.el (org-string-display): New function.
(org-string-width): Use new function.

* testing/lisp/test-org-macs.el: New file.
2017-07-28 12:15:47 +02:00
Nicolas Goaziou 9a60db0ec3 Move `org-string-width' to "org-macs.el"
* lisp/org.el (org-string-width): Move from here...
* lisp/org-macs.el (org-string-width): ... to here.
2017-07-27 15:23:31 +02:00
Nicolas Goaziou f776e65373 Move `org-split-string' to "org-macs.el"
* lisp/org.el (org-split-string): Move the function...
* lisp/org-macs.el (org-split-string): ... here.  Also clarify
  docstring with regards to `split-string'.
2017-07-27 13:39:52 +02:00
Kyle Meyer 9d9f5179e7 org-sort: Read compare-func in interactive calls
* lisp/org-macs.el (org-read-function): New function.
* lisp/org-table.el (org-table-sort-lines): Make WITH-CASE an optional
argument to match org-sort-entries and org-sort-list.
* lisp/org.el (org-sort-entries):
* lisp/org-table.el (org-table-sort-lines):
* lisp/org-list.el (org-sort-list): Read COMPARE-FUNC when called
interactively rather than being restricted to the default behavior of
sort-subr's PREDICATE parameter.  Only prompt for for GETKEY-FUNC and
COMPARE-FUNC during an interactive call, like org-table-sort-lines
already did for GETKEY-FUNC, but use an argument rather than relying
on the brittle called-interactively-p.

Suggested-by: Zhitao Gong <zhitaao.gong@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00040.html>
2017-05-18 14:46:33 -04:00