Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: add ement-room-compose-send-functions #200

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

progfolio
Copy link
Contributor

Proof of concept for replacing the single message filter function with a hook.
The hook could be configured like so:

For those who want to skip the minibuffer confirmation after sending from a compose buffer:

(defun +ement--exit-minibuffer-once ()
  "Exit the minibuffer once after `ement-compose-message-send'."
  (remove-hook 'post-command-hook #'+ement--exit-minibuffer-once)
  (exit-minibuffer))

(defun +ement--install-minibuffer-skip ()
  "Automatically exit minibuffer after change."
  (add-hook 'post-command-hook #'+ement--exit-minibuffer-once))
(add-hook 'ement-room-compose-send-functions #'+ement--install-minibuffer-skip)

A silly example:

(defun +ement-censor-message ()
  "Censor messages containing bad words."
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "bad" nil t)
      (replace-match "b**"))))
(add-hook 'ement-room-compose-send-functions #'+ement-censor-message -90)

A less silly example:

(defun +ement-force-spellcheck ()
  "Force me to spell check a message before sending."
  (require 'flyspell)
  (flyspell-buffer)
  (save-excursion
    (goto-char (point-min))
    (while (text-property-search-forward 'face 'flyspell-incorrect)
      (flyspell-correct-at-point))))
(add-hook 'ement-room-compose-send-functions #'+ement-force-spellcheck -90)

@alphapapa
Copy link
Owner

This looks like a very interesting idea. Thanks.

@alphapapa alphapapa self-assigned this Aug 11, 2023
@alphapapa alphapapa added the enhancement New feature or request label Aug 11, 2023
@alphapapa alphapapa added this to the Future milestone Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants