bsmith@OSF.OSF.ORG (Bruce Smith) (06/07/89)
Hello!
This is probably not a bug; however, it is a question I need answered and can't
find the answer in your manual. Also, there is a lack of emacs experts around
here; most praise emacs and continue using vi. I am relatively new to Unix and
to OSF (today is my sixth day) and I would like to use emacs instead of vi.
Anyway, my question is: How do I leave a file that I have either made changes
to that I don't want to save or that I have made no changes to at all; I want to
quit the file without leaving emacs. Have I missed something obvious? Thank you.
Bruce Smith (bsmith@osf.org)ckd%bu-pub.BU.EDU@BU-IT.BU.EDU (06/07/89)
Date: Wed, 7 Jun 89 10:11:04 -0400 From: bsmith@osf.osf.org (Bruce Smith) Hello! This is probably not a bug; however, it is a question I need answered and can't find the answer in your manual. Also, there is a lack of emacs experts around here; most praise emacs and continue using vi. I am relatively new to Unix and to OSF (today is my sixth day) and I would like to use emacs instead of vi. Anyway, my question is: How do I leave a file that I have either made changes to that I don't want to save or that I have made no changes to at all; I want to quit the file without leaving emacs. Have I missed something obvious? Thank you. Bruce Smith (bsmith@osf.org) Won't C-x k (kill buffer) do that? --Chris
julian@uhccux.uhcc.hawaii.edu (Julian Cowley) (06/14/89)
This is slightly passe, but someone asked about how to abandon a
file after changes have been made to it. Normally C-x k
(kill-buffer) will do the trick, but if there is an auto-save
file associated with the buffer, the auto-save file stays around
after the buffer has been killed. Here is an Elisp function
that will delete the auto-save file at the time that you abandon
a buffer:
(defun kill-buffer-undo-auto-save (buf)
"One arg, a string or a buffer. Get rid of the specified buffer.
If the buffer is associated with a file and an auto-save file exists,
the auto-save file is deleted."
(interactive "bKill buffer: ")
(save-excursion
(set-buffer buf)
(let ((auto-save-file buffer-auto-save-file-name))
(kill-buffer buf)
(and (not (get-buffer buf))
auto-save-file
delete-auto-save-files
(condition-case ()
(delete-file auto-save-file)
(file-error nil))))))
Minor gripe dept: the return value from kill-buffer does not
indicate whether the buffer has actually been killed or not. If
kill-buffer returned t if the buffer has actually killed, the
above code could have been written by moving (kill-buffer buf)
into the `and' form, replacing the test for whether the buffer
still exists.
julian@uhccux.uhcc.hawaii.edu | "Hawaii has always been a very pivotal role
uunet!ucsd!nosc!uhccux!julian | in the Pacific. It is in the Pacific.
julian@uhccux.bitnet | It is part of the United States that is an
University of Hawaii at Manoa | island that is right here." - Quayle