home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / mutt / twiddle.mut < prev    next >
Text File  |  1988-09-14  |  1KB  |  33 lines

  1.   ;; twiddle.mut : twiddle characters
  2.   ;; twiddle-left-of-dot:  (C-T in Gosling's or Unipress EMACS)
  3.   ;;   Transpose the 2 characters left of the cursor.  Does nothing if the
  4.   ;;     cursor is within a character of left edge.
  5.   ;;   For example:  to change "abc" to "bac", put the cursor on the "c" and
  6.   ;;     twiddle.
  7.   ;; twiddle-about-dot:  (C-T in GNU EMACS)
  8.   ;;   Transpose the characters on either side of the dot.  At the end of a
  9.   ;;     line, does a twiddle-left-of-dot.  Does nothing if the cursor is
  10.   ;;     at the left edge.
  11.   ;;   For example:  to change "abc" to "bac", put the cursor on the "b" and
  12.   ;;     twiddle.
  13.  
  14. (defun
  15.   twiddle-left-of-dot
  16.   {
  17.     (if (< 2 (current-column))
  18.     {
  19.       (previous-character)(looking-at '.')
  20.       (delete-character)
  21.       (previous-character)(insert-text (get-matched '&'))
  22.       (next-character)
  23.     })
  24.   }
  25.   twiddle-about-dot
  26.   {
  27.     (if (looking-at '$')
  28.       (twiddle-left-of-dot)
  29.       (if (next-character) { (twiddle-left-of-dot)(previous-character) })
  30.     )
  31.   }
  32. )
  33.