mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(mail): capitalize formal pronouns
This commit is contained in:
parent
fd04dca8a4
commit
ca3d5c2b75
2 changed files with 62 additions and 0 deletions
|
|
@ -112,6 +112,36 @@
|
|||
|
||||
(add-hook 'notmuch-mua-send-hook #'my/message-ensure-subject)
|
||||
|
||||
(defvar my/ru-formal-pronous
|
||||
'("вы" "вас" "вам" "вами" "ваш" "ваша" "ваше" "ваши" "вашего"
|
||||
"вашей" "вашему" "вашим" "вашем" "вашеми"))
|
||||
|
||||
(defvar my/ru-formal-pronous-regex
|
||||
(regexp-opt my/ru-formal-pronous 'words))
|
||||
|
||||
(defun my/message-ensure-capitalized-formal-pronouns ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(message-goto-body)
|
||||
(cl-block nil
|
||||
(let ((case-fold-search nil)
|
||||
confirmed)
|
||||
(while (re-search-forward my/ru-formal-pronous-regex nil t)
|
||||
(let* ((match (match-string 0))
|
||||
(capitalized (capitalize match))
|
||||
(beg (match-beginning 0))
|
||||
(end (match-end 0)))
|
||||
(if (or confirmed
|
||||
(y-or-n-p (format "Replace %s with %s? "
|
||||
match capitalized)))
|
||||
(progn
|
||||
(delete-region beg end)
|
||||
(insert capitalized)
|
||||
(setq confirmed t))
|
||||
(cl-return))))))))
|
||||
|
||||
(add-hook 'notmuch-mua-send-hook #'my/message-ensure-capitalized-formal-pronouns)
|
||||
|
||||
(defun my/ensure-password ()
|
||||
(interactive)
|
||||
(my/password-store-get "Job/Digital/Email/pvkorytov@etu.ru"))
|
||||
|
|
|
|||
32
Mail.org
32
Mail.org
|
|
@ -577,6 +577,38 @@ Then advice the =notmuch-mua-reply= function:
|
|||
|
||||
(add-hook 'notmuch-mua-send-hook #'my/message-ensure-subject)
|
||||
#+end_src
|
||||
** Capitalize formal pronous
|
||||
#+begin_src emacs-lisp
|
||||
(defvar my/ru-formal-pronous
|
||||
'("вы" "вас" "вам" "вами" "ваш" "ваша" "ваше" "ваши" "вашего"
|
||||
"вашей" "вашему" "вашим" "вашем" "вашеми"))
|
||||
|
||||
(defvar my/ru-formal-pronous-regex
|
||||
(regexp-opt my/ru-formal-pronous 'words))
|
||||
|
||||
(defun my/message-ensure-capitalized-formal-pronouns ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(message-goto-body)
|
||||
(cl-block nil
|
||||
(let ((case-fold-search nil)
|
||||
confirmed)
|
||||
(while (re-search-forward my/ru-formal-pronous-regex nil t)
|
||||
(let* ((match (match-string 0))
|
||||
(capitalized (capitalize match))
|
||||
(beg (match-beginning 0))
|
||||
(end (match-end 0)))
|
||||
(if (or confirmed
|
||||
(y-or-n-p (format "Replace %s with %s? "
|
||||
match capitalized)))
|
||||
(progn
|
||||
(delete-region beg end)
|
||||
(insert capitalized)
|
||||
(setq confirmed t))
|
||||
(cl-return))))))))
|
||||
|
||||
(add-hook 'notmuch-mua-send-hook #'my/message-ensure-capitalized-formal-pronouns)
|
||||
#+end_src
|
||||
** Ensure password is loaded
|
||||
Otherwise =msmtp= may call =pinentry= while Emacs is locked, which means EXWM can't process the password window.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue