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.
6 ;; This file is part of GNU Emacs.
12 ;; Functions to studlycapsify a region, word, or buffer. Possibly the
13 ;; esoteric significance of studlycapsification escapes you; that is,
14 ;; you suffer from autostudlycapsifibogotification. Too bad.
19 (defun studlify-region (begin end)
20 "Studlify-case the region"
25 (while (and (<= (point) end)
26 (not (looking-at "\\W*\\'")))
29 (setq begin (max (point) begin))
32 (word-end (min (point) end))
35 (while (< (point) word-end)
36 (setq offset (+ offset (following-char)))
38 (setq offset (+ offset (following-char)))
40 (while (< (point) word-end)
41 (setq c (following-char))
42 (if (and (= (% (+ c offset) 4) 2)
43 (let ((ch (following-char)))
44 (or (and (>= ch ?a) (<= ch ?z))
45 (and (>= ch ?A) (<= ch ?Z)))))
48 (insert (logxor c ? ))))
50 (setq begin (point))))))
53 (defun studlify-word (count)
54 "Studlify-case the current word, or COUNT words if given an argument"
56 (let ((begin (point)) end rb re)
59 (setq rb (min begin end) re (max begin end))
60 (studlify-region rb re)))
62 (defun studlify-buffer ()
63 "Studlify-case the current buffer"
65 (studlify-region (point-min) (point-max)))
69 ;;; studly.el ends here