emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Offering the differences on exit


From: Kim F. Storm
Subject: Re: Offering the differences on exit
Date: 02 Jul 2002 22:47:09 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Mario Lang <address@hidden> 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 <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]