all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
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: Mon, 12 Apr 2021 14:29:09 +0800	[thread overview]
Message-ID: <CAGP6POJUThi6dUTyaY5GGfJRCdjvr8oJSHVp1GPhkSz1CkJZZg@mail.gmail.com> (raw)
In-Reply-To: <87tuocfx5g.fsf@no.workgroup>

On Mon, Apr 12, 2021 at 3:18 AM Gregor Zattler <telegraph@gmx.net> wrote:
>
> 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.

Thank you so much for telling me this feature of Emacs.

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



  reply	other threads:[~2021-04-12  6:29 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 ` Fix the destroyed disk image partition table in a raw image file using Emacs Gregor Zattler
2021-04-12  6:29   ` Hongyi Zhao [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGP6POJUThi6dUTyaY5GGfJRCdjvr8oJSHVp1GPhkSz1CkJZZg@mail.gmail.com \
    --to=hongyi.zhao@gmail.com \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.