1 ;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)
3 (defun studlify-region (begin end)
4 "Studlify-case the region"
9 (while (and (<= (point) end)
10 (not (looking-at "\\W*\\'")))
13 (setq begin (max (point) begin))
16 (word-end (min (point) end))
19 (while (< (point) word-end)
20 (setq offset (+ offset (following-char)))
22 (setq offset (+ offset (following-char)))
24 (while (< (point) word-end)
25 (setq c (following-char))
26 (if (and (= (% (+ c offset) 4) 2)
27 (let ((ch (following-char)))
28 (or (and (>= ch ?a) (<= ch ?z))
29 (and (>= ch ?A) (<= ch ?Z)))))
32 (insert (logxor c ? ))))
34 (setq begin (point))))))
36 (defun studlify-word (count)
37 "Studlify-case the current word, or COUNT words if given an argument"
39 (let ((begin (point)) end rb re)
42 (setq rb (min begin end) re (max begin end))
43 (studlify-region rb re)))
45 (defun studlify-buffer ()
46 "Studlify-case the current buffer"
48 (studlify-region (point-min) (point-max)))
50 ;;; studly.el ends here