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.
17 (defun studlify-region (begin end
)
18 "Studlify-case the region"
23 (while (and (<= (point) end
)
24 (not (looking-at "\\W*\\'")))
27 (setq begin
(max (point) begin
))
30 (word-end (min (point) end
))
33 (while (< (point) word-end
)
34 (setq offset
(+ offset
(following-char)))
36 (setq offset
(+ offset
(following-char)))
38 (while (< (point) word-end
)
39 (setq c
(following-char))
40 (if (and (= (%
(+ c offset
) 4) 2)
41 (let ((ch (following-char)))
42 (or (and (>= ch ?a
) (<= ch ?z
))
43 (and (>= ch ?A
) (<= ch ?Z
)))))
46 (insert (logxor c ?
))))
48 (setq begin
(point))))))
51 (defun studlify-word (count)
52 "Studlify-case the current word, or COUNT words if given an argument"
54 (let ((begin (point)) end rb re
)
57 (setq rb
(min begin end
) re
(max begin end
))
58 (studlify-region rb re
)))
60 (defun studlify-buffer ()
61 "Studlify-case the current buffer"
63 (studlify-region (point-min) (point-max)))
67 ;;; studly.el ends here