1 ;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)
6 ;;; This is in the public domain, since it was distributed
7 ;;; by its author without a copyright notice in 1986.
11 (defun studlify-region (begin end
)
12 "Studlify-case the region"
17 (while (and (<= (point) end
)
18 (not (looking-at "\\W*\\'")))
21 (setq begin
(max (point) begin
))
24 (word-end (min (point) end
))
27 (while (< (point) word-end
)
28 (setq offset
(+ offset
(following-char)))
30 (setq offset
(+ offset
(following-char)))
32 (while (< (point) word-end
)
33 (setq c
(following-char))
34 (if (and (= (%
(+ c offset
) 4) 2)
35 (let ((ch (following-char)))
36 (or (and (>= ch ?a
) (<= ch ?z
))
37 (and (>= ch ?A
) (<= ch ?Z
)))))
40 (insert (logxor c ?
))))
42 (setq begin
(point))))))
44 (defun studlify-word (count)
45 "Studlify-case the current word, or COUNT words if given an argument"
47 (let ((begin (point)) end rb re
)
50 (setq rb
(min begin end
) re
(max begin end
))
51 (studlify-region rb re
)))
53 (defun studlify-buffer ()
54 "Studlify-case the current buffer"
56 (studlify-region (point-min) (point-max)))
58 ;;; studly.el ends here