From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Denis Bueno Newsgroups: gmane.emacs.help Subject: Re: Toggle a character between "T" and "F" Date: Fri, 11 Mar 2005 13:33:13 -0500 Message-ID: <6dbd4d00050311103358cb4fb@mail.gmail.com> References: <1110564644.587832.169060@g14g2000cwa.googlegroups.com> Reply-To: Denis Bueno NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1110566224 1978 80.91.229.2 (11 Mar 2005 18:37:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 18:37:04 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 19:37:04 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9owi-0007T0-CQ for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 19:33:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9pBq-0000gn-0a for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 13:48:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9pBU-0000eP-0j for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 13:48:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9pBQ-0000bq-JQ for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 13:48:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9pBQ-0000bd-9L for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 13:48:24 -0500 Original-Received: from [64.233.184.202] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D9owk-0006GE-Dl for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 13:33:14 -0500 Original-Received: by wproxy.gmail.com with SMTP id 36so1012458wra for ; Fri, 11 Mar 2005 10:33:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=jcXfpsqoSgBIRZ8vga5ekQv1Vobeza6yowJ09ePRXqAGhlKrIuW19/Tuppt6A9JHMKA2EPLF1nu36arJwicZ9tpNiSAL8cI3aIATwcaMvofJqGKhzJmlvZpOjATdUZPZ1lU5E/piEy0jfFH7e12LOYA5Q/YoMw4MrgkQpg06vYM= Original-Received: by 10.54.49.36 with SMTP id w36mr1285391wrw; Fri, 11 Mar 2005 10:33:13 -0800 (PST) Original-Received: by 10.54.43.7 with HTTP; Fri, 11 Mar 2005 10:33:13 -0800 (PST) Original-To: Scott Waichler In-Reply-To: <1110564644.587832.169060@g14g2000cwa.googlegroups.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: news.gmane.org gmane.emacs.help:24773 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24773 On 11 Mar 2005 10:10:44 -0800, 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? 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