Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote a subset of the files + emacs integration #1192

Merged
6 commits merged into from Aug 31, 2018
Merged

Promote a subset of the files + emacs integration #1192

6 commits merged into from Aug 31, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 29, 2018

This PR modifies dune promote so that we can pass a list of files to promote + adds an emacs function dune-promote that allows to promote the current buffer.

When dune-promote is bound to a key combination such as C-x C-a, this provide a very nice workflow to work with any kind of expectation test:

  • edit the buffer
  • C-c C-c to run the tests
  • C-x C-a to replace the current buffer with the correction

I also tried to add a function dune-runtest-and-promote that run the tests in the current directory and promote the correction, however my emacs knowledge is quite limited and I can't get it to work.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost ghost requested review from emillon and rgrinberg as code owners August 29, 2018 17:45
@bobot
Copy link
Collaborator

bobot commented Aug 30, 2018

Integration of this .el using user-setup would be awesome (and for the dune linter).

(defgroup dune nil
"Integration with the dune build system."
:tag "Dune build system."
:version "1.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we subst that if this is tracked within the dune repository?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version is for melpa, the emacs package manager. It needs to be in plain text in the git repository (melpa will fetch it directly from github). It also needs to be independent of the main dune version, otherwise this will cause a lot of spurious upgrades for emacs users.


;; Copyright 2018 Jane Street Group, LLC <opensource@janestreet.com>
;; URL: https://github.com/ocaml/dune
;; Version: 1.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark about subst.

CHANGES.md Outdated
@@ -31,6 +31,8 @@ next
`findlib.dynload`, automatically record linked in libraries and
findlib predicates (#1172, @bobot)

- Add support for promoting a selected list of files (#..., @diml)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you forget, there's a missing PR number :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, fixed


;;;###autoload
(defun dune-runtest-and-promote ()
"Runt tests in the current directory and promote the current buffer."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "runt"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@emillon
Copy link
Collaborator

emillon commented Aug 30, 2018

I have some vim snippets that do similar things, I can integrate these in the repo in a followup PR.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost
Copy link
Author

ghost commented Aug 31, 2018

Integration of this .el using user-setup would be awesome (and for the dune linter).

Indeed. I don't know how user-setup works though. What's the dune linter BTW?

@ghost
Copy link
Author

ghost commented Aug 31, 2018

@emillon please do :)

@ghost ghost merged commit 5cad714 into ocaml:master Aug 31, 2018
@ghost
Copy link
Author

ghost commented Aug 31, 2018

BTW, @Chris00, it might make sense to move the emacs mode for editing dune files here

@bobot
Copy link
Collaborator

bobot commented Aug 31, 2018

What's the dune linter BTW?

I should have said dune formatter dune fmt #1130 .

@ghost
Copy link
Author

ghost commented Aug 31, 2018

Ah, indeed. It'd be nice to integrate this with emacs in the same way that ocamlformat is integrated with emacs

@rgrinberg
Copy link
Member

BTW, @Chris00, it might make sense to move the emacs mode for editing dune files here

Agreed. We could then think about generating some .el files and checking them in.

@Chris00
Copy link
Member

Chris00 commented Aug 31, 2018

Why not. How do you want to proceed? (I'm in the process of updating it but this happens slowly as many other things are requiring my attention.)

@emillon
Copy link
Collaborator

emillon commented Aug 31, 2018

for dune fmt, I'm not sure how it works with emacs, but with vim it seems that this sort of task is delegated to an external plugin, in that case neoformat.

@ghost
Copy link
Author

ghost commented Aug 31, 2018

@Chris00, I was thinking we could move the code of tuareg-dune-mode into dune.el, and it would become dune-mode.

@ghost
Copy link
Author

ghost commented Aug 31, 2018

@emillon, for emacs I suppose we can look at what ocamlformat does: https://github.com/ocaml-ppx/ocamlformat/blob/master/emacs/ocamlformat.el

(defcustom dune-command "dune"
"The dune command."
:type 'string
:group 'dune)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the defcustoms following a defgroup don't have to specify the :group because the group is inferred

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't know that. Could you submit a PR to remove them?

@Khady
Copy link
Contributor

Khady commented Sep 3, 2018 via email

rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Sep 14, 2018
CHANGES:

- Ignore stderr output when trying to find out the number of jobs
  available (ocaml/dune#1118, fix ocaml/dune#1116, @diml)

- Fix error message when the source directory of `copy_files` does not exist.
  (ocaml/dune#1120, fix ocaml/dune#1099, @emillon)

- Highlight error locations in error messages (ocaml/dune#1121, @emillon)

- Display actual stanza when package is ambiguous (ocaml/dune#1126, fix ocaml/dune#1123, @emillon)

- Add `dune unstable-fmt` to format `dune` files. The interface and syntax are
  still subject to change, so use with caution. (ocaml/dune#1130, fix ocaml/dune#940, @emillon)

- Improve error message for `dune utop` without a library name (ocaml/dune#1154, fix
  ocaml/dune#1149, @emillon)

- Fix parsing `ocamllex` stanza in jbuild files (ocaml/dune#1150, @rgrinberg)

- Highlight multi-line errors (ocaml/dune#1131, @anuragsoni)

- Do no try to generate shared libraries when this is not supported by
  the OS (ocaml/dune#1165, fix ocaml/dune#1051, @diml)

- Fix `Flags.write_{sexp,lines}` in configurator by avoiding the use of
  `Stdune.Path` (ocaml/dune#1175, fix ocaml/dune#1161, @rgrinberg)

- Add support for `findlib.dynload`: when linking an executable using
  `findlib.dynload`, automatically record linked in libraries and
  findlib predicates (ocaml/dune#1172, @bobot)

- Add support for promoting a selected list of files (ocaml/dune#1192, @diml)

- Add an emacs mode providing helpers to promote correction files
  (ocaml/dune#1192, @diml)

- Improve message suggesting to remove parentheses (ocaml/dune#1196, fix ocaml/dune#1173, @emillon)

- Add `(wrapped (transition "..message.."))` as an option that will generate
  wrapped modules but keep unwrapped modules with a deprecation message to
  preserve compatibility. (ocaml/dune#1188, fix ocaml/dune#985, @rgrinberg)

- Fix the flags passed to the ppx rewriter when using `staged_pps` (ocaml/dune#1218, @diml)

- Add `(env var)` to add a dependency to an environment variable.
  (ocaml/dune#1186, @emillon)

- Add a simple version of a polling mode: `dune build -w` keeps
  running and restarts the build when something change on the
  filesystem (ocaml/dune#1140, @kodek16)

- Cleanup the way we detect the library search path. We no longer call
  `opam config var lib` in the default build context (ocaml/dune#1226, @diml)

- Make test stanzas honor the -p flag. (ocaml/dune#1236, fix ocaml/dune#1231, @emillon)

- Test stanzas take an optional (action) field to customize how they run (ocaml/dune#1248,
  ocaml/dune#1195, @emillon)

- Add support for private modules via the `private_modules` field (ocaml/dune#1241, fix
  ocaml/dune#427, @rgrinberg)

- Add support for passing arguments to the OCaml compiler via a
  response file when the list of arguments is too long (ocaml/dune#1256, @diml)

- Do not print diffs by default when running inside dune (ocaml/dune#1260, @diml)

- Interpret `$ dune build dir` as building the default alias in `dir`. (ocaml/dune#1259,
  @rgrinberg)

- Make the `dynlink` library available without findlib installed (ocaml/dune#1270, fix
  ocaml/dune#1264, @rgrinberg)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants