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

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

Re: How to automatically increment an index array


From: Thien-Thi Nguyen
Subject: Re: How to automatically increment an index array
Date: Fri, 27 Jun 2008 09:52:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

() David Kastrup <dak@gnu.org>
() 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




reply via email to

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