-
Notifications
You must be signed in to change notification settings - Fork 96
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
underscores are not treated as word seperators #53
Comments
Could you try running the tests? They contain this one, for instance: (defexamples s-lower-camel-case
(s-lower-camel-case "some words") => "someWords"
(s-lower-camel-case "dashed-words") => "dashedWords"
(s-lower-camel-case "under_scored_words") => "underScoredWords") |
The tests ran fine. So I poked around a bit & it seems to be scala-mode2's scala-mode that causes it to not work. With a bit of 'emacs -q' and '(require 's)', it seems that this is the case even in vanilla emacs + s.el |
Ah, you're right. It's based on the current syntax definition. That explains it. Not sure how to solve it, tho. |
Well I hacked it, and added '(replace-regexp-in-string "_" " " s)' instead of s in 's-split-words', but I imagine this might break in other places. Where does the syntax definition factor in to things? I can't tell from looking in s.el or in the docs for split-string |
It's in On Mon, Jan 27, 2014 at 3:31 PM, MrBones118 notifications@github.comwrote:
|
Very well. I'll close it as an upstream problem. Thanks for the help |
Sorry about the lack of a solution. |
I ran into the same problem, and found a possible solution, there is (make-syntax-table) and a (with-syntax-table) macro, s.el could have its own syntax table derived from Emacs main syntax table, and wrap its functions with the with-syntax-table macro, making the results independent of the current syntax table: https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-Table-Functions.html |
(s-lower-camel-case "foo_bar") produces "foo_bar".
Expected Output is fooBar
(s-upper-camel-case "foo_bar") produces "foo_Bar".
Expected output is FooBar
I believe the fix is to replace underscores with spaces in the function s-split-words.
The text was updated successfully, but these errors were encountered: