Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#+BEGIN_SRC elisp
(require 'string-inflection)

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

Expand Down Expand Up @@ -60,9 +60,9 @@

#+END_SRC

** How to use
** How to Use

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

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

Expand All @@ -80,11 +80,9 @@ In the case of =string-inflection-all-cycle=

: emacs_lisp => EMACS_LISP => EmacsLisp => emacsLisp => emacs-lisp => Emacs_Lisp => emacs_lisp

The =string-inflection-all-cycle=, conversion often. However,
conversion occurs even when there is no need to lower-camelcase.
Therefore so difficult to use, is not recommended
It is recommended that the major mode functions are used instead of =string-inflection-all-cycle=.

** Function that can be used alone
** Standalone Functions

#+BEGIN_SRC elisp
(string-inflection-underscore-function "EmacsLisp") ; => "emacs_lisp"
Expand Down
26 changes: 17 additions & 9 deletions string-inflection.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

;;; Commentary:

;; Main functions are three
;; There are three main functions:
;;
;; 1. For Ruby -> string-inflection-ruby-style-cycle (foo_bar => FOO_BAR => FooBar => foo_bar)
;; 2. For Python -> string-inflection-python-style-cycle (foo_bar => FOO_BAR => FooBar => foo_bar)
;; 3. For Java -> string-inflection-java-style-cycle (fooBar => FOO_BAR => FooBar => fooBar)
;; 4. For All -> string-inflection-all-cycle (foo_bar => FOO_BAR => FooBar => fooBar => foo-bar => Foo_Bar => foo_bar)
;;
;;
;; Setting Example 1
;; Example 1:
;;
;; (require 'string-inflection)
;; (global-unset-key (kbd "C-q"))
Expand All @@ -56,7 +56,7 @@
;; (string-inflection-ruby-style-cycle))))
;;
;;
;; Setting Example 2
;; Example 2:
;;
;; (require 'string-inflection)
;;
Expand All @@ -78,16 +78,24 @@
;; '(lambda ()
;; (local-set-key (kbd "C-c C-u") 'string-inflection-java-style-cycle)))
;;
;; You may also consider setting `string-inflection-skip-backward-when-done' to
;; `t' if you don't like `string-inflect' moving your point to the end of the
;; word
;; You can also set `string-inflection-skip-backward-when-done' to `t' if
;; you don't like `string-inflect' moving your point to the end of the word.

;;; Code:

(defconst string-inflection-word-chars "a-zA-Z0-9_-")
(defgroup string-inflection nil
"Change the casing of words."
:group 'convenience)

(defcustom string-inflection-skip-backward-when-done nil
"Controls the position of the cursor after an inflection.

(defvar string-inflection-skip-backward-when-done nil
"Whether point just move backward to the beginning of the word after inflecting.")
If nil remain at the end of the string after inflecting, else move backward to
the beginning."
:group 'string-inflection
:type 'boolean)

(defconst string-inflection-word-chars "a-zA-Z0-9_-")

;; --------------------------------------------------------------------------------

Expand Down