Hello
Another thing which drives me crazy with the new vc pkg (1.45 vs 1.4.1)
is the following:
The function vc-version-other-window of the file foo which under version
control generates and opens a file called say.
foo.~1.2~
I don't like this format and prefer much more
foo-rev-1.2
Now in 1.41 this was relatively easy:
The Original version of that function was:
--8<------------------------schnipp------------------------->8---
(defun vc-version-other-window (rev)
"Visit version REV of the current buffer in another window.
If the current buffer is named `F', the version is named `F.~REV~'.
If `F.~REV~' already exists, it is used instead of being re-created."
(interactive "sVersion to visit (default is latest version): ")
(if vc-old-dired-mode
(set-buffer (find-file-noselect (dired-get-filename))))
(while vc-old-parent-buffer
(pop-to-buffer vc-old-parent-buffer))
(if (and buffer-file-name (vc-old-name buffer-file-name))
(let* ((version (if (string-equal rev "")
(vc-old-latest-version buffer-file-name)
rev))
(filename (concat buffer-file-name ".~" version "~")))
(or (file-exists-p filename)
(vc-old-backend-checkout buffer-file-name nil version filename))
(find-file-other-window filename))
(vc-old-registration-error buffer-file-name)))
--8<------------------------schnapp------------------------->8---
So all I had to change was
(filename (concat buffer-file-name ".~" version "~")))
To
(filename (concat (file-name-sans-extension
buffer-file-name) "-rev-" version "." (file-name-extension
buffer-file-name))))
Now the new vc-version-other-window is shorter but calls a bunch of
functions which makes debugging sort of a pain.
--8<------------------------schnipp------------------------->8---
(defun vc-version-other-window (rev)
"Visit version REV of the current file in another window.
If the current file is named `F', the version is named `F.~REV~'.
If `F.~REV~' already exists, use it instead of checking it out again."
(interactive "sVersion to visit (default is workfile version): ")
(vc-ensure-vc-buffer)
(let* ((file buffer-file-name)
(version (if (string-equal rev "")
(vc-workfile-version file)
rev)))
(switch-to-buffer-other-window (vc-find-version file version))))
--8<------------------------schnapp------------------------->8---
--8<------------------------schnipp------------------------->8---
(defun vc-find-version (file version)
"Read VERSION of FILE into a buffer and return the buffer."
(let ((automatic-backup (vc-version-backup-file-name file version))
(filebuf (or (get-file-buffer file) (current-buffer)))
(filename (vc-version-backup-file-name file version 'manual)))
(unless (file-exists-p filename)
(if (file-exists-p automatic-backup)
(rename-file automatic-backup filename nil)
(message "Checking out %s..." filename)
(with-current-buffer filebuf
(let ((failed t))
(unwind-protect
(let ((coding-system-for-read 'no-conversion)
(coding-system-for-write 'no-conversion))
(with-temp-file filename
(let ((outbuf (current-buffer)))
;; Change buffer to get local value of
;; vc-checkout-switches.
(with-current-buffer filebuf
(vc-call find-version file version outbuf))))
(setq failed nil))
(if (and failed (file-exists-p filename))
(delete-file filename))))
(vc-mode-line file))
(message "Checking out %s...done" filename)))
(find-file-noselect filename)))
--8<------------------------schnapp------------------------->8---
Which seems to use (vc-version-backup-file-name file version)
etc etc.
Does anybody of you know how to change the format
vc-version-other-window???
thanks
Uwe Brauer
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta