Last active
August 29, 2015 14:02
-
-
Save kuanyui/b8e65db9b7ae626ac1cb to your computer and use it in GitHub Desktop.
避免使用者在神智不清的情況下用message.el幹出無法挽回的蠢事、寄出不該寄的email。有了這個設定,在寄出信件前會先對您施行酒測。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 避免使用者在神智不清的情況下用message.el幹出無法挽回的蠢事、寄出不該寄的email | |
(setq message-confirm-send t) | |
(defun message-test-mind-before-send () | |
(interactive) | |
(let* ((a (random 50)) | |
(b (random 15)) | |
(ans (+ a b)) | |
(input (string-to-int (read-from-minibuffer (format "%s + %s = " a b))))) | |
(if (eq input ans) | |
(message-send-and-exit) | |
(progn (message "Wrong answer, please try again") | |
(sleep-for 2) | |
(message-test-mind-before-send) | |
)))) | |
(define-key message-mode-map (kbd "C-c C-c") 'message-test-mind-before-send) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment