1 ;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)
5 ;;; This is in the public domain, since it was distributed
6 ;;; by its author without a copyright notice in 1986.
10 (defun studlify-region (begin end
)
11 "Studlify-case the region"
16 (while (and (<= (point) end
)
17 (not (looking-at "\\W*\\'")))
20 (setq begin
(max (point) begin
))
23 (word-end (min (point) end
))
26 (while (< (point) word-end
)
27 (setq offset
(+ offset
(following-char)))
29 (setq offset
(+ offset
(following-char)))
31 (while (< (point) word-end
)
32 (setq c
(following-char))
33 (if (and (= (%
(+ c offset
) 4) 2)
34 (let ((ch (following-char)))
35 (or (and (>= ch ?a
) (<= ch ?z
))
36 (and (>= ch ?A
) (<= ch ?Z
)))))
39 (insert (logxor c ?
))))
41 (setq begin
(point))))))
43 (defun studlify-word (count)
44 "Studlify-case the current word, or COUNT words if given an argument"
46 (let ((begin (point)) end rb re
)
49 (setq rb
(min begin end
) re
(max begin end
))
50 (studlify-region rb re
)))
52 (defun studlify-buffer ()
53 "Studlify-case the current buffer"
55 (studlify-region (point-min) (point-max)))
57 ;;; studly.el ends here