From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OocEG6qB4mCYCAEAgWs5BA (envelope-from ) for ; Mon, 05 Jul 2021 05:51:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id t00SFqqB4mCveAAA1q6Kng (envelope-from ) for ; Mon, 05 Jul 2021 03:51:06 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9A58927EA0 for ; Mon, 5 Jul 2021 05:51:05 +0200 (CEST) Received: from localhost ([::1]:43938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0FdQ-00042V-FG for larch@yhetil.org; Sun, 04 Jul 2021 23:51:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0Fcs-00042G-Il for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 23:50:30 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:40458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0Fcq-0000ni-5g for emacs-orgmode@gnu.org; Sun, 04 Jul 2021 23:50:30 -0400 Received: by mail-pf1-x42d.google.com with SMTP id j199so15114544pfd.7 for ; Sun, 04 Jul 2021 20:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=c6L1vXSfSX+Oz5yEo6Ywos2UzQ/tprH6Qpgyfk9c09Y=; b=eHI4h7Vx5JIcOiWoSMAaNiYOJN8MERY8NzprdSOyOC95RisiwakOuH/ivgHKxPo7I4 UbWxr7DGSQAkXh2pfFwyrmhrGMgn/CRGRxcdDqw20HqOBwesSt6vWl7vApRKIhBaQwUo 3eFsuPhZYrBGfjxDESDVZwG5W6QbyMI/DOutVI9jGawkcqTAcJcmMUMuWOxO/R8fNeHe TlB1WrTb0Vmw7tZR5V4y5l8CHyP71GghNS0mYSJitHq9HKbXuZf5GR+NWPPARiUjEy+q 2DBHhp91wzCdV5jln9RLTx8fK4Q2Wm6FeS9Q48hPZoZKJW54ZlewCygzcqNXu/8waB0b fIBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=c6L1vXSfSX+Oz5yEo6Ywos2UzQ/tprH6Qpgyfk9c09Y=; b=YYggr5+synT8AWbpWbTlBMHN+i59TbZkkNdN3K9Lvpt7hNbrqtskMrJ9DI89fdoL0+ WsQH0eSZtqti2Q1m0vbSTWMbYGnvsErlBS/LvG7KtdG0r3JEwXR4hdXrgn2+6N6/if/m emhgs31KPQPn+Oa+4tH7KMmN80hTo2tLbHHQRta67VV/hIqETtzlJYoHjk4ctocuNJ+C ZccmOzZWRH0HZxMx6TEXz9yOi4IaO+Usy6p8C57Yu1h+s5ca8Ztc9xBFHHsX8pMmg8FM XYQxmSBKlc0qN2beEAyf8TMeo/3c/4eGHfr+uX8RZB1b4ngUAOhixydc0VoNIdECthk0 836w== X-Gm-Message-State: AOAM532H5+H+JupMrkrXcjZ2DlbGNbYdUz6uEi21Wajdnf3/wCw65EkL LsLbWxBknVRi+sTkPVfacQ== X-Google-Smtp-Source: ABdhPJwGCgIhA4zqk19+JJqnRol/3hyC3Ka1bOCYm8pO5BQeeISI07mkfZmNX+GVdK4nK4DgDOx++A== X-Received: by 2002:a63:5f93:: with SMTP id t141mr13704125pgb.236.1625457026217; Sun, 04 Jul 2021 20:50:26 -0700 (PDT) Received: from smtpclient.apple ([150.109.103.155]) by smtp.gmail.com with ESMTPSA id q89sm9506029pjq.42.2021.07.04.20.50.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jul 2021 20:50:25 -0700 (PDT) From: stardiviner Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_98919232-3196-4915-92ED-F274C76C3F80" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH] make org-notify support for macOS desktop notification Date: Mon, 5 Jul 2021 11:50:22 +0800 In-Reply-To: To: Maxim Nikulin References: <5B57CD8B-AA91-4C63-A449-A07364083AEE@gmail.com> X-Mailer: Apple Mail (2.3654.100.0.2.22) Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=numbchild@gmail.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625457065; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=c6L1vXSfSX+Oz5yEo6Ywos2UzQ/tprH6Qpgyfk9c09Y=; b=aOCB0SOBbHjck8mzjPG5So7JY4je4bzl5aW8rmEytyOiPdQpPFo6xBxqxof/oHrcEtLTrm wHEZ+lnp4qcdBS4yyyKSUxqOahTsBG9vAyAFsz3d6hU0In3DrHr026GhBuqUJ9BKUIZAL7 zcndvPKG6Y8QpF4N79WdpkQuxc2xbh1cyGPTJ/u6/yg6Ccld5ADkMhNeij0AdCFb01JN+o fUcgg3fF1OIhyLv13ynIftd8BLkS+X8EabhGN6e7uTl43EBykY0rokqMuvU5+tjK2wP+Td OpG5UQX3GKMa1bskq0yuwcud52SCHg88ZBXfIln2vEEOPLAdd4hxOLMQ/cunKA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625457065; a=rsa-sha256; cv=none; b=QDC2RvMbqk6UkjrEwnM0AXw/GUbJGinMAxAwflO4bHHYd9LdpluQESJVoauG5LUmMzeWeJ QTofHE2LOhGSzVBjy5z1kSyruzdwKa/7b8+mN0sA9mROSNDIA/P/fZD2qoSM+a2QkAnB2C AwMBKuj7AtPhPLq1J3lwhfKppJL4tlxWXVMcTVDBWHgoPfvyQ50hEIhhEClnLVa9fBwU3z PWtG469K519t9MqYZXdmcQpKV2Ao1vb0H0tRrbrkKvLVz2SYDkHBpM7gcaOGB2FvaUn4VE UjBqdy3cn05X5lmVadjz+KuE8kBYvfYhmhro+zLHDwWWkd9M1O1VqtQZUYTOWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=eHI4h7Vx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=eHI4h7Vx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9A58927EA0 X-Spam-Score: -1.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: RPY3RmBNqM2l --Apple-Mail=_98919232-3196-4915-92ED-F274C76C3F80 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I updated the patch, I found the package `osx-lib` contains solution. So = I removed the directly osascript process invocation.= --Apple-Mail=_98919232-3196-4915-92ED-F274C76C3F80 Content-Disposition: attachment; filename=0001-org-clock.el-Make-org-notify-support-macOS-notificat.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-org-clock.el-Make-org-notify-support-macOS-notificat.patch" Content-Transfer-Encoding: quoted-printable =46rom=209bfb5d0d983f083558ecba51368ac4980f6008c7=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20stardiviner=20=0ADate:=20= Sun,=204=20Jul=202021=2008:13:43=20+0800=0ASubject:=20[PATCH]=20= org-clock.el:=20Make=20org-notify=20support=20macOS=20notification=0A=0A= *=20lisp/org-clock.el=20(org-show-notification):=20Add=20support=20for=20= macOS=0Anotification.=0A---=0A=20lisp/org-clock.el=20|=204=20+++-=0A=201=20= file=20changed,=203=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/org-clock.el=20b/lisp/org-clock.el=0Aindex=20cd930e875..314233156=20= 100644=0A---=20a/lisp/org-clock.el=0A+++=20b/lisp/org-clock.el=0A@@=20= -859,7=20+859,7=20@@=20use=20libnotify=20if=20available,=20or=20fall=20= back=20on=20a=20message."=0A=20=09=20=20=20=20= org-show-notification-timeout=0A=20=09=20=20=20=20nil=0A=20=09=20=20=20=20= (lambda=20()=20(w32-notification-close=20id)))))=0A-=09((fboundp=20= 'notifications-notify)=0A+=09((and=20(eq=20system-type=20'gnu/linux)=20= (fboundp=20'notifications-notify))=0A=20=09=20(notifications-notify=0A=20= =09=20=20:title=20"Org=20mode=20message"=0A=20=09=20=20:body=20= notification=0A@@=20-870,6=20+870,8=20@@=20use=20libnotify=20if=20= available,=20or=20fall=20back=20on=20a=20message."=0A=20=09= ((executable-find=20"notify-send")=0A=20=09=20(start-process=20= "emacs-timer-notification"=20nil=0A=20=09=09=09"notify-send"=20= notification))=0A+=20=20=20=20=20=20=20=20((and=20(eq=20system-type=20= 'darwin)=20(fboundp=20'osx-lib-notify2))=0A+=20=20=20=20=20=20=20=20=20= (osx-lib-notify2=20"Org=20mode=20message"=20notification))=0A=20=09;;=20= Maybe=20the=20handler=20will=20send=20a=20message,=20so=20only=20use=20= message=20as=0A=20=09;;=20a=20fall=20back=20option=0A=20=09(t=20(message=20= "%s"=20notification))))=0A--=20=0A2.30.1=20(Apple=20Git-130)=0A=0A= --Apple-Mail=_98919232-3196-4915-92ED-F274C76C3F80 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jul 4, 2021, at 1:48 PM, Maxim Nikulin wrote: >=20 > On 04/07/2021 07:23, stardiviner wrote: >> I found `org-notify` does not support macOS desktop notification. So = I write a small patch for this. >=20 > I am surprised that there is no OS-agnostic function in Emacs that = sends simple notification, suitable when no advanced feature are = necessary. Only OS-dependent variants are implemented for Linux and = Windows. >=20 >> + (format "'display notification \"%s\" with = title \"title\"'" notification "Org mode message"))) >=20 > Unsafe substitution of the argument. There is no guarantee that = notification has no quote characters. I do not know, which link you = would prefer: > - old https://xkcd.com/327/ "Robert'); DROP TABLE" > - recent = https://arstechnica.com/gadgets/2021/06/mass-data-wipe-in-my-book-devices-= prompts-warning-from-western-digital/ Wipe data from NAS (accordingly to = some sources, device can be protected by firewall, it is enough to open = in a browser a page with a malicious element, e.g. in = a comment of an earlier visitor) >=20 > The preferred way is to pass such parameters as separate arguments of = `start-process'. I am not familiar with osascript, I hope, it does not = additionally interpret strings passed to "display notification" to do = something fancy things. Example with sh: >=20 > Current unsafe variant: >=20 >> sh -c "`printf 'echo "%s: %s - %s"' 'some-command' '"; echo another = action ; echo "' 'second arg' > With parameters passed as separate arguments to avoid interpretation = of special characters: >=20 >> sh -c 'echo "$0: $1 - $2"' 'some-command' '"; echo another action ; = echo "' 'second arg' >=20 >=20 --Apple-Mail=_98919232-3196-4915-92ED-F274C76C3F80--