Skip to content

Commit 83d1402

Browse files
committed
Use defcustom and change README wording.
Use defcustom for string-inflection-skip-backward-when-done instead of defvar and create a custom group. Improve the wording in some parts of the README.
1 parent bf60b0c commit 83d1402

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

README.org

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#+BEGIN_SRC elisp
1414
(require 'string-inflection)
1515

16-
;; C-q C-u is the key bindings similar to Vz Editor.
16+
;; C-q C-u is similar to the keybinding used by Vz Editor.
1717
(global-unset-key (kbd "C-q"))
1818
(global-set-key (kbd "C-q C-u") 'my-string-inflection-cycle-auto)
1919

@@ -60,9 +60,9 @@
6060

6161
#+END_SRC
6262

63-
** How to use
63+
** How to Use
6464

65-
We will change as follows each type =C-q C-u= Place the cursor in the =emacs_lisp=.
65+
For each of the following, place the cursor at =emacs_lisp= and type =C-q C-u=, the results will be as follows:
6666

6767
In the case of =string-inflection-ruby-style-cycle=
6868

@@ -84,7 +84,7 @@ The =string-inflection-all-cycle=, conversion often. However,
8484
conversion occurs even when there is no need to lower-camelcase.
8585
Therefore so difficult to use, is not recommended
8686

87-
** Function that can be used alone
87+
** Standalone Functions
8888

8989
#+BEGIN_SRC elisp
9090
(string-inflection-underscore-function "EmacsLisp") ; => "emacs_lisp"

string-inflection.el

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
;;; Commentary:
2525

26-
;; Main functions are three
26+
;; There are three main functions:
2727
;;
2828
;; 1. For Ruby -> string-inflection-ruby-style-cycle (foo_bar => FOO_BAR => FooBar => foo_bar)
2929
;; 2. For Python -> string-inflection-python-style-cycle (foo_bar => FOO_BAR => FooBar => foo_bar)
3030
;; 3. For Java -> string-inflection-java-style-cycle (fooBar => FOO_BAR => FooBar => fooBar)
3131
;; 4. For All -> string-inflection-all-cycle (foo_bar => FOO_BAR => FooBar => fooBar => foo-bar => Foo_Bar => foo_bar)
3232
;;
3333
;;
34-
;; Setting Example 1
34+
;; Example 1:
3535
;;
3636
;; (require 'string-inflection)
3737
;; (global-unset-key (kbd "C-q"))
@@ -56,7 +56,7 @@
5656
;; (string-inflection-ruby-style-cycle))))
5757
;;
5858
;;
59-
;; Setting Example 2
59+
;; Example 2:
6060
;;
6161
;; (require 'string-inflection)
6262
;;
@@ -78,16 +78,24 @@
7878
;; '(lambda ()
7979
;; (local-set-key (kbd "C-c C-u") 'string-inflection-java-style-cycle)))
8080
;;
81-
;; You may also consider setting `string-inflection-skip-backward-when-done' to
82-
;; `t' if you don't like `string-inflect' moving your point to the end of the
83-
;; word
81+
;; You can also set `string-inflection-skip-backward-when-done' to `t' if
82+
;; you don't like `string-inflect' moving your point to the end of the word.
8483

8584
;;; Code:
8685

87-
(defconst string-inflection-word-chars "a-zA-Z0-9_-")
86+
(defgroup string-inflection nil
87+
"Change the casing of words."
88+
:group 'convenience)
89+
90+
(defcustom string-inflection-skip-backward-when-done nil
91+
"Controls the position of the cursor after an inflection.
8892
89-
(defvar string-inflection-skip-backward-when-done nil
90-
"Whether point just move backward to the beginning of the word after inflecting.")
93+
If nil remain at the end of the string after inflecting, else move backward to
94+
the beginning."
95+
:group 'string-inflection
96+
:type 'boolean)
97+
98+
(defconst string-inflection-word-chars "a-zA-Z0-9_-")
9199

92100
;; --------------------------------------------------------------------------------
93101

0 commit comments

Comments
 (0)