Commit Graph

18 Commits

Author SHA1 Message Date
Stefan Monnier 1a5e3f931c
testing: Make all files use `lexical-binding`
Mainly, add the corresponding cookie, but also add various `require`s
so that the compiler knows which vars should be trated as dynbound.
This does not fix all the warnings, but does try to eliminate
all those about "unused" variables.  For the variables truly unused,
the patch usually adds an underscore to their name to silence the warning.

Some of the fixes affect files which already used `lexical-binding`.
Not sure why the test worked before: maybe because the tests were run
without compiling them first (which could cause some of the
missing `require`d packages to be autoloaded before we got to the
problematic code, thus hiding the problem)?

I found some suspicious code, for which I added FIXMEs.

There are also a few changes to the main files.

* lisp/org-protocol.el (org-protocol-check-filename-for-protocol):
Don't call `server-edit` if it's not yet defined.  [ Needed to get
the tests to pass. ]

* lisp/ob-core.el (org-babel-temporary-directory)
(org-babel-temporary-stable-directory): Always define (and use nil
if we don't want to create a directory for it).  Simplify the code based
on the fact that (defvar V E) only evaluates E if V is not yet `boundp`.
(org-babel-temp-file, org-babel-temp-stable-file)
(org-babel-remove-temporary-directory)
(org-babel-remove-temporary-stable-directory): Adjust accordingly.

* lisp/org.el (org-log-beginning): Add FIXME.

* testing/org-test.el: Require `org` and `org-id`.
(org-id-locations-file): Don't `defconst` it.
(org-test-at-id, org-test-in-example-file, org-test-at-marker)
(org-test-with-temp-text, org-test-with-temp-text-in-file): Move edebug
specs into `declare` (and simplify them).
(org-test-with-tramp-remote-dir--worker): Declare dynbound tramp vars.
(org--compile-when): Fix quoting of `exp`.
(org-test-load): Tweak regexps.

* testing/org-batch-test-init.el: Tweak regexp, remove dead code and
add a FIXME about it.

* testing/lisp/test-ox.el: Require `ox` instead of
erroring out if it's not already loaded.  Also require `org-inlinetask`.
(org-test-with-parsed-data): Silence warnings when `info` is not used.
(test-org-export/bind-keyword): Add FIXME.

* testing/lisp/test-ox-publish.el: Require `org-test` and `ox-publish`.
(test-org-publish/resolve-external-link): Expose lambdas to
the compiler.  Remove unused var `ids`.
(test-org-publish/get-project-from-filename): Remove unused var `file`.

* testing/lisp/test-org.el: Require `org-macs`, `org`,
`org-inlinetask`, `org-refile`, and `org-agenda`.
(test-org/org-read-date): Declare `org-time-was-given` as dynbound.
(test-org/set-regexps-and-options): Add FIXME.

* testing/lisp/test-org-timer.el: Require `org-timer`.

* testing/lisp/test-org-table.el: Require `ox`.

* testing/lisp/test-org-protocol.el: Require `org-protocol` instead of
erroring out if it's not already loaded.  Also require `capture`, and
add missing `provide` statement.

* testing/lisp/test-org-pcomplete.el: Require `org`.

* testing/lisp/test-org-list.el: Require `org-list` and `org`.

* testing/lisp/test-org-lint.el: Require `org-footnote` and `org-lint`.

* testing/lisp/test-org-footnote.el: Require `org-footnote`.

* testing/lisp/test-org-element.el: Require `org-element` instead of
erroring out if it's not already loaded.  Also require `org` and
`org-inlinetask`.

* testing/lisp/test-org-duration.el: Require `org-duration`.

* testing/lisp/test-org-datetree.el: Require `org-datetree`.

* testing/lisp/test-org-colview.el: Require `org-colview`,
`org-duration`, and `org-inlinetask`.

* testing/lisp/test-org-clock.el: Require `org-duration` and `org-clock`.

* testing/lisp/test-org-archive.el: Require `org-archive`.

* testing/lisp/test-org-agenda.el
(test-org-agenda/bulk-custom-arg-func): Add FIXME.

* testing/lisp/test-ol.el: Require `ol` and `org-id`.
(test-org-link/store-link): Declare `org-store-link-props` and add FIXME.

* testing/lisp/test-oc.el (test-org-cite/export-capability): Add FIXME.

* testing/lisp/test-ob.el: Require `ob-core`, `org-src`, `ob-ref`,
and `org-table`.
(test-ob/eval-header-argument): Rename `foo` to `test-ob--foo` and
declare it as dynbound.
(test-ob/blocks-with-spaces, test-ob/specific-colnames): Add FIXME.
(test-ob/noweb-expansions-in-cache):
Declare `noweb-expansions-in-cache-var` as dynbound.

* testing/lisp/test-ob-tangle.el: Require `org` and `ob-tangle`.

* testing/lisp/test-ob-shell.el:
* testing/lisp/test-ob-python.el: Require `ob-core`.

* testing/lisp/test-ob-lob.el: Require `ob-lob`.
(temporary-value-for-test): Declare as dynbound.

* testing/lisp/test-ob-plantuml.el: Require `ob-plantuml` instead of
erroring out if it's not already loaded.
* testing/lisp/test-ob-lilypond.el: Require `ob-lilypond` instead of
erroring out if it's not already loaded.  Use `with-current-buffer`.

* testing/lisp/test-ob-julia.el: Require `ob-core`.

* testing/lisp/test-ob-java.el (org-babel-temporary-directory):
Remove dead code now that `org-babel-temporary-directory` is always bound.

* testing/lisp/test-ob-exp.el: Require `ob-exp`, `org-src`, and `org-test`.
(ob-exp/evaluate-all-executables-in-order):
Declare `*evaluation-collector*` as dynbound.

* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/dynamic-lexical-edit)
(ob-emacs-lisp/dynamic-lexical-execute):
Rename dynbound var to `ob-emacs--x` and declare it as such.

* testing/lisp/test-ob-R.el: Require `ob-core`.
(ess-ask-for-ess-directory, ess-history-file): Declare vars.
2022-09-15 19:17:19 +08:00
Stefan Kangas 41e19f1d7a
; Fix typos 2022-07-01 17:42:52 +08: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
Stefan Kangas 8cc992f7b2 Prefer HTTPS to HTTP for links to gnu.org 2021-03-21 14:29:13 -04:00
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou 2a7a4a65ad Merge branch 'maint' 2018-02-13 14:10:28 +01:00
Nicolas Goaziou 7c21dfc771 ox-publish: Follow symlink directories
* lisp/org-compat.el (directory-files-recursively): Remove
  compatibility function, no longer needed.
* lisp/ox-publish.el (org-publish--expand-file-name):
(org-publish-org-to):
(org-publish-collect-index):
(org-publish--store-crossrefs):
(org-publish-resolve-external-link): Preserve symlinks in file name.
(org-publish-get-base-files): Follow symlink directories.
(org-publish-get-project-from-filename): Preserve symlinks in file
name.  Do not use `file-in-directory-p', which ignores symlinks.

Reported-by: Michel Damiens <michel.damiens@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00186.html>
2018-02-13 14:06:56 +01:00
Nicolas Goaziou b0ab7008df Merge branch 'maint' 2017-11-26 10:47:55 +01:00
Nicolas Goaziou 6aac798f25 Fix publishing links to absolute file names belonging to project
* lisp/ox-publish.el (org-publish-file-relative-name): New function.
* lisp/ox-html.el (org-html-link): Use new function.

* testing/lisp/test-ox-publish.el (test-org-publish/file-relative-name):
  New test.
2017-11-26 10:46:53 +01:00
Nicolas Goaziou ee3a9e9a77 Fix failing test
* testing/lisp/test-ox-publish.el (test-org-publish/resolve-external-link):
  Rewrite test to prevent race condition which could affect results.
* testing/examples/pub/b.org: Add missing keyword.
2017-11-03 22:15:41 +01:00
Nicolas Goaziou 3056abe781 Merge branch 'maint' 2017-09-24 10:58:43 +02:00
Nicolas Goaziou d40deb6967 ox-publish: Fix :base-extension any with :recursive t
* lisp/ox-publish.el (org-publish-get-base-files): Ensure MATCH regexp
  is always a string since `directory-files-recursively' requires it.
* testing/lisp/test-ox-publish.el (test-org-publish/get-project-from-filename):
  Add test.

Suggested-by: Jens Lechtenboerger <lechten@wi.uni-muenster.de>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00528.html>
2017-09-24 10:57:11 +02:00
Nicolas Goaziou 007bbddbcc ox-html: Prevent spurious target below headlines
* lisp/ox-html.el (org-html-headline):
(org-html-link): Do not insert an additional target.

* lisp/ox-publish.el (org-publish-resolve-external-link): Add an
  optional argument.

* lisp/ox.el (org-export-get-reference): Improve docstring.

* testing/examples/pub/a.org:
* testing/examples/pub/b.org: New files.
* testing/lisp/test-ox-publish.el (test-org-publish/resolve-external-link):
  New test.
2017-09-10 00:23:42 +02:00
Nicolas Goaziou 6a4d3988b9 Merge branch 'maint' 2017-05-05 19:52:55 +02:00
Nicolas Goaziou 8e0295a318 ox-publish: Add test
* testing/lisp/test-ox-publish.el (test-org-publish/get-project-from-filename):
  New test.
2016-12-31 12:29:32 +01:00
Nicolas Goaziou ccf2b988af ox-publish: Fix :base-extension (part 2)
* lisp/ox-publish.el (org-publish-get-base-files): Make sure to remove
  directories.
* testing/examples/pub/file.txt:
* testing/examples/pub/noextension: New files.
* testing/lisp/test-ox-publish.el (test-org-publish/base-extension):
  New test.
2016-12-29 21:48:02 +01:00
Nicolas Goaziou 83827952db ox-publish: Provide relative file in sitemap generation
* doc/org.texi (Sitemap):
* lisp/ox-publish.el (org-publish-project-alist): Document change.

(org-publish-property):
(org-publish--expand-file-name): New functions

(org-publish-get-base-files):
(org-publish-file):
(org-publish-projects):
(org-publish--sitemap-files-to-lisp):
(org-publish-sitemap):
(org-publish-find-property):
(org-publish-find-title):
(org-publish-find-date):
(org-publish-sitemap-default-entry):
(org-publish-sitemap-default): Use new functions.

* testing/lisp/test-ox-publish.el (test-org-publish/sitemap): Update
  test.
2016-12-19 17:36:19 +01:00
Nicolas Goaziou baf2e0e5ee ox-publish: Add tests
* testing/examples/pub/a.org:
* testing/examples/pub/b.org:
* testing/examples/pub/sub/c.org:
* testing/lisp/test-ox-publish.el: New files.
2016-12-19 12:19:59 +01:00