tags:

views:

39

answers:

2

I would like to see examples of how to setup perforce, using the config file functionality where emacs is used as the diff and merge programs (P4DIFF and P4MERGE settings). Even better if this is on Windows.

I'm also struggling with getting the P4EDITOR to work correctly when using emacsclientw, specifically specifying the alternate-editor functionality.

Any tips, suggestions, example configs are very welcome.

+1  A: 
Eric Warmenhoven
Thanks Eric - I'm not actually using p4.el at the moment. Been trying to use p4 more from the command line instead of p4v so just went to PS instead of emacs - now that you say it, I probably should have stayed in emacs.
cristobalito
Also, thanks for the script. Loads of info. Unfortunately, I'm not using cygwin these days, as I've migrated to powershell, but I might try to adapt your script to a powershell one.
cristobalito
+1  A: 

Here's a different trick I used to use. It adds a few command line options to emacs so that you can do diffs and merges in a new emacs instance (again using ediff).

;; -diff
(defun command-line-diff (switch)
  (let ((file1 (pop command-line-args-left))
        (file2 (pop command-line-args-left)))
    (ediff file1 file2)))
(add-to-list 'command-switch-alist '("-diff" . command-line-diff))

;; -merge
(defun command-line-merge (switch)
  (let ((base (pop command-line-args-left))
        (sccs (pop command-line-args-left))
        (mine (pop command-line-args-left))
        (merg (pop command-line-args-left)))
   (ediff-merge-with-ancestor sccs mine base () merg)))
(add-to-list 'command-switch-alist '("-merge" . command-line-merge))

Just put that in your .emacs file. Then you can set your P4DIFF program to be emacs -diff and your P4MERGE program to be emacs -merge.

Eric Warmenhoven
Awesome - I'd seen reference to emacs -diff before but nothing about how to do it.
cristobalito