Skip to content

Fix incorrect indentation of namespaced map - #513

Closed
poernahi wants to merge 3 commits into
clojure-emacs:masterfrom
poernahi:namespaced-map
Closed

Fix incorrect indentation of namespaced map#513
poernahi wants to merge 3 commits into
clojure-emacs:masterfrom
poernahi:namespaced-map

Conversation

@poernahi

Copy link
Copy Markdown

Fix Incorrect Indentation of Namespaced Map Literal

Please refer to #511 for bug description.

  • The commits are consistent with our [contribution guidelines].
  • You've added tests (if possible) to cover your change(s). Bugfix, indentation, and font-lock tests are extremely important!
  • You've run M-x checkdoc and fixed any warnings in the code you've written.
  • You've updated the changelog (if adding/changing user-visible functionality).
  • You've updated the readme (if adding/changing user-visible functionality).

Comment thread clojure-mode.el
(comment-normalize-vars)
(comment-forward (point-max))
(looking-at-p "\\^\\|#[[:alpha:]]"))
(looking-at-p "\\^\\|#:?:?[[:alpha:]]"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's this supposed to match?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(it seems to me like 0-2 :, but I think this can be expressed better with a different qualifier). I also don't see tests with ::.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At least not in the first test.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What's this supposed to match?

^metadata or
#reader-macro or
#:ns-unqualified-reader-macro or
#::namespaced-qualified-reader-macro

Yes, it can be expressed as #:{0,2}

The test case uses #::ns, but I did not write cases for each permutation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Btw, there's a small problem with the regexp now - something like ^:: will also match. Probably it should be tightened.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And I'd really use :\{0,2\} instead of :?:?.

(clojure-mode)
(clojure-backward-logical-sexp 1)
(should (looking-at-p "#:name/space{:k v}"))
(insert " #::ns {:k v}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is there are space here between the namespace and the map?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Both #:ns {:k v} and #:ns{:k v} are valid syntax and has the same meaning. Also, I have not seen any guideline that prefers one style over the other.

Reference:
https://dev.clojure.org/jira/browse/CLJ-1910?focusedCommentId=42834&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-42834

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it. I thought usually it was the form without the space.

@bbatsov

bbatsov commented Mar 11, 2019

Copy link
Copy Markdown
Member

Apart from the failing build (which might be some random Travis failure looking at it), this change needs a changelog entry.

@poernahi

Copy link
Copy Markdown
Author

Updated changelog.

The CI failure looks like build environment related. I'm not too familiar with it though..

@bbatsov

bbatsov commented Mar 11, 2019

Copy link
Copy Markdown
Member

You need to rebase on top of master for the new CircleCI to kick in. On your current branch its config is missing.

@poernahi

Copy link
Copy Markdown
Author

Done, checks passed.


(check-indentation cond-indentation-with-namespaced-map
"
(cond-> #:a{:b 1}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't forget to add here a test with ::.

@bbatsov

bbatsov commented Mar 12, 2019

Copy link
Copy Markdown
Member

Great! Please, address the small feedback I've added and we're good to go.

@bbatsov

bbatsov commented Mar 20, 2019

Copy link
Copy Markdown
Member

@poernahi ping :-)

@bbatsov

bbatsov commented Apr 24, 2019

Copy link
Copy Markdown
Member

@poernahi Ping 2 :-)

@bbatsov

bbatsov commented Jul 9, 2019

Copy link
Copy Markdown
Member

@anthonygalea Can I ask you to pick this one up and just update the tests for buttercup?

@anthonygalea anthonygalea mentioned this pull request Jul 9, 2019
@bbatsov

bbatsov commented Jul 9, 2019

Copy link
Copy Markdown
Member

Superseded by #533.

@bbatsov bbatsov closed this Jul 9, 2019
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.

2 participants