help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about register


From: Daniel Jensen
Subject: Re: about register
Date: Sat, 21 Apr 2007 17:37:50 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.98 (gnu/linux)

Le TeXnicien de Surface <texnicien.de.surface@chezmoi.eur> writes:

> I'd like to use the following command:
> (defun complete-pid ()
>   (interactive)
>   (goto-char 0)
>   (number-to-register 1 "A")
>   (while (re-search-forward "p=PID=0" nil t)
>     (insert-register "A")
>     (increment-register 1 "A")
> ))
>
> but when emacs finds the first `p=PID=' it says:
> `register does not contain a number'
> and stops.

You are using strings as register names, this is why it does not work.
The problem lies in how registers are implemented; they are compared
behind the scenes with the eq predicate. However, strings are not eq.
Use characters instead (e.g., ?A), or perhaps better do away with the
register and use a variable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]