Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable org-protocol support out of the box #285

Open
jkp opened this issue Dec 17, 2020 · 8 comments
Open

Enable org-protocol support out of the box #285

jkp opened this issue Dec 17, 2020 · 8 comments
Assignees

Comments

@jkp
Copy link

jkp commented Dec 17, 2020

It would be great to have the org-protocol URL handler registered out of the box to enable org-capture to work.

This is supported by another mac-friendly port: emacs-mac or by installing a dedicated utility however the last method seems to be broken on newer versions of the OS.

I saw that this was mentioned in #158 but I thought it would be worth adding a dedicated feature request here to track progress independently of fixing that issue.

@kickingvegas
Copy link

Any progress to this issue?

@d12frosted
Copy link
Owner

@kickingvegas I have not worked on this feature. PRs are welcome :)

@kickingvegas
Copy link

@d12frosted - How about this counter-proposal - I’d be happy to pair code this PR with you! I’m asking because I’m really not well setup to build Emacs plus for Homebrew. Looking at the two 28.2 repos, it seems like the chief differences are in two files:

  • org-protocol.el
  • Info.plist.in

Repos

diff of emacs-mac/lisp/org/org-protocol.el with emacs-28.2/lisp/org/org-protocol.el

631c631
< (defun org-protocol-check-filename-for-protocol (fname restoffiles client)
---
> (defun org-protocol-check-filename-for-protocol (fname restoffiles _client)
672,675c672
< 		  ;; Emacs Mac port directly handles `org-protocol'
< 		  ;; URLs without the help of external commands or
< 		  ;; apps.  In this case, `client' is set to nil.
<                   (when (and client (plist-get (cdr prolist) :kill-client))
---
>                   (when (plist-get (cdr prolist) :kill-client)

The emacs-mac port makes extensive changes to the Info.plist.in file which is used to generate the Info.plist that is put in app bundle. That said I think the most significant difference with respect to Org Protocol support is adding org-protocol to the CFBundleURLTypes key as shown below.

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLName</key>
    <string>Email Address URL</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>mailto</string>
    </array>
  </dict>
  <dict>
    <key>CFBundleURLName</key>
    <string>Org Protocol URL</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>org-protocol</string>
    </array>
  </dict>
</array>

@yaqubroli
Copy link

Any progress on this? If this hasn't just been incorporated silently into master and not referenced in the issue, then I can make the PR

@d12frosted
Copy link
Owner

My bad. It slipped out of my head. @kickingvegas I will review your comment after I return home and get access to my laptop.

@maikol-solis
Copy link

Is there any update on this? Thanks.

@d12frosted
Copy link
Owner

@maikol-solis there are no updates; I would really apreciate someone just figuring out how to solve this and sending a PR.

@kickingvegas
Copy link

kickingvegas commented Mar 31, 2024

Found the commit that introduced org-protocol support in the Mitsuharu fork: 0d4110bb05f080a3f4f07ae9338d4d61b4d29c16

Affected files afaik:

lisp/org/org-protocol.el
lisp/term/mac-win.el
mac/templates/Info.plist.in

The function mac-ae-get-url is what handles a passed URL to the Emacs Mac App from an external app.

commit 0d4110bb05f080a3f4f07ae9338d4d61b4d29c16
Author: YAMAMOTO Mitsuharu <[email protected]>
Date:   Thu Jan 29 12:59:45 2015 +0900

    * emacs-24.4-mac-5.3 (2015-01-29)

    Blend-and-blur of background color on OS X 10.10 is temporarily
    disabled to avoid mode-line erasure on frame focus switch.  For some
    reason, mode-line row's `enabled_p' flag in the current matrix is
    sometimes reset even if it is visible.  This causes blank mode-line on
    "expose" (drawRect:) events.  In principle, this mode-line erasure can
    also happen on older versions of OS X or this version of Emacs Mac
    port.  But it is usually observed on OS X 10.10 together with previous
    5.x versions of Emacs Mac port, because the use of NSVisualEffectView,
    which provides the blend-and-blur feature, triggers full frame
    "exposure" on focus switch.

    ** Fixed bugs

    *** Special-display completion frame becomes transparent.
    Reported by Alan Shumitt.
    Adapt a fix for Bug#16619.

    *** `mac-auto-ascii-mode' on TTY terminals disables prefix keys with
    the meta key.

    *** Control-F2 is passed to the system even if
    mac-pass-control-to-system is set to nil.

    *** Synthetic bold text looks thinner on Retina display/HiDPI mode.
    This is because stroke line width for text drawing is not correctly
    scaled (whereas it is correctly scaled when drawn to bitmaps) on such
    environments.  I've been reporting this to Apple on every OS X update
    since it was 10.7.4, but I couldn't get any response until recently.
    At last Apple answers that there are no plans to address this issue
    (rdar://11644870) currently.  So I added a workaround that would cause
    a bad reverse effect if the original issue were fixed.

    *** `mac-ae-set-reply-parameter', which is used for reporting an error
    in Apple event hander, has not been working since emacs-24.2-mac-3.2.

    *** Input source functions ignore disabled input source ID strings.

    ** Improvements

    *** URL handler via Apple events now accepts the `org-protocol' scheme
    as well as `mailto'.
  • Notes [2023-12-02 Sat 15:10]

Yantar92 posted this on IRC about Org-Protocol support in Core. Apparently it is very difficult to abstract this behavior away to support multi-platform.

#65469 - [PATCH] * etc/emacsclient.desktop: Make Emacs default application for org-protocol - GNU bug report logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants