emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Adding a goto-heading protocol to org-protocol
@ 2021-06-23  6:34 Allen Li
  2021-06-25 14:55 ` Maxim Nikulin
  0 siblings, 1 reply; 2+ messages in thread
From: Allen Li @ 2021-06-23  6:34 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

I have a feature request that I'm wondering whether it would be suitable.

The idea is to add a new protocol that looks like
"org-protocol://goto-heading?id=UUID-HERE" that jumps to the specified Org
heading in Emacs.  The implementation is really simple:

;;;###autoload
(defun goto-heading (arg)
  "Org protocol handler for navigating to Org headings.
ARG is a property list."
  (org-id-goto (plist-get arg :id))
  (raise-frame))

(then add the appropriate item to org-protocol-protocol-alist-default)

The use case for this is to be able to link to Org headings from external
programs, e.g., Google Docs.

[-- Attachment #2: Type: text/html, Size: 774 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding a goto-heading protocol to org-protocol
  2021-06-23  6:34 Adding a goto-heading protocol to org-protocol Allen Li
@ 2021-06-25 14:55 ` Maxim Nikulin
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Nikulin @ 2021-06-25 14:55 UTC (permalink / raw)
  To: emacs-orgmode

On 23/06/2021 13:34, Allen Li wrote:
> 
> The idea is to add a new protocol that looks like 
> "org-protocol://goto-heading?id=UUID-HERE" that jumps to the specified 
> Org heading in Emacs.  The implementation is really simple:

It may be convenient in some cases. I prefer custom_id properties 
however since it provides some hint what is the link target. I am 
unsure, but maybe if you post complete recipe for customization and a 
bit more verbose description of use cases, more people will try it and 
will suggest possible improvements. In my opinion, currently conscious 
choices require more effort that actual code.

> ;;;###autoload
> (defun goto-heading (arg)
>    "Org protocol handler for navigating to Org headings.
> ARG is a property list."
>    (org-id-goto (plist-get arg :id))

- It seems `org-id-goto' does not call `org-mark-ring-push' (unlike 
`org-id-open' that is non-interactive). As a result it is impossible tu 
jump back using C-&.
- Should that heading be opened in current window or in other one?
- Likely other variants of specifying targets will be requested soon. Is 
it necessary to support file+custom_id, file+heading text, file+line 
number? If so, files should be filtered somehow to prevent security 
issues when attempt of opening of specific file (executable, image, 
etc.) can cause unexpected actions.
- Maybe even subprotocol name is not the best one.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-25 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23  6:34 Adding a goto-heading protocol to org-protocol Allen Li
2021-06-25 14:55 ` Maxim Nikulin

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).