From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iN+sMeaf5GDdewAAgWs5BA (envelope-from ) for ; Tue, 06 Jul 2021 20:24:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yIxaLeaf5GC0aQAAbx9fmQ (envelope-from ) for ; Tue, 06 Jul 2021 18:24:38 +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 0192927DC7 for ; Tue, 6 Jul 2021 20:24:38 +0200 (CEST) Received: from localhost ([::1]:57246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0pkI-000249-5t for larch@yhetil.org; Tue, 06 Jul 2021 14:24:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0pjU-000240-W5 for emacs-orgmode@gnu.org; Tue, 06 Jul 2021 14:23:45 -0400 Received: from smtp.chopps.org ([54.88.81.56]:52022) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0pjS-0007tO-KG for emacs-orgmode@gnu.org; Tue, 06 Jul 2021 14:23:44 -0400 Received: from smtpclient.apple (047-026-251-217.res.spectrum.com [47.26.251.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by smtp.chopps.org (Postfix) with ESMTPSA id 8DDA2803FB; Tue, 6 Jul 2021 18:23:39 +0000 (UTC) From: Christian Hopps Message-Id: <89A2389D-0283-4C12-B80D-831730ABB2A2@chopps.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_AE267482-6039-442E-8A81-B71E6D89E1B4" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [new patch] [PATCH] make org-notify support for macOS desktop notification Date: Tue, 6 Jul 2021 14:23:38 -0400 In-Reply-To: <1CCC83B2-3EFB-4221-9543-03A7BA935C70@gmail.com> To: stardiviner References: <5B57CD8B-AA91-4C63-A449-A07364083AEE@gmail.com> <87im1ol2lb.fsf@gmail.com> <7318E1D0-613A-4301-8097-779D3FEF1105@gmail.com> <1CCC83B2-3EFB-4221-9543-03A7BA935C70@gmail.com> X-Mailer: Apple Mail (2.3654.100.0.2.22) Received-SPF: none client-ip=54.88.81.56; envelope-from=chopps@chopps.org; helo=smtp.chopps.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Tim Cross , 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=1625595878; 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; bh=btDa98E0vFjPoPX8D1HBI6wTlSgVnXpECtEW9aNSW20=; b=UfsdIGHOpe/jhF2o3yc0K/MlLH7Uk2k7r9GcNGvC4AVBHMEwWHUIXNQEpTOor7N+OB0oV/ b8ueldj3j4Fzg0Qka4LtIwhxVSu85aXWFoV/Rk5o7//9jDwwNUmMekDqCE/TC/G06DrAwm gE4HZ2uAiapnK1ZP/mdEDWf6MRn097rMm440i0gw3oWRCVyEeEHYRZJ/jKmn0Cy54vfWYD 96DiioF5/QvG2cGvMU8G3q3ArjvJz2mDhDiEjzyLFUDEiI9n0xDjdS5bso7sRl2jPgQ4MH ejjxb3Q7iPbgPeO0GI0m+X+stQAfyWDnQxjwzDFl6DmshEXKdaFMjUKocFLO0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625595878; a=rsa-sha256; cv=none; b=i+W+LwhG5GWo4GcS8MuuZjti3kqcaSH720+BpMnro/eUprqp/A9VFsS4eVQnUc1WHnbb9c +2PRZq4eJLSd3zqyVZ2o1KUHAPmqXbjQm740d4f+ieEGdDS3IE25J6Q9DqXNd98lEaM0hh ZqPVufY9PDhzctLz6MIpP8n9tuvr6xdXqb8BEr8CaSsY3vQdCdupfVK8J5rw1vcUZTkxmj NmMNQrbzUDLhD7Q7LEm7KlAzEDykbZCmOgwk32gvp9JRAZLmO3UnfTt/l7Ip8nIAW8A5mH /vRwBuXWQylzHZxq8jhT7fc+IEd5JkPOESnt1xfGwJUdUDVBkGebAWNQY7M5xQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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.91 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: 0192927DC7 X-Spam-Score: -1.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: TGG/Yl0q+oLa --Apple-Mail=_AE267482-6039-442E-8A81-B71E6D89E1B4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 It supports imagemagick (specify =E2=80=94with-imagemagick), and it = includes svg by default, I simply forked the railwaycat version and = added the native notification code. Thanks, Chris. > On Jul 6, 2021, at 11:30 AM, stardiviner wrote: >=20 > Thanks for your suggestion. Does your Emacs build supports imagemagick = image view and svg feature support? Because company-mode now have = built-in icons support. This is the reason that I switch from = https://emacsformacosx.com/ to Homebrew = cask Emacs version. >=20 >> On Jul 6, 2021, at 12:21 PM, Christian Hopps > wrote: >>=20 >> Hi, >>=20 >> Please consider: I added full native notification support to the = popular OS X Emacs build available in homebrew. This supports rewrites = notifications-notify defun to use the native code rather than dbus, and = so everything "Just Works". >>=20 >> Info can be found here: >>=20 >> https://github.com/choppsv1/homebrew-emacsmacport = >>=20 >> Thanks, >> Chris. >>=20 >> stardiviner > = writes: >>=20 >>> Here is the new patch which invokes notifications though Emacs = built-in API `ns-do-applescript`. >>>=20 >>> [2. text/x-patch; = 0001-org-clock.el-Make-org-notify-support-macOS-notificat.patch]... >>>=20 >>>=20 >>>=20 >>>> On Jul 6, 2021, at 8:06 AM, Tim Cross > wrote: >>>>=20 >>>>=20 >>>> stardiviner > = writes: >>>>=20 >>>>>> On Jul 5, 2021, at 7:55 PM, Maxim Nikulin > wrote: >>>>>>=20 >>>>>> On 05/07/2021 10:50, stardiviner wrote: >>>>>>> I updated the patch, I found the package `osx-lib` contains = solution. >>>>>>> So I removed the directly osascript process invocation. >>>>>>=20 >>>>>> I have no objections any more. On the other hand I have no access = to macOS, so >>>>>> I have not tested this patch. Feel free to ignore comments from = this message, >>>>>> they are mostly matter of taste. >>>>>>=20 >>>>>> I expect that a simple script "notify-send" may allow to avoid = modification of >>>>>> code. Something like (untested, unsure concerning "quoted form of = ...") >>>>>>=20 >>>>>> #!/usr/bin/env osascript >>>>>> display notification (item 1 of argv) >>>>>>=20 >>>>>> However if osx-lib in is installed automatically, it may be more = convenient. >>>>>> Unsure if some of currently supported linux distributions have = notify-send >>>>>> that can not handle title as the first argument. >>>>>>=20 >>>>>>> - ((fboundp 'notifications-notify) >>>>>>> + ((and (eq system-type 'gnu/linux) (fboundp = 'notifications-notify)) >>>>>>=20 >>>>>> Does it mean that `notifications-notify' is bound but it does not = work on >>>>>> macOS? If so, maybe it is better to put new clause for 'darwin = above and to >>>>>> drop 'gnu/linux here. =46rom my point of view, it is preferable = to avoid >>>>>> additional requirement for `notifications-notify'. If someone = will create a >>>>>> feature request for `notifications-notify' for macOS, it will = just work >>>>>> without installing of additional packages as soon as such feature = is >>>>>> implemented. >>>>>>=20 >>>>>>=20 >>>>> I indeed tried `notifications-notify`. And it does not work, = reports error that >>>>> it needs dbus. PS. I used the Homebrew formulae version Emacs. >>>>> I considered the order of conditions. Because notifications and = notify-send etc >>>>> requires dbus. So I guess only Linux supports that. So add = system-type detection >>>>> will be better. WDYT? >>>>=20 >>>> I think you can add dbus support to macOS using homebrew and that = might >>>> resolve the issue. At the very least, this will need to be = investigated >>>> because otherwise, adding this patch may break configurations for = users >>>> who have added dbus support via homebrew and have notifications = working, >>>> but have not installed the osx-lib package. >>>>=20 >>>> My only small concern with your proposed changes is that it will = add a >>>> dependency on a new package osx-lib, which I think is only = available in >>>> melpa. At the very least, this will need to be documented = somewhere. >>>> However, I'm not sure what the situation is wrt adding code which >>>> depends on an external package which is not available in either = elpa or >>>> nongnuELPA? As org mode is a part of GNU Emacs, I suspect that any = code >>>> which 'encourages' the use of melpa packages will not be = acceptable. >>>>=20 >>>> -- >>>> Tim Cross >>>>=20 >>=20 >=20 --Apple-Mail=_AE267482-6039-442E-8A81-B71E6D89E1B4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 It = supports imagemagick (specify =E2=80=94with-imagemagick), and it = includes svg by default, I simply forked the railwaycat version and = added the native notification code.

Thanks,
Chris.

On Jul 6, 2021, at 11:30 AM, stardiviner <numbchild@gmail.com>= wrote:

Thanks for your = suggestion. Does your Emacs build supports imagemagick image view and = svg feature support? Because company-mode now have built-in icons = support. This is the reason that I switch from https://emacsformacosx.com/ to Homebrew cask Emacs = version.

On Jul 6, 2021, at 12:21 PM, = Christian Hopps <chopps@chopps.org> wrote:

Hi,
Please consider: I added full native = notification support to the popular OS X Emacs build available in = homebrew. This supports rewrites notifications-notify defun to use the = native code rather than dbus, and so everything "Just Works".

Info can be found here:

https://github.com/choppsv1/homebrew-emacsmacport

Thanks,
Chris.

stardiviner <numbchild@gmail.com> writes:

Here is the new patch = which invokes notifications though Emacs built-in API = `ns-do-applescript`.

[2. text/x-patch; = 0001-org-clock.el-Make-org-notify-support-macOS-notificat.patch]...



On Jul 6, 2021, at 8:06 AM, Tim Cross <theophilusx@gmail.com> wrote:


stardiviner <numbchild@gmail.com>= writes:

On Jul 5, 2021, at 7:55 = PM, Maxim Nikulin <manikulin@gmail.com> wrote:

On 05/07/2021 10:50, stardiviner wrote:
I updated the patch, I = found the package `osx-lib` contains solution.
So I = removed the directly osascript process invocation.

I have no objections any more. On = the other hand I have no access to macOS, so
I have not = tested this patch. Feel free to ignore comments from this message,
they are mostly matter of taste.

I= expect that a simple script "notify-send" may allow to avoid = modification of
code. Something like (untested, unsure = concerning "quoted form of ...")

#!/usr/bin/env osascript
display notification = (item 1 of argv)

However if osx-lib in is = installed automatically, it may be more convenient.
Unsure = if some of currently supported linux distributions have notify-send
that can not handle title as the first argument.

- ((fboundp = 'notifications-notify)
+ ((and (eq system-type 'gnu/linux) = (fboundp 'notifications-notify))

Does it mean that `notifications-notify' is bound but it does = not work on
macOS? If so, maybe it is better to put new = clause for 'darwin above and to
drop 'gnu/linux here. =46rom= my point of view, it is preferable to avoid
additional = requirement for `notifications-notify'. If someone will create a
feature request for `notifications-notify' for macOS, it will = just work
without installing of additional packages as = soon as such feature is
implemented.


I indeed tried = `notifications-notify`. And it does not work, reports error that
it needs dbus. PS. I used the Homebrew formulae version = Emacs.
I considered the order of conditions. Because = notifications and notify-send etc
requires dbus. So I = guess only Linux supports that. So add system-type detection
will be better. WDYT?

I think you can add dbus support to macOS using homebrew and = that might
resolve the issue. At the very least, this will = need to be investigated
because otherwise, adding this = patch may break configurations for users
who have added = dbus support via homebrew and have notifications working,
but have not installed the osx-lib package.

My only small concern with your proposed changes is that it = will add a
dependency on a new package osx-lib, which I = think is only available in
melpa. At the very least, this = will need to be documented somewhere.
However, I'm not = sure what the situation is wrt adding code which
depends = on an external package which is not available in either elpa or
nongnuELPA? As org mode is a part of GNU Emacs, I suspect = that any code
which 'encourages' the use of melpa packages = will not be acceptable.

--
Tim = Cross




= --Apple-Mail=_AE267482-6039-442E-8A81-B71E6D89E1B4--