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

non-strict mode being very strict with matching unmatched parens #665

Closed
fommil opened this issue Oct 21, 2016 · 7 comments
Closed

non-strict mode being very strict with matching unmatched parens #665

fommil opened this issue Oct 21, 2016 · 7 comments

Comments

@fommil
Copy link
Contributor

fommil commented Oct 21, 2016

since a recent melpa upgrade, I've been getting errors in non-strict scala-mode. An example file looks like this (point is at ^^^, which is just an indicator) and then type " to close off "bootstrap

ensimeScalaCompilerJarModuleIDs := {
  val v = (scalaVersion in LocalProject("bootstrap^^^)).value
  Seq(
    scalaOrganization.value % "scala-compiler" % v,
    scalaOrganization.value % "scala-library" % v,
    scalaOrganization.value % "scala-reflect" % v,
    scalaOrganization.value % "scalap" % v
  ).map(_ % org.ensime.EnsimePlugin.EnsimeInternal.name intransitive ())
}

but I get this stacktrace instead 😢

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  sp--escape-region(("\"") 138 139)
  sp-escape-open-delimiter()
  sp--post-self-insert-hook-handler()
  self-insert-command(1)
  funcall-interactively(self-insert-command 1)
  call-interactively(self-insert-command nil nil)
  command-execute(self-insert-command)

Anything obvious broken here or should I go investigate when it bothers me enough?

@Fuco1 Fuco1 added this to the 1.10 milestone Nov 5, 2016
@Fuco1
Copy link
Owner

Fuco1 commented Nov 13, 2016

I can't repro this. Would you mind testing this on the latest master?

The result I get in both strict and non-strict mode is an insertion of \"

@fommil
Copy link
Contributor Author

fommil commented Nov 13, 2016

I can confirm I still get it with the latest stable release, I'll try melpa unstable later today.

@fommil
Copy link
Contributor Author

fommil commented Nov 13, 2016

yes, confirming I still get it on melpa unstable.

Hmm, must be something in my config then.

@Fuco1
Copy link
Owner

Fuco1 commented Nov 13, 2016

What version of scala-mode do you have? Apparently mine is ancient (scala-mode-20141205.1251). I'll upgrade that and try again.

@fommil
Copy link
Contributor Author

fommil commented Nov 13, 2016

I always run the most recent version of scala-mode. My config is public https://github.com/fommil/dotfiles/blob/master/.emacs.d/init.el#L611-L746

@Fuco1
Copy link
Owner

Fuco1 commented Nov 13, 2016

After upgrading I get the behaviour described in OP.

The quote character before bootstrap has "punctuation" syntax, which is something quite odd and I think might be the issue. In the old version it had string syntax which is why it worked.

Oh how much I hate font-lock syntax hacks :)

@Fuco1 Fuco1 removed the unconfirmed label Nov 13, 2016
@Fuco1 Fuco1 closed this as completed in dc21900 Nov 13, 2016
@fommil
Copy link
Contributor Author

fommil commented Nov 13, 2016

thanks for the workaround! I think our scala-mode regexes really need an overhaul. They can also be quite slow sometimes. Somebody wrote some good ones for Sublime but I just haven't had the motivation to look into it.

jojojames pushed a commit to jojojames/smartparens that referenced this issue Mar 31, 2017
In scala-mode " is punctuation until it is matched with a closing
quote... therefore we have to treat the state before as *not* inside
string and not try to escape the closing quote (which only just now
makes it into a string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants