From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.help Subject: Re: Toggle a character between "T" and "F" Date: Fri, 11 Mar 2005 19:49:36 +0100 Message-ID: References: <1110564644.587832.169060@g14g2000cwa.googlegroups.com> Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1110569952 15496 80.91.229.2 (11 Mar 2005 19:39:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 19:39:12 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 20:39:11 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9puK-0007u5-IR for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 20:34:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9q9S-00074T-Jq for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 14:50:26 -0500 Original-Newsgroups: gnu.emacs.help X-Face: P05mdcZT&lL[-s2=mw~RsllZ0zZAb?vdE}.s 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:24774 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24774 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/