* Swapping Substrings
@ 2020-10-31 10:21 jai-bholeki via Users list for the GNU Emacs text editor
2020-10-31 11:50 ` Philipp Stephani
2020-10-31 11:57 ` Philipp Stephani
0 siblings, 2 replies; 4+ messages in thread
From: jai-bholeki via Users list for the GNU Emacs text editor @ 2020-10-31 10:21 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
I need to swap two sub-strings in a word. The idea is that with the cursor
within a string, the two sub-strings get swapped.
Examples:
For the word ParSkip with point on the letter S, one gets SkipPar
For the word Keybinding with point on the letter b, one gets bindingKey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Swapping Substrings
2020-10-31 10:21 Swapping Substrings jai-bholeki via Users list for the GNU Emacs text editor
@ 2020-10-31 11:50 ` Philipp Stephani
2020-10-31 11:50 ` Philipp Stephani
2020-10-31 11:57 ` Philipp Stephani
1 sibling, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2020-10-31 11:50 UTC (permalink / raw)
To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org
Am Sa., 31. Okt. 2020 um 11:22 Uhr schrieb jai-bholeki via Users list
for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
>
> I need to swap two sub-strings in a word. The idea is that with the cursor
> within a string, the two sub-strings get swapped.
>
> Examples:
>
> For the word ParSkip with point on the letter S, one gets SkipPar
>
> For the word Keybinding with point on the letter b, one gets bindingKey
You can enable subword-mode (M-x subword-mode RET) and then swap the
words with M-t (transpose-words).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Swapping Substrings
2020-10-31 11:50 ` Philipp Stephani
@ 2020-10-31 11:50 ` Philipp Stephani
0 siblings, 0 replies; 4+ messages in thread
From: Philipp Stephani @ 2020-10-31 11:50 UTC (permalink / raw)
To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org
Am Sa., 31. Okt. 2020 um 12:50 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
> Am Sa., 31. Okt. 2020 um 11:22 Uhr schrieb jai-bholeki via Users list
> for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
> >
> > I need to swap two sub-strings in a word. The idea is that with the cursor
> > within a string, the two sub-strings get swapped.
> >
> > Examples:
> >
> > For the word ParSkip with point on the letter S, one gets SkipPar
> >
> > For the word Keybinding with point on the letter b, one gets bindingKey
>
> You can enable subword-mode (M-x subword-mode RET) and then swap the
> words with M-t (transpose-words).
(That doesn't work with your second example though)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Swapping Substrings
2020-10-31 10:21 Swapping Substrings jai-bholeki via Users list for the GNU Emacs text editor
2020-10-31 11:50 ` Philipp Stephani
@ 2020-10-31 11:57 ` Philipp Stephani
1 sibling, 0 replies; 4+ messages in thread
From: Philipp Stephani @ 2020-10-31 11:57 UTC (permalink / raw)
To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org
Am Sa., 31. Okt. 2020 um 11:22 Uhr schrieb jai-bholeki via Users list
for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
>
> I need to swap two sub-strings in a word. The idea is that with the cursor
> within a string, the two sub-strings get swapped.
>
> Examples:
>
> For the word ParSkip with point on the letter S, one gets SkipPar
>
> For the word Keybinding with point on the letter b, one gets bindingKey
Maybe something like this:
(defun my-transpose ()
(interactive "*")
(let ((point (point)))
(cl-destructuring-bind (begin . end) (bounds-of-thing-at-point
'word-strictly)
(goto-char begin)
(insert (delete-and-extract-region point end)))))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-31 11:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-31 10:21 Swapping Substrings jai-bholeki via Users list for the GNU Emacs text editor
2020-10-31 11:50 ` Philipp Stephani
2020-10-31 11:50 ` Philipp Stephani
2020-10-31 11:57 ` Philipp Stephani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).