Jump to content


Return focus to terminal session after invoking P4Merge from command line

p4merge shim p4

  • Please log in to reply
6 replies to this topic

#1 Gabor Maghera

Gabor Maghera

    Advanced Member

  • Sandbox Beta
  • PipPipPip
  • 192 posts
  • LocationElk Grove, CA

Posted 17 April 2015 - 06:28 PM

I prefer to use the command line client for most of my Perforce work, but when resolving integrations P4Merge is very helpful.  I'm using the recommendation in a kb article to bridge the P4 client with P4Merge.  It works very well, but when I exit P4Merge, I have to manually switch back to the terminal to resume my p4 work.  For P4EDITOR I'm using something (specific to MacVim) which automates the switching back to the terminal:

P4EDITOR=mvim -f --nomru -c "au VimLeave * !open -a iTerm"

Does anyone know of a way to do this with P4Merge?
--
Gabor

#2 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 01 May 2015 - 12:46 AM

Hi Gabor,

Have you tried the suggestions on how to configure P4EDITOR in this KB article here?

http://answers.perfo...rticles/KB/2987

Try the suggested examples using the -W flag.

-W tells open to wait for your text editor to quit. If not specified the editor would open, but control would be returned to Perforce and you will see the "{specification type} not changed" message in the terminal.

#3 Gabor Maghera

Gabor Maghera

    Advanced Member

  • Sandbox Beta
  • PipPipPip
  • 192 posts
  • LocationElk Grove, CA

Posted 01 May 2015 - 05:32 PM

Hi Shimada,

Thank you for the response.  Do you think this will work for P4MERGE too?  The Perforce kb article I linked in my original posting instructs the user to specify a "shim" in the P4MERGE environment variable, a wrapper shell script which calls the OS X app P4Merge.  It looks like the info in the article you have referenced might obsolete the need for a shim.
--
Gabor

#4 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 05 May 2015 - 11:58 PM

Hi Gabor,

Since you had existing settings for P4EDITOR, I was suggesting to try the suggested examples using the -W flag in KB 2987 in case that helped. I do not have a Mac OS right off hand to test on but you can try the different setting and can always remove it if it is not doing what you need.

#5 Gabor Maghera

Gabor Maghera

    Advanced Member

  • Sandbox Beta
  • PipPipPip
  • 192 posts
  • LocationElk Grove, CA

Posted 07 May 2015 - 11:44 PM

With your suggestion, I was able to get P4MERGE to work without the "shim":

P4MERGE=open -W -n -a P4Merge --args $*

Unfortunately it suffers from the same problem still.  With both approaches (using the shim, or using the open command), focus is not returned to the original application, my terminal, if it is in full screen mode.  Maybe this is an issue with OS X apps running full screen in general.

In any case, this alternate solution you lead me to is simpler than the shim approach I was using before.  Thank you, Shimada!
--
Gabor

#6 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 20 May 2015 - 10:39 PM

You're welcome, Gabor! Glad it helped somewhat. :-)

#7 Gabor Maghera

Gabor Maghera

    Advanced Member

  • Sandbox Beta
  • PipPipPip
  • 192 posts
  • LocationElk Grove, CA

Posted 30 July 2015 - 12:20 PM

Oh, okay. Thanks, Shimada. I was showing P4EDITOR as an example of calling
an app from p4 and returning focus to it. But I'm really after calling the
P4Merge app from p4 and then returning focus to it, during the resolution
of integrations. I do have a sense that suggestions for P4EDITOR might work
with P4MERGE (the env variable not the app), too.
On Tue, May 5, 2015 at 5:00 PM P4Shimada <
perforce-user-forum@forums.perforce.com> wrote:

Quote


Posted on behalf of forum user 'P4Shimada'.

Hi Gabor,

Since you had existing settings for P4EDITOR, I was suggesting to try
thesuggested examples using the -W flag in KB 2987 in case that helped. I
do not
have a Mac OS right off hand to test on but you can try the different
setting
and can always remove it if it is not doing what you need.



--
Please click here to see the post in its original format:

http://forums.perfor...om-command-line
_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user

_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user


--
Gabor





Also tagged with one or more of these keywords: p4merge, shim, p4

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users