all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* Re: Shortening words in region
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Louis @ 2022-08-13 17:42 UTC (permalink / raw)
  To: uzibalqa; +Cc: help-gnu-emacs@gnu.org

* uzibalqa via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2022-08-13 19:34]:
> 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".

(rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum"))) ⇒ "\\(?:c\\(?:o\\(?:un\\|[glmnr]\\)\\|um\\)\\)*"

{C-h f rx RET}

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Shortening words in region
  2022-08-13 17:42 ` Jean Louis
@ 2022-08-13 18:19   ` uzibalqa
  2022-08-13 18:22     ` uzibalqa
  0 siblings, 1 reply; 6+ messages in thread
From: uzibalqa @ 2022-08-13 18:19 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs@gnu.org






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, August 13th, 2022 at 5:42 PM, Jean Louis <bugs@gnu.support> wrote:


> * uzibalqa via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2022-08-13 19:34]:
>
> > 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".
>
>
> (rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum"))) ⇒ "\\(?:c\\(?:o\\(?:un\\|[glmnr]\\)\\|um\\)\\)*"
>
> {C-h f rx RET}
>
> --
> Jean

Like below?

(insert (replace-regexp-in-string
   (rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum")))
   "k" word))






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

* Re: Shortening words in region
  2022-08-13 18:19   ` uzibalqa
@ 2022-08-13 18:22     ` uzibalqa
  2022-08-13 18:32       ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: uzibalqa @ 2022-08-13 18:22 UTC (permalink / raw)
  To: uzibalqa; +Cc: Jean Louis, help-gnu-emacs@gnu.org






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, August 13th, 2022 at 6:19 PM, uzibalqa <uzibalqa@proton.me> wrote:


>
>
>
>
>
> Sent with Proton Mail secure email.
>
>
> ------- Original Message -------
> On Saturday, August 13th, 2022 at 5:42 PM, Jean Louis bugs@gnu.support wrote:
>
>
>
> > * uzibalqa via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2022-08-13 19:34]:
> >
> > > 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".
> >
> > (rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum"))) ⇒ "\\(?:c\\(?:o\\(?:un\\|[glmnr]\\)\\|um\\)\\)*"
> >
> > {C-h f rx RET}
> >
> > --
> > Jean

Would you know how to apply rx to the following?

"\\(ly\\|ily\\|ley\\)\\>"



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

* Re: Shortening words in region
  2022-08-13 18:22     ` uzibalqa
@ 2022-08-13 18:32       ` Jean Louis
  2022-08-13 19:01         ` uzibalqa
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Louis @ 2022-08-13 18:32 UTC (permalink / raw)
  To: uzibalqa; +Cc: help-gnu-emacs@gnu.org

* uzibalqa <uzibalqa@proton.me> [2022-08-13 21:23]:
> Would you know how to apply rx to the following?
> 
> "\\(ly\\|ily\\|ley\\)\\>"

As with missing pieces of information it is impossible to know what you think.

You first define your own endeavours. I suggest you write a note for yourself.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Shortening words in region
  2022-08-13 18:32       ` Jean Louis
@ 2022-08-13 19:01         ` uzibalqa
  0 siblings, 0 replies; 6+ messages in thread
From: uzibalqa @ 2022-08-13 19:01 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs@gnu.org


------- Original Message -------
On Saturday, August 13th, 2022 at 6:32 PM, Jean Louis <bugs@gnu.support> wrote:


> * uzibalqa uzibalqa@proton.me [2022-08-13 21:23]:
>
> > Would you know how to apply rx to the following?
> >
> > "\\(ly\\|ily\\|ley\\)\\>"
>
>
> As with missing pieces of information it is impossible to know what you think.
>
> You first define your own endeavours. I suggest you write a note for yourself.
>
> --
> Jean

Want to replace the end part of words watching `ly', `ily', and `ley' with the letter `l'.
So that "family" becomes "faml".




^ 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.