Loading ...
Sorry, an error occurred while loading the content.

[patch] :undorecover command

Expand Messages
  • Christian Brabandt
    Bram, here is a patch, containing an :undorecover command that has been requested before. If you apply this patch and use :undorecover on existing undofiles,
    Message 1 of 10 , Mar 4, 2014
    • 0 Attachment
      Bram,

      here is a patch, containing an :undorecover command that has been
      requested before. If you apply this patch and use :undorecover on
      existing undofiles, it will simply read in the undo structure.

      But by itself this isn't really useful, as one probably ends up with
      only many small pieces of the original file and most probably not the
      complete file contents. But at least one can traverse the undo structure
      and see if one can at least recover parts of the file.

      Newly written undofiles will therefore at least contain one complete
      buffer content at the time the undofile is written and no complete
      buffer content has been recorded yet. When using those undofiles
      together with :undorecover one will jump to that state in the undo tree
      and from there one can try to recover parts of the file.

      But even then, if one has many undo branches, there will be most likely
      branches, that are not recoverable, because the undo information does
      not contains information to recover from that initial state.

      Therefore, this patch also adds an 'undosavebuf' option (off by default)
      which when on, will always save the complete buffer in the undo tree
      whenever the undofile is written. This possibly makes the undo tree (and
      undofile) a lot larger, but the user should be able to recover different
      states pretty easily.

      Best,
      Christian

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Thanks. Setting that undosavebuf sounds a bit dangerous... If I understand it correctly, the user will have to go forward and backward in the undo tree
      Message 2 of 10 , Mar 7, 2014
      • 0 Attachment
        Christian Brabandt wrote:

        > here is a patch, containing an :undorecover command that has been
        > requested before. If you apply this patch and use :undorecover on
        > existing undofiles, it will simply read in the undo structure.
        >
        > But by itself this isn't really useful, as one probably ends up with
        > only many small pieces of the original file and most probably not the
        > complete file contents. But at least one can traverse the undo structure
        > and see if one can at least recover parts of the file.
        >
        > Newly written undofiles will therefore at least contain one complete
        > buffer content at the time the undofile is written and no complete
        > buffer content has been recorded yet. When using those undofiles
        > together with :undorecover one will jump to that state in the undo tree
        > and from there one can try to recover parts of the file.
        >
        > But even then, if one has many undo branches, there will be most likely
        > branches, that are not recoverable, because the undo information does
        > not contains information to recover from that initial state.
        >
        > Therefore, this patch also adds an 'undosavebuf' option (off by default)
        > which when on, will always save the complete buffer in the undo tree
        > whenever the undofile is written. This possibly makes the undo tree (and
        > undofile) a lot larger, but the user should be able to recover different
        > states pretty easily.

        Thanks. Setting that 'undosavebuf' sounds a bit dangerous...

        If I understand it correctly, the user will have to go forward and
        backward in the undo tree to find useful text. And there will be many
        versions of the same line. Perhaps it's possible to be more clever and
        just start with buffer with empty lines, and go through history in a way
        one ends up with the last known state of each line? I know this isn't
        easy, but it should be possible.

        Also, this is difficult to test with something under src/testdir. It's
        probably more suited for a unittest like memfile_test.c does.

        --
        "When I die, I want a tombstone that says "GAME OVER" - Ton Richters

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Christian Brabandt
        Bram, ... Okay, I ll look into it. Best, Christian -- Die Katholiken Terrorisieren das Land mit einer Auffassung vom Wesen der Ehe, die die ihre ist und die
        Message 3 of 10 , Mar 7, 2014
        • 0 Attachment
          Bram,

          On Fr, 07 Mär 2014, Bram Moolenaar wrote:

          >
          > Christian Brabandt wrote:
          >
          > > here is a patch, containing an :undorecover command that has been
          > > requested before. If you apply this patch and use :undorecover on
          > > existing undofiles, it will simply read in the undo structure.
          > >
          > > But by itself this isn't really useful, as one probably ends up with
          > > only many small pieces of the original file and most probably not the
          > > complete file contents. But at least one can traverse the undo structure
          > > and see if one can at least recover parts of the file.
          > >
          > > Newly written undofiles will therefore at least contain one complete
          > > buffer content at the time the undofile is written and no complete
          > > buffer content has been recorded yet. When using those undofiles
          > > together with :undorecover one will jump to that state in the undo tree
          > > and from there one can try to recover parts of the file.
          > >
          > > But even then, if one has many undo branches, there will be most likely
          > > branches, that are not recoverable, because the undo information does
          > > not contains information to recover from that initial state.
          > >
          > > Therefore, this patch also adds an 'undosavebuf' option (off by default)
          > > which when on, will always save the complete buffer in the undo tree
          > > whenever the undofile is written. This possibly makes the undo tree (and
          > > undofile) a lot larger, but the user should be able to recover different
          > > states pretty easily.
          >
          > Thanks. Setting that 'undosavebuf' sounds a bit dangerous...
          >
          > If I understand it correctly, the user will have to go forward and
          > backward in the undo tree to find useful text. And there will be many
          > versions of the same line. Perhaps it's possible to be more clever and
          > just start with buffer with empty lines, and go through history in a way
          > one ends up with the last known state of each line? I know this isn't
          > easy, but it should be possible.
          >
          > Also, this is difficult to test with something under src/testdir. It's
          > probably more suited for a unittest like memfile_test.c does.

          Okay, I'll look into it.

          Best,
          Christian
          --
          Die Katholiken Terrorisieren das Land mit einer Auffassung vom Wesen
          der Ehe, die die ihre ist und die uns nichts angeht.
          -- Kurt Tucholsky

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Christian Brabandt
          Bram, On Fr, 07 Mär 2014, Christian Brabandt wrote: [new :undorecover command] Attached is a new patch. It works by restoring each line to the last known
          Message 4 of 10 , Mar 12, 2014
          • 0 Attachment
            Bram,

            On Fr, 07 Mär 2014, Christian Brabandt wrote:
            [new :undorecover command]

            Attached is a new patch. It works by restoring each line to the last
            known state, which means, the recovered buffer might be inconsistent,
            since you basically end up with a mix of undo states.

            Secondly, on any undofile that was written with a non-patched Vim, it
            will probably only restore the buffer partly. From the undofile of my
            .vimrc (currently containing 402 lines with many lines empty or
            commented out) I could recover 50 lines (with about 450 empty lines in
            between).

            Therefore this patch makes Vim store one complete buffer content in the
            undofile, so recovery will be more useful.

            Bram wrote:
            > > Also, this is difficult to test with something under src/testdir. It's
            > > probably more suited for a unittest like memfile_test.c does.

            Not sure, how about to do that currently, so I am skipping this part for
            now.

            Best,
            Christian

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... Thanks. I ll have a look at it later. ... OK, but we should have some tests before including this patch. -- Living on Earth includes an annual free trip
            Message 5 of 10 , Mar 12, 2014
            • 0 Attachment
              Christian Brabandt wrote:

              > Bram,
              >
              > On Fr, 07 Mär 2014, Christian Brabandt wrote:
              > [new :undorecover command]
              >
              > Attached is a new patch. It works by restoring each line to the last
              > known state, which means, the recovered buffer might be inconsistent,
              > since you basically end up with a mix of undo states.
              >
              > Secondly, on any undofile that was written with a non-patched Vim, it
              > will probably only restore the buffer partly. From the undofile of my
              > .vimrc (currently containing 402 lines with many lines empty or
              > commented out) I could recover 50 lines (with about 450 empty lines in
              > between).
              >
              > Therefore this patch makes Vim store one complete buffer content in the
              > undofile, so recovery will be more useful.

              Thanks. I'll have a look at it later.

              > Bram wrote:
              > > > Also, this is difficult to test with something under src/testdir. It's
              > > > probably more suited for a unittest like memfile_test.c does.
              >
              > Not sure, how about to do that currently, so I am skipping this part for
              > now.

              OK, but we should have some tests before including this patch.

              --
              Living on Earth includes an annual free trip around the Sun.

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Christian Brabandt
              ... Updated patch attached (adjusted for patch 7.4.399). Best, Christian -- Der Fortgang der wissenschaftlichen Entwicklung ist im Endeffekt eine ständige
              Message 6 of 10 , Aug 16, 2014
              • 0 Attachment
                On Mi, 12 Mär 2014, Bram Moolenaar wrote:
                >
                > Christian Brabandt wrote:
                >
                > > Bram,
                > >
                > > On Fr, 07 Mär 2014, Christian Brabandt wrote:
                > > [new :undorecover command]
                > >
                > > Attached is a new patch. It works by restoring each line to the last
                > > known state, which means, the recovered buffer might be inconsistent,
                > > since you basically end up with a mix of undo states.
                > >
                > > Secondly, on any undofile that was written with a non-patched Vim, it
                > > will probably only restore the buffer partly. From the undofile of my
                > > .vimrc (currently containing 402 lines with many lines empty or
                > > commented out) I could recover 50 lines (with about 450 empty lines in
                > > between).
                > >
                > > Therefore this patch makes Vim store one complete buffer content in the
                > > undofile, so recovery will be more useful.
                >
                > Thanks. I'll have a look at it later.

                Updated patch attached (adjusted for patch 7.4.399).


                Best,
                Christian
                --
                Der Fortgang der wissenschaftlichen Entwicklung ist im Endeffekt eine
                ständige Flucht vor dem Staunen.
                -- Albert Einstein

                --
                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                ---
                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Bram Moolenaar
                ... Thanks! -- hundred-and-one symptoms of being an internet addict: 29. Your phone bill comes to your doorstep in a box. /// Bram Moolenaar --
                Message 7 of 10 , Aug 16, 2014
                • 0 Attachment
                  Christian Brabandt wrote:

                  > On Mi, 12 Mär 2014, Bram Moolenaar wrote:
                  > >
                  > > Christian Brabandt wrote:
                  > >
                  > > > Bram,
                  > > >
                  > > > On Fr, 07 Mär 2014, Christian Brabandt wrote:
                  > > > [new :undorecover command]
                  > > >
                  > > > Attached is a new patch. It works by restoring each line to the last
                  > > > known state, which means, the recovered buffer might be inconsistent,
                  > > > since you basically end up with a mix of undo states.
                  > > >
                  > > > Secondly, on any undofile that was written with a non-patched Vim, it
                  > > > will probably only restore the buffer partly. From the undofile of my
                  > > > .vimrc (currently containing 402 lines with many lines empty or
                  > > > commented out) I could recover 50 lines (with about 450 empty lines in
                  > > > between).
                  > > >
                  > > > Therefore this patch makes Vim store one complete buffer content in the
                  > > > undofile, so recovery will be more useful.
                  > >
                  > > Thanks. I'll have a look at it later.
                  >
                  > Updated patch attached (adjusted for patch 7.4.399).

                  Thanks!

                  --
                  hundred-and-one symptoms of being an internet addict:
                  29. Your phone bill comes to your doorstep in a box.

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ an exciting new programming language -- http://www.Zimbu.org ///
                  \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                  --
                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • 'Andy Wokula' via vim_dev
                  Am 16.08.2014 21:25, schrieb Christian Brabandt: The command is named :undorecover ? Some places use :undorecovery (help, EMSG). -- Andy -- -- You received
                  Message 8 of 10 , Aug 20, 2014
                  • 0 Attachment
                    Am 16.08.2014 21:25, schrieb Christian Brabandt:

                    The command is named ":undorecover"?
                    Some places use ":undorecovery" (help, EMSG).

                    --
                    Andy

                    --
                    --
                    You received this message from the "vim_dev" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  • Christian Brabandt
                    ... The command is called :undorecover, but the process of doing so is undorecovery, isn t it? Best, Christian -- -- You received this message from the
                    Message 9 of 10 , Aug 20, 2014
                    • 0 Attachment
                      Am 2014-08-20 19:03, schrieb 'Andy Wokula' via vim_dev:
                      > Am 16.08.2014 21:25, schrieb Christian Brabandt:
                      >
                      > The command is named ":undorecover"?
                      > Some places use ":undorecovery" (help, EMSG).

                      The command is called :undorecover, but the process of
                      doing so is undorecovery, isn't it?

                      Best,
                      Christian

                      --
                      --
                      You received this message from the "vim_dev" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_dev" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                      For more options, visit https://groups.google.com/d/optout.
                    • Christian Brabandt
                      Hi, Here is another update, that allows to undo the undorecover command and should work better in case of errors. Best, Christian -- Ich mache mir immer
                      Message 10 of 10 , Aug 22, 2014
                      • 0 Attachment
                        Hi,
                        Here is another update, that allows to 'undo' the undorecover command
                        and should work better in case of errors.

                        Best,
                        Christian
                        --
                        Ich mache mir immer Vorwürfe, daß meine Malerei nicht wert ist, was
                        sie kostet.
                        -- Vincent Willem van Gogh

                        --
                        --
                        You received this message from the "vim_dev" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_dev" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/d/optout.
                      Your message has been successfully submitted and would be delivered to recipients shortly.