From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: Offering the differences on exit
Date: 02 Jul 2002 22:47:09 +0200 [thread overview]
Message-ID: <5x1yalg8mq.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <87k7oedk2b.fsf@lexx.delysid.org>
Mario Lang <mlang@delysid.org> writes:
> One feature I miss since I tried out Emacs the first time
> is the ability to see a diff when you are asked if you want to
> save changed you've made.
I agree this would be extremely useful.
However, I would prefer if this was built-in as a default option in
save-some-buffers.
In that case, I don't see a great need for the more general approach
you have taken with the save-some-buffers-action-alist (although it
might have other uses).
The following function may be useful here (it doesn't
use a temp file, but maybe that's not portable diff
behaviour):
(defun diff-buffer-to-visited-file (&optional buffer)
(interactive "bBuffer: ")
(setq buffer (get-buffer (or buffer (current-buffer))))
(let ((file (buffer-file-name buffer)))
(if file
(with-current-buffer buffer
(save-restriction
(widen)
(shell-command-on-region (point-min) (point-max)
(concat "diff -c " file " -"))))
(message "No file is associated with buffer"))))
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2002-07-02 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-02 19:08 Offering the differences on exit Mario Lang
2002-07-02 20:47 ` Kim F. Storm [this message]
2002-07-02 20:25 ` Mario Lang
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=5x1yalg8mq.fsf@kfs2.cua.dk \
--to=storm@cua.dk \
--cc=emacs-devel@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.