all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: diff-autosaved
Date: Sat, 30 Apr 2011 10:57:11 +0200	[thread overview]
Message-ID: <4DBBCEE7.8030000@easy-emacs.de> (raw)

Hi,

occassionally want to compare a file with its auto-saved version.

Couldn't find a function doing this.
Tweaked diff-backup for the purpose.

The result:


(defun diff-autosaved (&optional switches)
   "Diff this file with its auto-saved version or vice versa.
With prefix arg, prompt for diff switches."
   (interactive (list (diff-switches)))
   (let ((dir default-directory)
         (file (file-name-nondirectory (replace-regexp-in-string "#" "" 
(buffer-file-name))))
         bak ori)
     (if (string-match "^#" file)
	(setq bak file
	      ori (replace-regexp-in-string "#" "" file))
       (setq bak (concat "#" file "#")
             ori file))
     (setq bak (concat dir bak))
     (setq ori (concat dir ori))
     (diff bak ori switches)))


Comments welcome.

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/components-python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/



             reply	other threads:[~2011-04-30  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-30  8:57 Andreas Röhler [this message]
2011-04-30  9:48 ` diff-autosaved Andrea Crotti
2011-04-30 10:03   ` diff-autosaved Andreas Röhler
2011-04-30 10:31     ` diff-autosaved Andrea Crotti
2011-04-30 10:30 ` diff-autosaved Andrea Crotti

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=4DBBCEE7.8030000@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@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.