unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to automatically increment an index array
Date: Fri, 27 Jun 2008 09:52:53 +0200	[thread overview]
Message-ID: <87ej6j1fhm.fsf@ambire.localdomain> (raw)
In-Reply-To: <858wwrfk1w.fsf@lola.goethe.zz> (David Kastrup's message of "Fri,  27 Jun 2008 08:50:35 +0200")

() 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	other threads:[~2008-06-27  7:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.13859.1214468323.18990.help-gnu-emacs@gnu.org>
2008-06-26 11:47 ` How to automatically increment an index array Rupert Swarbrick
2008-06-26 11:52   ` Rupert Swarbrick
2008-06-27  2:44 ` Xah
2008-06-27  6:50   ` David Kastrup
2008-06-27  7:52     ` Thien-Thi Nguyen [this message]
     [not found]     ` <mailman.13886.1214553354.18990.help-gnu-emacs@gnu.org>
2008-06-27  8:19       ` David Kastrup
2008-06-27  7:23 ` Klaus Zeitler
2008-06-26  7:45 Francis Moreau
2008-06-26 12:51 ` Peter Dyballa
2008-06-27  8:47 ` David

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=87ej6j1fhm.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=help-gnu-emacs@gnu.org \
    /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).