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.
--------------------
--------------------
I'm using gnus as my mail client, so I added these few lines.
--------------------
--------------------
This advice enables you to do mail-goggles before sending an email.
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.
2009/09/27
Enhancing twit.el
I've been using twit.el as a client for Twitter because it works on Emacs, my favorite editor. But there are some rooms to be extended, so I added few lines to ameliorate twit.el.
These are my configuration for twit.el written in .emacs.el.
1. Access an url written in a tweet (requires emacs-w3m.)
P.S. Oh, I noticed that twit.el already has the function `twit-visit-link' by hitting `v' key!
2. Show messages while updating recent-tweets because the process takes some time.
3. Add a confirmation just before posting a tweet.
These are my configuration for twit.el written in .emacs.el.
1. Access an url written in a tweet (requires emacs-w3m.)
P.S. Oh, I noticed that twit.el already has the function `twit-visit-link' by hitting `v' key!
2. Show messages while updating recent-tweets because the process takes some time.
3. Add a confirmation just before posting a tweet.
(require 'twit)
;(twit-show-recent-tweets)
;(twit-follow-recent-tweets)
(define-key twit-status-mode-map "\C-m"
'(lambda ()
(interactive)
(let ((url (w3m-active-region-or-url-at-point nil)))
(if url
(browse-url url)))))
(defadvice twit-show-recent-tweets (before message-before)
(message "Accessing Twitter now..."))
(defadvice twit-show-recent-tweets (after message-after)
(message "Updated!"))
(ad-activate 'twit-show-recent-tweets)
(defadvice twit-post-status (around twit-post-confirmation)
(if (y-or-n-p "Do you really want to post the tweet?")
ad-do-it))
(ad-activate 'twit-post-status)
2009/09/20
半角文字で全角文字をisearch
emacs-w3mを使っている時等、たまに全角のアルファベット・数字が出て来る。そんな場合に半角文字でisearchを行ってもsearch結果に出て来なくてちょっと困っていたので、elispを書いてみた。
;;; begin
(defconst *zenkaku-list*
'((?a . ?a) (?b . ?b) (?c . ?c) (?d . ?d)
(?e . ?e) (?f . ?f) (?g . ?g) (?h . ?h)
(?i . ?i) (?j . ?j) (?k . ?k) (?l . ?l)
(?m . ?m) (?n . ?n) (?o . ?o) (?p . ?p)
(?q . ?q) (?r . ?r) (?s . ?s) (?t . ?t)
(?u . ?u) (?v . ?v) (?w . ?w) (?x . ?x)
(?y . ?y) (?z . ?z)
(?A . ?A) (?B . ?B) (?C . ?C) (?D . ?D)
(?E . ?E) (?F . ?F) (?G . ?G) (?H . ?H)
(?I . ?I) (?J . ?J) (?K . ?K) (?L . ?L)
(?M . ?M) (?N . ?N) (?O . ?O) (?P . ?P)
(?Q . ?Q) (?R . ?R) (?S . ?S) (?T . ?T)
(?U . ?U) (?V . ?V) (?W . ?W) (?X . ?X)
(?Y . ?Y) (?Z . ?Z)
(?0 . ?0) (?1 . ?1) (?2 . ?2) (?3 . ?3)
(?4 . ?4) (?5 . ?5) (?6 . ?6) (?7 . ?7)
(?8 . ?8) (?9 . ?9)))
(defun my-get-hankaku-zenkaku-regexp (target-string)
(let ((case-fold-search nil)
(target-string-length (length target-string))
(target-string-new "")
char-current
matchp
(x 0))
(while (< x target-string-length)
(setq char-current (elt target-string x))
(setq matchp nil)
(dolist (pair *zenkaku-list*)
(if (char-equal (car pair) char-current)
(progn
(setq target-string-new
(format "%s\\(%s\\|%s\\)"
target-string-new (string char-current) (string (cdr pair))))
(setq matchp t))))
(if (not matchp)
(setq target-string-new (format "%s%s" target-string-new (string char-current))))
(setq x (1+ x)))
target-string-new))
(defun my-re-search-zenkaku-by-hankaku-forward (search-string &optional bound noerror count)
(re-search-forward (my-get-hankaku-zenkaku-regexp search-string) bound noerror count))
(defun my-re-search-zenkaku-by-hankaku-backward (search-string &optional bound noerror count)
(re-search-backward (my-get-hankaku-zenkaku-regexp search-string) bound noerror count))
(defun my-isearch-zenkaku-by-hankaku ()
(if isearch-forward 'my-re-search-zenkaku-by-hankaku-forward 'my-re-search-zenkaku-by-hankaku-backward))
(setq isearch-search-fun-function 'my-isearch-zenkaku-by-hankaku)
;;; end
2009/02/05
Google Latitude
Google Latitudeを使おうとしたが上手く行かない…。
> The Latitude iGoogle gadget is not currently available for your location :(
等々とiGoogleに表示されてしまう。
どうしたらいいだろう?
> The Latitude iGoogle gadget is not currently available for your location :(
等々とiGoogleに表示されてしまう。
どうしたらいいだろう?
2009/01/23
登録:
投稿 (Atom)