1 ;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)
3 ;;; This is in the public domain, since it was distributed
4 ;;; by its author in 1986 without a copyright notice.
6 ;; This file is part of GNU Emacs.
8 ;; Maintainer: emacs-devel@gnu.org
13 ;; Functions to studlycapsify a region, word, or buffer. Possibly the
14 ;; esoteric significance of studlycapsification escapes you; that is,
15 ;; you suffer from autostudlycapsifibogotification. Too bad.
20 (defun studlify-region (begin end
)
21 "Studlify-case the region."
26 (while (and (<= (point) end
)
27 (not (looking-at "\\W*\\'")))
28 (forward-word-strictly 1)
29 (backward-word-strictly 1)
30 (setq begin
(max (point) begin
))
31 (forward-word-strictly 1)
33 (word-end (min (point) end
))
36 (while (< (point) word-end
)
37 (setq offset
(+ offset
(following-char)))
39 (setq offset
(+ offset
(following-char)))
41 (while (< (point) word-end
)
42 (setq c
(following-char))
43 (if (and (= (%
(+ c offset
) 4) 2)
44 (let ((ch (following-char)))
45 (or (and (>= ch ?a
) (<= ch ?z
))
46 (and (>= ch ?A
) (<= ch ?Z
)))))
49 (insert (logxor c ?
))))
51 (setq begin
(point))))))
54 (defun studlify-word (count)
55 "Studlify-case the current word, or COUNT words if given an argument."
57 (let ((begin (point)) end rb re
)
58 (forward-word-strictly count
)
60 (setq rb
(min begin end
) re
(max begin end
))
61 (studlify-region rb re
)))
64 (defun studlify-buffer ()
65 "Studlify-case the current buffer."
67 (studlify-region (point-min) (point-max)))
71 ;;; studly.el ends here