[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Toggle a character between "T" and "F"
From: |
Denis Bueno |
Subject: |
Re: Toggle a character between "T" and "F" |
Date: |
Fri, 11 Mar 2005 13:33:13 -0500 |
On 11 Mar 2005 10:10:44 -0800, Scott Waichler <scott.waichler@pnl.gov> wrote:
> I am looking for a way to toggle the character under the cursor. When
> the character is "T", I'd like to hit a keystroke and change it to "F",
> and vice versa. I use these characters to set logical values in R
> programming. Can anyone tell me the lisp coded needed for this?
Possibly a kludge, but:
(defun toggle-t-r ()
(interactive)
(case (char-after)
(?F (delete-char 1)
(insert "T")
(backward-char 1))
(?T (delete-char 1)
(insert "F")
(backward-char 1))))
--
Denis Bueno
PGP: http://pgp.mit.edu:11371/pks/lookup?search=0xA1B51B4B&op=index