The feature that converts spaces in a selected region into underscores is useful when turning English text into method names. It had disappeared over time, and at first I thought it might not be essential, but I quickly realized it was extremely inconvenient without it, so I brought it back. Since many others are likely to find this equally inconvenient, I’ve made it the default.
If you don’t need this feature and prefer to convert each symbol individually, you can do so with the following setting.
(setq string-inflection-region-selection-behavior 'apply-to-each-symbols)
- #44 Create function for custom selection of string used for inflection
The conversion target range has been changed to vary depending on the mode since the previous version, but if you prefer the previous behavior that was independent of the mode, you can do the following:
(setq string-inflection-bounds-function 'string-inflection-bounds-of-mode-independent-chunk)
- #46 Refactoring of the general name
I’ve revised some method names that were previously a bit awkward. The main changes are:
- camelcase -> camel-case
- underscore -> snake-case
- cursor -> point
- word -> symbol
For now, I’ve kept the old methods using fset, but I might remove them in the future.
- Support non ascii #39
- Use (bounds-of-thing-at-point) for word detection #41
- Implement string-inflect-final-position #43
string-inflection-skip-backward-when-done is deprecated.
Use the string-inflection-final-position option instead.
However, leaving it as the default seems to be the easiest to use.
Previously, the rule for identifying words was shared across all modes. However, with this recent change, we have adapted the word boundaries to reflect the specifics of each mode. As a result, we have eliminated the need for handling edge cases, allowing for simpler and more flexible transformations.
On the other hand, there are now cases where the range considered as a “word” has become too broad, leading to situations where the intended transformation does not occur. For example, in org-mode, when you try to transform only the “foo_bar” portion of “path/to/foo_bar.txt” by placing the cursor over it, nothing happens. In such cases, you can achieve a partial transformation by selecting “foo_bar” as a range.
Fix #34 kebabing a region can insert an unexpected hyphen
add string-inflection-erase-chars-when-region variable
Changed behavior when selecting region.
before: Foo::Bar --> foo_bar after: Foo::Bar --> foo::bar
Include : in string-inflection-erase-chars-when-region if want to behave as before.
Merged PR #32 Use defcustom and Change Some Wording
Fix #31 Better Whitespace Handling When Converting a Region
Fix #30 string-inflection-underscore affects C++ method accessors
before: fooBar->method --> foo_bar_>method after: fooBar->method --> foo_bar->method
Merged PR #28 Make string-inflection-get-current-word work more sensibly when transient mark mode is off
Merged PR #26 Add `Capital_Underscore_Form`
add string-inflection-capital-underscore function
The behavior of string-inflection-all-cycle has changed
before: foo_bar => FOO_BAR => FooBar => fooBar => foo-bar => foo_bar after: foo_bar => FOO_BAR => FooBar => fooBar => foo-bar => Foo_Bar => foo_bar
Bugfix issue #25 When executing kebab-case etc., point advances to the next word, and the previous word can not be converted continuously
When it is simply camel-case, it means the name with the leading letters in lowercase.
The name with the initial capital letter is called the pascal-case.
| Before | After |
|---|---|
| FooBar | fooBar |
| Before | After |
|---|---|
| camel-case | pascal-case |
| lower-camel-case | camel-case |
(fset 'string-inflection-upper-camel-case-function 'string-inflection-pascal-case-function)
(fset 'string-inflection-lower-camel-case-function 'string-inflection-camel-case-function)
(fset 'string-inflection-upper-camel-case-p 'string-inflection-pascal-case-p)
(fset 'string-inflection-lower-camel-case-p 'string-inflection-camel-case-p)Originally we had defined functions of both camel-case and camelize names.
I deleted the function containing camelize to make it simple.