ediff-revision drives me nuts - I keep editing the latest revision

Skip Montanaro skip at pobox.com
Fri Mar 23 08:06:37 EDT 2007


Michael Kifer <kifer <at> cs.sunysb.edu> writes:

> I don't think this is the right solution.

Okay, this works for me as well.  Add an optional read-only attribute to
vc-version-other-window (normally ignored) and pass t from ediff-vc-internal.

Skip

*** /tmp/skipm/vc.el	Fri Mar 23 07:03:42 2007
--- /tmp/skipm/init.el	Fri Mar 23 07:03:42 2007
***************
*** 1,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-dired-mode
        (set-buffer (find-file-noselect (dired-get-filename))))
    (while vc-parent-buffer
--- 1,8 ----
! (defun vc-version-other-window (rev &optional read-only)
    "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): \ni")
    (if vc-dired-mode
        (set-buffer (find-file-noselect (dired-get-filename))))
    (while vc-parent-buffer
***************
*** 14,18 ****
  	     (filename (concat buffer-file-name ".~" version "~")))
  	 (or (file-exists-p filename)
  	     (vc-backend-checkout buffer-file-name nil version filename))
! 	 (find-file-other-window filename))
      (vc-registration-error buffer-file-name)))
--- 14,19 ----
  	     (filename (concat buffer-file-name ".~" version "~")))
  	 (or (file-exists-p filename)
  	     (vc-backend-checkout buffer-file-name nil version filename))
! 	 (find-file-other-window filename)
! 	 (setq buffer-read-only read-only))
      (vc-registration-error buffer-file-name)))

*** /tmp/skipm/ediff-vers.el	Fri Mar 23 07:04:37 2007
--- /tmp/skipm/init.el	Fri Mar 23 07:04:37 2007
***************
*** 9,20 ****
  	(setq rev1 (ediff-vc-latest-version (buffer-file-name))))
      (save-window-excursion
        (save-excursion
! 	(vc-version-other-window rev1)
  	(setq rev1buf (current-buffer)
  	      file1 (buffer-file-name)))
        (save-excursion
  	(or (string= rev2 "") 		; use current buffer
! 	    (vc-version-other-window rev2))
  	(setq rev2buf (current-buffer)
  	      file2 (buffer-file-name)))
        (setq startup-hooks
--- 9,20 ----
  	(setq rev1 (ediff-vc-latest-version (buffer-file-name))))
      (save-window-excursion
        (save-excursion
! 	(vc-version-other-window rev1 t)
  	(setq rev1buf (current-buffer)
  	      file1 (buffer-file-name)))
        (save-excursion
  	(or (string= rev2 "") 		; use current buffer
! 	    (vc-version-other-window rev2 t))
  	(setq rev2buf (current-buffer)
  	      file2 (buffer-file-name)))
        (setq startup-hooks




More information about the XEmacs-Beta mailing list