git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: lists@haller-berlin.de (Stefan Haller)
To: patthoyts@gmail.com (Pat Thoyts)
Cc: paulus@samba.org (Paul Mackerras),
	git@vger.kernel.org (Git Mailing List)
Subject: Re: [PATCH] git-gui: bring Wish process to front on Mac
Date: Thu, 6 Jun 2013 19:12:07 +0200	[thread overview]
Message-ID: <1l424u5.uk987q18u3oxfM%lists@haller-berlin.de> (raw)
In-Reply-To: <CABNJ2G+h3zh+=wLA0KHjUn8TsfhqUK1Kn-1_=6hnXVRJUPhuuA@mail.gmail.com>

Pat Thoyts <patthoyts@gmail.com> wrote:

> On 6 June 2013 09:17, Stefan Haller <stefan@haller-berlin.de> wrote:
> > +## On Mac, bring the current Wish process window to front
> > +
> > +if {[tk windowingsystem] eq "aqua"} {
> > +       exec osascript -e [format {
> > +               tell application "System Events"
> > +                       set frontmost of processes whose unix id is %d to true
> > +               end tell
> > +       } [pid] ]
> > +}
> 
> Seems fine to me. I can't test this as I have no access to this
> platform. Possibly you should run this in a catch statement so it can
> ignore any errors and I would tend to use the 'auto_execok' command to
> ensure that osascript actually exists. Something like
> 
>   set arg [format {tell application......}]
>   catch {exec {*}[auto_execok osascript] -e $arg [pid]}
> 
> but possibly this is guaranteed to exist on all macs which would make
> the above redundant. What I'm thinking is you dont want the app to
> exit just because something goes wrong in this call.

I don't think we need auto_execok here, as osascript is available on
every Mac system. We might even specify the exact path, it's always
/usr/bin/osascript. Is that preferable?

I agree that "catch" might be a good idea though. It raises two
questions though:

1) Should we make the same change in gitk then? It already has the same
   code without the catch (released in 1.8.3 already, btw).

2) Should we think about some way of sharing code between gitk and
   git gui, so that these kinds of changes don't have to be made twice?


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/

  reply	other threads:[~2013-06-06 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06  8:17 Stefan Haller
2013-06-06 14:09 ` Pat Thoyts
2013-06-06 17:12   ` Stefan Haller [this message]
2013-06-07 21:56     ` [PATCH v2] " Stefan Haller
2013-06-14 17:54       ` Junio C Hamano
2013-06-15 23:07         ` Pat Thoyts
2013-06-06 18:15   ` [PATCH] " Junio C Hamano
2013-06-07 21:58     ` Stefan Haller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1l424u5.uk987q18u3oxfM%lists@haller-berlin.de \
    --to=lists@haller-berlin.de \
    --cc=git@vger.kernel.org \
    --cc=patthoyts@gmail.com \
    --cc=paulus@samba.org \
    --subject='Re: [PATCH] git-gui: bring Wish process to front on Mac' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).