I looked up the manual, and it says that the history in a buffer is stored in buffer-undo-list variable. I printed out this variable to see what the contents are, but they don't seem to be making much sense to me.

This is the basic functionality I am after: At any given point, I want to be able to see the old state of the document (I figured I could somehow piece together the document from the history, but I am getting quite bamboozled in this effort).

I am quite new to elisp, any help would be appreciated, thanks. (I know, there is the possibility that my whole approach to this is wrong.)

EDIT: I think I was kind of unclear as to what I wanted. My requirement is basically having a snapshot of the file, at every change. For instance, I have a file that says "Hello world!", and then I write after that "Hello beautiful world!", I want to be able to have both versions of the file somehow. Is this possible? Like, auto save the file on every change in the file, but auto save to a new file every time.

  • The description of buffer-undo-list (type C-h v and enter buffer-undo-list at the prompt) tells you about the contents of buffer-undo-list which may help. I am not sure what you want to be able to do. Cursory reading suggests that the only timestamp in this data is at the beginning which is annoying if you want to step backwards by units of time. – Aidan Schofield Jun 28 at 13:52
  • The question is not too clear, to me. Are you after the history of changes in the buffer since its last save or auto-save? If so, that's undo information. Or are you after the auto-save file (#...#)? Or are you after a backup file? I don't think you're asking about minibuffer input histories (tag history-variables), at least. – Drew Jun 28 at 15:48
  • buffer-undo-list does contain "the buffer's history", so please clarify exactly what you're looking for, e.g. giving an example. Otherwise we're limited to stabs in the dark: vc-print-log? undo-tree? – Stefan Jun 29 at 21:32
  • "For instance, I have a file that says "Hello world!", and then I write after that "Hello beautiful world!"" -- how many different versions is that? Two? Eleven? (assuming you typed the extra word manually). What are the rules? – phils Jun 30 at 23:41
  • 1
    The rules could be anything right (maybe everytime he/she presses enter for instance). I think for now I am going to use a git based approach. – NobleSiks Jul 3 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.