From b485292a468461e6d2b2176c4c3c5caddb4ddae5 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 22 Jun 2015 14:27:16 -0700 Subject: [PATCH] use X if it exists --- remember_mail | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"; -- 2.39.5