[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shortening words with multiple rules
From: |
Arash Esbati |
Subject: |
Re: Shortening words with multiple rules |
Date: |
Tue, 16 Aug 2022 12:45:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
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
- Shortening words with multiple rules, uzibalqa, 2022/08/15
- Re: Shortening words with multiple rules, Arash Esbati, 2022/08/16
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/16
- Re: Shortening words with multiple rules,
Arash Esbati <=
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/16
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/16
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/17
- Re: Shortening words with multiple rules, Arash Esbati, 2022/08/17
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/17
- Re: Shortening words with multiple rules, Arash Esbati, 2022/08/17
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/17
- Re: Shortening words with multiple rules, Arash Esbati, 2022/08/17
- Re: Shortening words with multiple rules, uzibalqa, 2022/08/17