cnd
cnd

Reputation: 33744

How to not save changes in file (And in temp buffer too!)?

Must be stupid question but for some time using Emacs I have no idea how can I to not apply my changes...

When I quit C x C c it tells me :

So here is some chances to not save changes : n or q but there is always saving buffer of current stage :(

I mean for example when I break some file by adding random text there and I don't want to save changes I want to start edit next time not-saved (not broken) file but Emacs is always opening saved buffer :( How to solve it?

Upvotes: 1

Views: 379

Answers (1)

event_jr
event_jr

Reputation: 17707

Your phrasing of the question is very confusing. I think you want to add revert to the list of options offered? This code adds , for revert and % to mark buffer as not modified:

(when (boundp 'save-some-buffers-action-alist)
  (setq save-some-buffers-action-alist
        (cons
         (list
          ?%
          #'(lambda (buf)
              (with-current-buffer buf
                (set-buffer-modified-p nil))
              nil)
          "mark buffer unmodified.")
         (cons
          (list
           ?, 
           #'(lambda (buf)
               (with-current-buffer buf
                 (revert-buffer t))
               nil)
           "revert buffer.")
          save-some-buffers-action-alist))))

Upvotes: 6

Related Questions