[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is insert(backspace and overwrite character) possible?
From: |
Merciadri Luca |
Subject: |
Re: is insert(backspace and overwrite character) possible? |
Date: |
Sun, 09 May 2010 14:20:42 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
-----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-----