From: Don Armstrong Date: Mon, 22 Jun 2015 21:27:16 +0000 (-0700) Subject: use X if it exists X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b485292a468461e6d2b2176c4c3c5caddb4ddae5;p=bin.git use X if it exists --- diff --git a/remember_mail b/remember_mail index eaf662c..08d65e2 100755 --- a/remember_mail +++ b/remember_mail @@ -20,4 +20,10 @@ my $from = $msg->head->get('from') || ""; chomp ($subject, $from); my $note_body = uri_escape(" Subject: $subject\n From: $from"); -exec "emacsclient", "-t", "org-protocol://capture://m/mutt:$mid/mail/$note_body"; +my @EMACS_OPTS; +if (defined $ENV{DISPLAY} and length($ENV{DISPLAY})) { + @EMACS_OPTS = qw(-c) +} else { + @EMACS_OPTS = qw(-t) +} +exec "emacsclient", @EMACS_OPTS, "org-protocol://capture://m/mutt:$mid/mail/$note_body";