Skip to content

Font-lock escape characters in strings #378

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

Closed
bbatsov opened this issue Apr 30, 2016 · 6 comments
Closed

Font-lock escape characters in strings #378

bbatsov opened this issue Apr 30, 2016 · 6 comments

Comments

@bbatsov
Copy link
Member

bbatsov commented Apr 30, 2016

It'd be nice if we font-locked specially escape characters in strings - e.g. the \n in "this\nthat". This would make it easier to spot strings with embedded escape chars.

I've seen this in some major modes, so I'm guessing it shouldn't be very hard to do.

@Malabarba
Copy link
Member

Are backslashes ever used for anything other than escape characters? If not, this should be easy to do.

@Malabarba
Copy link
Member

Oh of course, they're also used for character literals. In that sense, I don't know how to font-lock one and not the other.

@bbatsov
Copy link
Member Author

bbatsov commented Apr 30, 2016

Oh of course, they're also used for character literals. In that sense, I don't know how to font-lock one and not the other.

I think it's ok to use the same font-locking in both scenarios. You can also see how it's done here https://github.com/lunaryorn/puppet-mode/blob/master/puppet-mode.el#L175

@Malabarba
Copy link
Member

Actually, looks like we already do that for regexp constructs. So it shouldn't be too hard to copy.

@Malabarba
Copy link
Member

Or do we actually prefer to also font-lock character literals differently?

@bbatsov
Copy link
Member Author

bbatsov commented Apr 30, 2016

I guess using the same technique will do just fine.

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