From: Merciadri Luca <Luca.Merciadri@student.ulg.ac.be>
To: help-gnu-emacs@gnu.org
Subject: Re: is insert(backspace and overwrite character) possible?
Date: Sun, 09 May 2010 14:20:42 +0200 [thread overview]
Message-ID: <87fx21cllx.fsf@merciadriluca-station.MERCIADRILUCA> (raw)
In-Reply-To: 87wrvdpec3.fsf@fh-trier.de
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andreas Politz <politza@fh-trier.de> writes:
> 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))
Thanks. Actually, it could do the trick. As you might see in my
signature, the delimiters are not standard: I am having `- --' at the
place of `--'. This should be due to many facts in my .gnus:
* I have set
==
(setq gnus-signature-separator '("^--$"))
==
* I have defined a command which adds a quirk like this:
==
(defun psig ()
"Insert the signature for a personal posting on a newsgroup, including a saying."
(interactive)
(goto-char (point-max))
(or (= (char-after (- (point) 1)) ?\n)
(newline 1))
(insert "-- \n")
(let ((saying ""))
(save-window-excursion
(find-file "~/Sayings")
(goto-char (point-min))
(search-forward "#")
(delete-char -1)
(setq fill-prefix nil)
(mark-paragraph)
(setq saying (buffer-substring (region-beginning) (region-end)))
(exchange-point-and-mark)
(if (eobp) (goto-char (1+ (point-min))))
;(insert "#")
(save-buffer))
(insert saying)
))
==
* I am using Mailcrypt (but I do not want to change).
Do you have any idea of what could be causing this problematic
signature?
Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
Big thunder. Little rain.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkvmqJkACgkQM0LLzLt8MhzdyQCgjKmBE69mo0pjaHrJtCZPrVCM
hPUAn0j2fivhx+PeACaw8WYOjLCyuLH+
=6wkS
-----END PGP SIGNATURE-----
prev parent reply other threads:[~2010-05-09 12:20 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
2010-05-09 12:20 ` Merciadri Luca [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=87fx21cllx.fsf@merciadriluca-station.MERCIADRILUCA \
--to=luca.merciadri@student.ulg.ac.be \
--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.