From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Bell Subject: Re: Re: Preventing (or mitigating) accidental deletion in org-mode Date: Sun, 23 Aug 2009 13:59:22 +0100 Message-ID: <4A913D2A.40003@nickbell.org> References: <4A9120DB.6030003@nickbell.org> <4A9135CC.1050709@nickbell.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfCfR-0001qg-IH for emacs-orgmode@gnu.org; Sun, 23 Aug 2009 08:59:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfCfQ-0001qI-Mm for emacs-orgmode@gnu.org; Sun, 23 Aug 2009 08:59:29 -0400 Received: from [199.232.76.173] (port=56717 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfCfO-0001q2-VV for emacs-orgmode@gnu.org; Sun, 23 Aug 2009 08:59:27 -0400 Received: from v-smtp-auth-relay-3.gradwell.net ([79.135.125.42]:53115) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfCfO-0008Tf-9P for emacs-orgmode@gnu.org; Sun, 23 Aug 2009 08:59:26 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Leo Cc: emacs-orgmode@gnu.org Leo wrote: > On 2009-08-23 13:27 +0100, Nick Bell wrote: >> I'm trying to write a little function using before-save-hook to >> compare the current buffer to the saved version and output the result >> of diffstat, asking the user whether they want to go ahead with the >> save or view the full diff. Or has someone done something like this >> before? > > See diff-buffer-with-file. Yes, that was the idea. I was going to hook a function into before-save-hook which does pipe diff -u $1 $2 | diffstat and show the result in some kind of minibuffer. Not sure how to set $1 and $2 (in fact, I've never written any elisp at all). I don't suppose anyone could whip up the code in a moment or two? ;-) Nick -- Nick Bell