[Top][All Lists]

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

Re: Offering the differences on exit

From: Mario Lang
Subject: Re: Offering the differences on exit
Date: Tue, 02 Jul 2002 22:25:47 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu)

address@hidden (Kim F. Storm) writes:

> 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).

I figure people might want to use ediff instead of external diff.
Also, when diff is available, I would like to remove C-r, as I never
used it really before.

> The following function may be useful here (it doesn't
> use a temp file, but maybe that's not portable diff
> behaviour):

shell-command-on-region uses make-tempfile AFAICS.

> (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 " -"))))

If it went as a built-in into emacs I'd prefer to be able to configure
the diff options.  Either use vc-cvs-diff-switches, or
ediff-custom-diff-options or some other variable.

>       (message "No file is associated with buffer"))))


reply via email to

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