view lisp/games/NeXTify.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children b82b59fe008d
line wrap: on
line source

(defun SeLF-insert-command (arg)
  "Insert the character you TyPE.
Whichever character you TyPE to run ThIS command is inserted."
  (interactive "p")
  (let ((p (point))
	(case-fold-search nil))
    (self-insert-command arg)
    (save-excursion
      (goto-char p)
      (skip-chars-backward " \t\r\n")
      (if (condition-case () (forward-char -4) (error t))
	  nil
	(if (looking-at "\\<[A-Za-z][a-z][a-z][a-z][^A-Za-z]")
	    (progn
	      (insert (upcase (following-char))) (delete-char 1)
	      (forward-char 1)
	      (insert (upcase (following-char))) (delete-char 1)
	      (insert (upcase (following-char))) (delete-char 1)))))))

(define-key text-mode-map " " 'SeLF-insert-command)
(define-key text-mode-map "," 'SeLF-insert-command)
(define-key text-mode-map "." 'SeLF-insert-command)
(define-key text-mode-map "!" 'SeLF-insert-command)
(define-key text-mode-map "-" 'SeLF-insert-command)
(define-key text-mode-map "_" 'SeLF-insert-command)
(define-key text-mode-map ";" 'SeLF-insert-command)
(define-key text-mode-map ":" 'SeLF-insert-command)