emacs-devel
[Top][All Lists]
Advanced

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

Re: Messy VC checkouts


From: Thien-Thi Nguyen
Subject: Re: Messy VC checkouts
Date: Mon, 21 Apr 2008 20:18:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

() Phil Hagelberg <address@hidden>
() Mon, 21 Apr 2008 10:20:48 -0700

   If this option doesn't currently exist in VC,
   how difficult would it be to add?

Not very.  One example is below.  Personally, i
bind `display-previous-revision' to `C-x v p'.

thi

____________________________________________
;;; display-previous-revision.el
;;;
;;; Copyright (C) 2004, 2007, 2008 Thien-Thi Nguyen
;;;
;;; This file is part of ttn's personal elisp library, released under
;;; the terms of the GNU General Public License as published by the
;;; Free Software Foundation; either version 3, or (at your option) any
;;; later version.  There is NO WARRANTY.  See file COPYING for details.
;;;
;;; Description: Display previous revision of a version-controlled file.

;;;###autoload
(defun display-previous-revision (file rev checkout-switches)
  "Display FILE revision REV w/ CHECKOUT-SWITCHES in a new buffer."
  (interactive "fFile: \nsRevision (symbolic ok): \nsCheckout switches: ")
  (let ((vc-checkout-switches (unless (string= "" checkout-switches)
                                checkout-switches)))
    (switch-to-buffer (vc-find-revision file (if (string-equal rev "")
                                                 (vc-working-revision file)
                                               rev))))
  (delete-file buffer-file-name)
  (string-match "~\\(.+\\)~$" buffer-file-name)
  (setq rev (match-string 1 buffer-file-name)
        buffer-file-name nil)
  (rename-buffer (format "*%s:%s*" (file-name-nondirectory file) rev)))

(provide 'display-previous-revision)

;;; display-previous-revision.el ends here





reply via email to

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