From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le TeXnicien de Surface Newsgroups: gmane.emacs.help Subject: Re: about register Date: Sun, 22 Apr 2007 21:57:01 +0200 Organization: les newsgroups par Orange Message-ID: <462bbe16$0$5102$ba4acef3@news.orange.fr> References: <462a0f65$0$27366$ba4acef3@news.orange.fr> <87abx1kab5.fsf@orme.bigwalter.net> <462a5fb1$0$27411$ba4acef3@news.orange.fr> <87vefou1uk.fsf@orme.bigwalter.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Trace: sea.gmane.org 1177274126 22287 80.91.229.12 (22 Apr 2007 20:35:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Apr 2007 20:35:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 22 22:35:25 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HfimL-0000nd-5G for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Apr 2007 22:35:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hfire-0000L2-OD for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Apr 2007 16:40:54 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: KNode/0.10.1 Original-Lines: 51 Original-NNTP-Posting-Date: 22 Apr 2007 21:57:10 CEST Original-NNTP-Posting-Host: 82.127.159.47 Original-X-Trace: 1177271830 news.orange.fr 5102 82.127.159.47:63796 Original-X-Complaints-To: abuse@orange.fr Original-Xref: shelby.stanford.edu gnu.emacs.help:147393 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42997 Archived-At: Daniel Jensen écrivait/wrote : > Le TeXnicien de Surface 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. I did that but never thought there would be a difference between a char and a string of one char (bad perl habit I guess :) > > 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. I read it some years ago but with big troubles in my private life and a year without any linux box, I may have forgotten more than I ever learned. >>> 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)))) May thanks again. I thought to remember something on the line of `num-to-str' but I had not begun my investigations so far. It will save me some hours. -- Le TeXnicien de Surface