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

Rules not properly indented after copy/pasting #8

Closed
endrebak opened this issue Apr 15, 2016 · 4 comments
Closed

Rules not properly indented after copy/pasting #8

endrebak opened this issue Apr 15, 2016 · 4 comments

Comments

@endrebak
Copy link

When I copy/paste a rule it looks like this afterwards:

  rule create_design_matrix:
  output:
  outfile = "tmpdir/run_csaw_{input_use}/design_matrix.csv"
  run:
  time = pd.Series(list(range(0, 25, 3)) * 2)
  values = time * 2 * np.pi / 17
  sine = np.sin(values)
  cosine = np.cos(values)

        design = pd.concat([time, sine, cosine], axis=1)
        design.columns = "Time Sine Cosine".split()
        design.to_csv(output.outfile, index=False, sep=" ")

Normally, I'd just mark the region and press = (evil-indent) to get the proper indentation, but that isn't working either. I'll prolly look into it myself eventually, but would love input on what you think is happening/best ways to fix.

kyleam added a commit that referenced this issue Apr 15, 2016
Don't use python-indent-region for indent-region-function.  At first
glance, setting indent-region-function to nil (that is, running
indent-according-to-mode on each line) seems to indent rule blocks fine,
though it will probably fail on more complex "run" values.

However, this does mean that python-indent-region is no longer used when
indent-region is called with a region that doesn't include a rule block,
so it's probably worth adding a snakemake-indent-region function that
calls python-indent-region in this case.

Re: #8
@kyleam
Copy link
Owner

kyleam commented Apr 15, 2016 via email

@endrebak
Copy link
Author

endrebak commented Apr 15, 2016

I only evaled the two new files, did not install them in the .emacs.d/elpa/ folder, but this seems to have fixed my issues. Thanks!

@endrebak
Copy link
Author

I am experiencing the same problem with yasnippets.

This rule:

# -*- mode: snippet -*-
# name: rule
# key: rl
# --
rule $1:
    input:
        infile = ""
    output:
        outfile = ""
    $0

expands into this:

rule :
input:
infile = ""
output:
outfile = ""

@endrebak endrebak reopened this Apr 29, 2016
@kyleam
Copy link
Owner

kyleam commented May 3, 2016

This should work as of 5350b3b (Allow spaces after rule/subworkflow
name, 2016-05-03). You can also set yas-indent-line to fixed
force the snippet to be indented as is.

@kyleam kyleam closed this as completed May 3, 2016
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

No branches or pull requests

2 participants