unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Shortening words in region
@ 2022-08-13 16:31 uzibalqa via Users list for the GNU Emacs text editor
  2022-08-13 17:42 ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: uzibalqa via Users list for the GNU Emacs text editor @ 2022-08-13 16:31 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Have been working on shortening words. But doing so on a word by word basis is quite slow. Thusly I am writing
a version that accepts a selected region.

This function uses a selected region, then changes initial parts oy words (replacing matching cog, col, com, con, cor, coun, and cum
with the letter "k".

What improvements can I do to it?

(defun shorten-region (beg end)
"TODO"
(interactive "r")
(narrow-to-region beg end)
(goto-char (point-min))

(insert (replace-regexp "\\<\\(co[glmnr]\\|coun\\|cum\\)" "k" nil beg end)) )

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-13 19:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-13 16:31 Shortening words in region uzibalqa via Users list for the GNU Emacs text editor
2022-08-13 17:42 ` Jean Louis
2022-08-13 18:19   ` uzibalqa
2022-08-13 18:22     ` uzibalqa
2022-08-13 18:32       ` Jean Louis
2022-08-13 19:01         ` uzibalqa

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).