From: uzibalqa <uzibalqa@proton.me>
To: uzibalqa <uzibalqa@proton.me>
Cc: Arash Esbati <arash@gnu.org>,
uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Shortening words with multiple rules
Date: Wed, 17 Aug 2022 00:09:35 +0000 [thread overview]
Message-ID: <0ted8gWpziSeCqNIXIk-7J8IFrB2n29gZ5zJoBSzzCaLgig-oKvge9-s7T5Ss8Gbv2BxzrcSZjAUQg4pMD9HlPna-ETm22UNu6PVqZYLa18=@proton.me> (raw)
In-Reply-To: <s4Nrx708hIbYKnSBqI2_X5-Y8EHnltS0i29UbYy0s52sAVVidm2mpUuYf0hCxzBn0VvXUOy-wWArmAu8uzgy6bD-uWdXXpGf6r6n4THmZSc=@proton.me>
------- Original Message -------
On Tuesday, August 16th, 2022 at 7:06 PM, uzibalqa <uzibalqa@proton.me> wrote:
> ------- Original Message -------
> On Tuesday, August 16th, 2022 at 10:45 AM, Arash Esbati arash@gnu.org wrote:
>
>
>
> > uzibalqa uzibalqa@proton.me writes:
> >
> > > It does help a lot. How would a match at the end of word (matching
> > > "ley" "ily" "ly") look like, with your scheme?
> >
> > Maybe something like this:
> >
> > (defun shorten-word ()
> > "Shortens a word according to specific rules."
> > (interactive)
> > (let* ((bounds (bounds-of-thing-at-point 'word))
> > (s (car bounds))
> > (case-fold-search nil)
> > (p (point-marker)))
> > (when s
> > (goto-char s)
> > (cond ((looking-at (regexp-opt '("cog" "col" "com" "con"
> > "cor" "cum" "coun")
> > "\\<\\("))
> > (replace-match "k"))
> > ((looking-at (concat "[[:alpha:]]*?"
> > "\\("
> > (regexp-opt '("ley" "ily" "ly"))
> > "\\)\\>"))
> >
> > (replace-match "X" nil nil nil 1))
> > (t nil))
> > (goto-char p))
> > (set-marker p nil)))
> >
> > Best, Arash
Would like to allow hyphen in words and punctuation
Have started with
((looking-at (concat "[[:alpha:]]+[-]?"
"\\(" (regexp-opt '("ley" "ily" "ly")) "\\)\\>"))
(replace-match "l" nil nil nil 1))
But this replaced "family" with just the letter "l".
next prev parent reply other threads:[~2022-08-17 0:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 0:49 Shortening words with multiple rules uzibalqa via Users list for the GNU Emacs text editor
2022-08-16 8:55 ` Arash Esbati
2022-08-16 10:08 ` uzibalqa
2022-08-16 10:45 ` Arash Esbati
2022-08-16 19:06 ` uzibalqa
2022-08-17 0:09 ` uzibalqa [this message]
2022-08-17 4:18 ` uzibalqa
2022-08-17 6:16 ` Arash Esbati
2022-08-17 9:16 ` uzibalqa
2022-08-17 10:07 ` Arash Esbati
2022-08-17 11:00 ` uzibalqa
2022-08-17 12:15 ` Arash Esbati
2022-08-17 21:29 ` uzibalqa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='0ted8gWpziSeCqNIXIk-7J8IFrB2n29gZ5zJoBSzzCaLgig-oKvge9-s7T5Ss8Gbv2BxzrcSZjAUQg4pMD9HlPna-ETm22UNu6PVqZYLa18=@proton.me' \
--to=uzibalqa@proton.me \
--cc=arash@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).