From: daniel@bigwalter.net (Daniel Jensen)
To: help-gnu-emacs@gnu.org
Subject: Re: about register
Date: Sun, 22 Apr 2007 12:42:43 +0200 [thread overview]
Message-ID: <87vefou1uk.fsf@orme.bigwalter.net> (raw)
In-Reply-To: 462a5fb1$0$27411$ba4acef3@news.orange.fr
Le TeXnicien de Surface <texnicien.de.surface@chezmoi.eur> writes:
> Daniel Jensen écrivait/wrote :
>
>> 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?
You can start with reading the function documentation; `C-h f
number-to-register RET' and so on. That has always the most useful
information on how to use functions. In this case, it mentions that
characters are used to name registers.
To find answers to the more general questions, like "But, what is a
character anyway?", consult the Emacs Lisp manual. Chapter 2 describes
the data types and how you can use them in your programs. Here you will
find that characters can be entered with the question mark syntax in
Lisp code. The Lisp manual also holds information such as how registers
are implemented, but you don't need to know that just to use them.
>> 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?
It will require extra work to insert a number from a variable -- you
have to convert it to a string. But I think your code will be clearer if
you use a variable. You can do it like this:
(let ((counter 1))
(while ...
(insert (number-to-string counter))
(setq counter (+ counter 1))))
next prev parent reply other threads:[~2007-04-22 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-21 13:19 about register Le TeXnicien de Surface
2007-04-21 15:37 ` Daniel Jensen
2007-04-21 19:02 ` Le TeXnicien de Surface
2007-04-22 10:42 ` Daniel Jensen [this message]
2007-04-22 19:57 ` Le TeXnicien de Surface
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vefou1uk.fsf@orme.bigwalter.net \
--to=daniel@bigwalter.net \
--cc=help-gnu-emacs@gnu.org \
--cc=indiscipline@gmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).