[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New command suggestion

This is a really handy command I invented for the FinalWord editor.
FW users are so fond of it that I thought someone might want to add it
to Zmacs.  I bind it to c-C, which (as far as I know) has never been
bound in the default system.

Is there some more appropriate mailing list for messages of this kind?

(defcom com-rotate-case
	"Change case of current/previous word.  Try it, it undoes itself.
If the cursor is on a word, this command rotates the case of the word (starting
at the current cursor position) from lowercase to capitalized to uppercase and
back to lowercase.  If the cursor is not on a word, the command works on the 
beginning of the previous word." ()
  (let ((point (point))
	(save-point (copy-bp (point))))
    (if (not (= (word-syntax (bp-ch-char point)) word-alphabetic))
	(move-bp point (or (forward-word point -1) (barf))))
    (setq *numeric-arg* 1)
    (let ((this-ch (bp-ch-char point))
	  (next-ch (bp-ch-char (forward-char point))))
      (if (is-lowercase this-ch)
	  (if (is-lowercase next-ch)
      (move-bp (point) save-point)

-- Scott