2009/10/30

Post-it Notes in Emacs



I wrote stickies.el for post-it notes in Emacs.
And I also added anything-stickies.el for an interface to stickies.
Here is a link to github

Stickies.el has only primitive features: create/kill/save buffers and frames.
I just want to using emacs buffers instead of Stickies.app in Mac OSX, that's
why I wrote the elisps.

In default, no global setting (keybind, hooks, etc) is added.
You have to write setting in your init file to make stickies useful.

See the "setting" section in stickies.el. There is an example setting.

2009/10/23

Mail Goggles in Emacs

I wrote an elisp which implements Mail Goggles in Emacs.
Mail Goggles is an extension of gmail and it provides a confirmation before sending emails by some simple calculations in order to prevent sending inappropriate emails with little care.

Here is the elisp.
--------------------

(defvar mail-goggles-default-number-of-times 3
"The number of times that you need before do actions.")

(defvar mail-goggles-calculate-function-list '(+ - * /)
"The list of calculation functions for mail-goggles.")

(defun mail-goggles ()
"Gmail-like mail goggles.
You have to do calculation several times that is specified by
`mail-goggles-default-number-of-times'.
The calculation types are defined in `mail-goggles-calculate-function-list'."
(block "calc"
(let ((i 0))
(while (< i mail-goggles-default-number-of-times)
(if (not
(let* ((calc-func (nth (random 4) mail-goggles-calculate-function-list))
(x (random 100))
(y
(cond ((equal calc-func '/)
(let ((tmp (random 10)))
(while (= 0 tmp)
(setq tmp (random 10)))
tmp)
(random 10))
((equal calc-func '*)
(random 10))
(t (random 100))))
(answer (funcall calc-func x y)))
(= (read-number (format "Calculate %d%s%d: " x calc-func y))
answer)))
(progn
(message "You are tired, aren't you?")
(return-from "calc" nil)))
(setq i (1+ i)))
t)))

--------------------
I'm using gnus as my mail client, so I added these few lines.
--------------------

(defadvice message-send-and-exit (around mail-goggles)
"Do mail-goggles before sending a mail."
(if (mail-goggles)
ad-do-it))

(ad-activate 'message-send-and-exit)

--------------------
This advice enables you to do mail-goggles before sending an email.