1 ;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)
3 ;;; This is in the public domain, since it was distributed
4 ;;; by its author without a copyright notice in 1986.
10 ;; Functions to studlycapsify a region, word, or buffer. Possibly the
11 ;; esoteric significance of studlycapsification escapes you; that is,
12 ;; you suffer from autostudlycapsifibogotification. Too bad.
16 (defun studlify-region (begin end
)
17 "Studlify-case the region"
22 (while (and (<= (point) end
)
23 (not (looking-at "\\W*\\'")))
26 (setq begin
(max (point) begin
))
29 (word-end (min (point) end
))
32 (while (< (point) word-end
)
33 (setq offset
(+ offset
(following-char)))
35 (setq offset
(+ offset
(following-char)))
37 (while (< (point) word-end
)
38 (setq c
(following-char))
39 (if (and (= (%
(+ c offset
) 4) 2)
40 (let ((ch (following-char)))
41 (or (and (>= ch ?a
) (<= ch ?z
))
42 (and (>= ch ?A
) (<= ch ?Z
)))))
45 (insert (logxor c ?
))))
47 (setq begin
(point))))))
49 (defun studlify-word (count)
50 "Studlify-case the current word, or COUNT words if given an argument"
52 (let ((begin (point)) end rb re
)
55 (setq rb
(min begin end
) re
(max begin end
))
56 (studlify-region rb re
)))
58 (defun studlify-buffer ()
59 "Studlify-case the current buffer"
61 (studlify-region (point-min) (point-max)))
65 ;;; studly.el ends here