all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reiner Steib <reinersteib+from-uce@imap.cc>
Subject: Re: Toggle a character between "T" and "F"
Date: Fri, 11 Mar 2005 19:49:36 +0100	[thread overview]
Message-ID: <v964zynhkv.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: 1110564644.587832.169060@g14g2000cwa.googlegroups.com

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/

      parent reply	other threads:[~2005-03-11 18:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-11 18:10 Toggle a character between "T" and "F" Scott Waichler
2005-03-11 18:33 ` Denis Bueno
2005-03-11 18:49 ` Reiner Steib [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v964zynhkv.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+from-uce@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.