Annotation of 43BSDReno/contrib/emacs-18.55/lisp/studly.el, revision 1.1.1.1

1.1       root        1: ;;; StudlyCaps (tm)(r)(c)(xxx)
                      2: 
                      3: (defun studlify-region (begin end)
                      4:   "Studlify-case the region"
                      5:   (interactive "*r")
                      6:   (save-excursion
                      7:     (goto-char begin)
                      8:     (setq begin (point))
                      9:     (while (and (<= (point) end)
                     10:                (not (looking-at "\\W*\\'")))
                     11:       (forward-word 1)
                     12:       (backward-word 1)
                     13:       (setq begin (max (point) begin))
                     14:       (forward-word 1)
                     15:       (let ((offset 0)
                     16:            (word-end (min (point) end))
                     17:            c)
                     18:        (goto-char begin)
                     19:        (while (< (point) word-end)
                     20:          (setq offset (+ offset (following-char)))
                     21:          (forward-char 1))
                     22:        (setq offset (+ offset (following-char)))
                     23:        (goto-char begin)
                     24:        (while (< (point) word-end)
                     25:          (setq c (following-char))
                     26:          (if (and (= (% (+ c offset) 4) 2)
                     27:                   (let ((ch (following-char)))
                     28:                     (or (and (>= ch ?a) (<= ch ?z))
                     29:                         (and (>= ch ?A) (<= ch ?Z)))))
                     30:              (progn
                     31:                (delete-char 1)
                     32:                (insert (logxor c ? ))))
                     33:          (forward-char 1))
                     34:        (setq begin (point))))))
                     35: 
                     36: (defun studlify-word (count)
                     37:   "Studlify-case the current word, or COUNT words if given an argument"
                     38:   (interactive "*p")
                     39:   (let ((begin (point)) end rb re)
                     40:     (forward-word count)
                     41:     (setq end (point))
                     42:     (setq rb (min begin end) re (max begin end))
                     43:     (studlify-region rb re)))
                     44: 
                     45: (defun studlify-buffer ()
                     46:   "Studlify-case the current buffer"
                     47:   (interactive "*")
                     48:   (studlify-region (point-min) (point-max)))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.