all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: is insert(backspace and overwrite character) possible?
Date: Sun, 09 May 2010 12:19:24 +0200	[thread overview]
Message-ID: <87wrvdpec3.fsf@fh-trier.de> (raw)
In-Reply-To: 87bpcp36ke.fsf@merciadriluca-station.MERCIADRILUCA

Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> writes:

> Barry Margolin <barmar@alum.mit.edu> writes:
>
>> You can't do it just with insert, and I don't know how you would do it
>> in C, either.  You need to write a conditional, like
>>
>> (if (looking-at "- ")
>>     (delete-char 2))
>>
>> before doing the insert.
>
> Thanks. I do not remember for the C, but I am pretty sure that I had
> already used it (in the past).

You are probably thinking of carriage return.

    printf("foo\rbar\n");

will print 'bar'.

Anyway, we can create a overwriting `insert' variant.

(defun insert-overwrite (&rest args)
  (let ((pos (point)))
    (apply 'insert args)
    (delete-region (point) (min (point-at-eol)
                                (+ (point)
                                   (- (point) pos))))))

But my guess is, that you actually want something like this.

(defun replace-line (&rest args)
  (delete-region (point-at-bol) (point-at-eol))
  (apply 'insert args))


-ap


  reply	other threads:[~2010-05-09 10:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-08 20:01 is insert(backspace and overwrite character) possible? Merciadri Luca
2010-05-09  0:41 ` Barry Margolin
2010-05-09  6:58   ` Merciadri Luca
2010-05-09 10:19     ` Andreas Politz [this message]
2010-05-09 12:20       ` Merciadri Luca

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=87wrvdpec3.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.