[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about register
From: |
Le TeXnicien de Surface |
Subject: |
Re: about register |
Date: |
Sat, 21 Apr 2007 21:02:07 +0200 |
User-agent: |
KNode/0.10.1 |
Daniel Jensen écrivait/wrote :
> 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),
Thank you, it works.
BTW where could I find such a piece of information about character?
Is it lisp or emacs-specific?
> or perhaps better do away with the register and use a variable.
I will try to remember that next time I need such a command ;-) But won't
there be some catch to write the value of the variable in the buffer?
Once again, many thanks.
--
Le TeXnicien de Surface