From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: How to automatically increment an index array Date: Fri, 27 Jun 2008 09:52:53 +0200 Message-ID: <87ej6j1fhm.fsf@ambire.localdomain> References: <9a68abc5-f2c8-4b83-a661-af134cf1519a@h1g2000prh.googlegroups.com> <858wwrfk1w.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1214553431 29842 80.91.229.12 (27 Jun 2008 07:57:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Jun 2008 07:57:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 27 09:57:56 2008 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 1KC8pO-0001f8-3k for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Jun 2008 09:57:06 +0200 Original-Received: from localhost ([127.0.0.1]:47866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KC8oX-0001En-C1 for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Jun 2008 03:56:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KC8oC-0001EA-9y for help-gnu-emacs@gnu.org; Fri, 27 Jun 2008 03:55:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KC8oA-0001Df-I4 for help-gnu-emacs@gnu.org; Fri, 27 Jun 2008 03:55:52 -0400 Original-Received: from [199.232.76.173] (port=43210 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KC8oA-0001Da-FZ for help-gnu-emacs@gnu.org; Fri, 27 Jun 2008 03:55:50 -0400 Original-Received: from [151.61.140.41] (port=49820 helo=ambire.localdomain) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KC8o9-0001gz-Mn for help-gnu-emacs@gnu.org; Fri, 27 Jun 2008 03:55:50 -0400 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1KC8lJ-0001N8-HX for help-gnu-emacs@gnu.org; Fri, 27 Jun 2008 09:52:53 +0200 In-Reply-To: <858wwrfk1w.fsf@lola.goethe.zz> (David Kastrup's message of "Fri, 27 Jun 2008 08:50:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:55108 Archived-At: () David Kastrup () Fri, 27 Jun 2008 08:50:35 +0200 Well, one could write something like C-M-% \[0x\([0-9a-f]+\)\] RET \,(format "[%08x]" (+ (* 4 (string-to-number \1 16)) #X8745b400)) RET It is not all too pretty, but not all too bad either. If the pattern of the numbers is regular, you might use \# in the replacement rather than an explicit conversion. Although the general approach is sound, in this case the #x8745b400 will be silently truncated on a 32-bit host. To workaround, one can hardformat the high hex digits: (format "[8745%04x]" (... #xb400)) Munge to taste... thi