On Fri, Mar 11 2005, Scott Waichler 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?

Maybe like this...

(defun rs-toggle-T-and-F ()
  "Toggle the characters `T' nor `F' at point."
  (interactive)
  (let ((case-fold-search nil))
    (cond ((looking-at "T")
           (delete-char 1)
           (insert "F"))
          ((looking-at "F")
           (delete-char 1)
           (insert "T"))
          (t (message "Neither `T' nor `F' at point")))))

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/
_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to