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

Unexpected indentation of top-level string-valued def #469

Closed
codeasone opened this issue Feb 6, 2018 · 2 comments
Closed

Unexpected indentation of top-level string-valued def #469

codeasone opened this issue Feb 6, 2018 · 2 comments

Comments

@codeasone
Copy link
Contributor

codeasone commented Feb 6, 2018

Perhaps related to #405

Expected behavior

(def foo "<character-entered>abc")

Actual behavior

  (def foo "<character-entered>abc")

Form indented as a docstring unnecessarily.

Steps to reproduce the problem

With the following var definition:

(def foo "|abc")

And cursor at |

Entering any character causes unhelpful indentation:

  (def foo "Mabc")

It appears to be because clojure-mode determines that the form is a docstring

Unfortunately I don't have the time to debug the treatment of syntax-ppss, which I suspect is at the root of the issue.

Environment & Version information

GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-01-26
clojure-mode (version 5.7.0-snapshot)
Version: 20180202.922
Commit: 5cf0fd9360dc5a9a95464601319062673d213807

The issues does not present with current melpa-stable release of clojure-mode:

Version: 5.6.1
Commit: fdbdfb91e0a5731bf9a739b70c5f217c5d12ae6d
@bbatsov
Copy link
Member

bbatsov commented Mar 12, 2018

Yeah, that's basically the same bug. I have a good idea where the problematic code is, but I don't have time to debug it myself either. Adding a real docstring should work as a workaround I guess.

It's basically a combination of

https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L906

and

https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L1035

We mark the docstring positional statically and we probably need to make this more dynamic homehow (e.g. it's number 2 only if the form has 3 arguments).

@cichli
Copy link
Member

cichli commented Feb 27, 2019

Thanks for the report.

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

3 participants