From: Gregor Zattler <telegraph@gmx.net>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Fix the destroyed disk image partition table in a raw image file using Emacs.
Date: Sun, 11 Apr 2021 21:18:03 +0200 [thread overview]
Message-ID: <87tuocfx5g.fsf@no.workgroup> (raw)
In-Reply-To: <CAGP6POL0ynTnvtFFoV_Gb2ePeAAgTBDfYAVdNrTnZv+QSYdcVA@mail.gmail.com>
Hi Hongyi Zhao,
* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-04-11; 21:34]:
> $ dd if=disk.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An
> 761b36b0
>
> It's well known that Emacs is an 8-bit clean editor which makes it
> safe to edit binary files. So, I want to whether I can fix the above
> destroyed disk image file with Emacs for my scenario.
If your emacs is able to handle the disk image in memory
(which probably means you need a 64bit emacs and enough RAM
installed) you could open the file of the disk image with
find-file-literally
Visit file FILENAME with no conversion of any kind.
Format conversion and character code conversion are both
disabled, and multibyte characters are disabled in the
resulting buffer. The major mode used is Fundamental
mode regardless of the file name, and local variable
specifications in the file are ignored. Automatic
uncompression and adding a newline at the end of the file
due to require-final-newline is also disabled.
And then the first thing to do would be
binary-overwrite-mode
When Binary Overwrite mode is enabled, printing
characters typed in replace existing text. Newlines are
not treated specially, so typing at the end of a line
joins the line to the next, with the typed character
between them. Typing before a tab character simply
replaces the tab with the character typed. C-q replaces
the text at the cursor, just as ordinary typing
characters do.
You then can move point in the disk image to the desired
place and type in whatever you want and later save the
buffer to its file.
Ciao; Gregor
--
-... --- .-. . -.. ..--.. ...-.-
next prev parent reply other threads:[~2021-04-11 19:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 13:34 Fix the destroyed disk image partition table in a raw image file using Emacs Hongyi Zhao
2021-04-11 13:39 ` Jean Louis
2021-04-11 17:26 ` Dan Hitt
2021-04-11 18:45 ` tomas
2021-04-11 19:56 ` Dan Hitt
2021-04-11 20:58 ` Stefan Monnier
2021-04-11 21:15 ` GNU ELPA problem (was: Re: Fix the destroyed disk image partition table in a raw image file using Emacs.) Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-11 19:18 ` Gregor Zattler [this message]
2021-04-12 6:29 ` Fix the destroyed disk image partition table in a raw image file using Emacs Hongyi Zhao
2021-04-15 14:16 ` Hongyi Zhao
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=87tuocfx5g.fsf@no.workgroup \
--to=telegraph@gmx.net \
--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).